Description
Type of question
Are you asking about community best practices, how to implement a specific feature, or about general context and help around the operator-sdk?
- Best Practice
- General Context
- Help with operator-sdk in relation to OLM
Question
What did you do?
The syndesis operator is migrating to operator-sdk 1.0.0+ and as such is changing to the correct file layout and bundle generation. The operator binary has up until now generated a CSV manifest via custom golang code which we would like to replace with $(KUSTOMIZE) build $(KOPTIONS) manifests | operator-sdk generate bundle ...
. In short, we wanted to use the operator-sdk
to get to this CSV.
What did you expect to see?
Since the syndesis operator uses the service-account syndesis-operator
and its operands use a couple of extra service-accounts syndesis-server
and syndesis-public-oauthproxy
, we have ClusterRoles and ClusterRoleBindings providing the relevant permissions for each one. Since the OLM installs the operator with ClusterAdmin privileges, it seemed sensible to add all of these service-accounts to the clusterpermissions
section of our CSV.
What did you see instead? Under which circumstances?
Having migrated to operator-sdk bundle generation, the ClusterRole permissions for syndesis-operator
are included in the CSV but the ClusterRoles and ClusterRoleBindings for the other service-accounts are presented in their own resource files alongside the CSV. The problem is that the ClusterRoleBinding resource files specify a namespace in the subject
portion, for the service-account, that is not appropriate for the user installing the operator.
To avoid this issue, I've refactored the ClusterRoleBindings for the additional service-accounts into the operator infrastructure, ie. the operator is now responsible for their installation and not the CSV. This has meant that the operator now requires the ClusterRoleBinding GET/UPDATE/DELETE permissions at the cluster-level.
This seems, architecturally, to be correct since:
- The operator is in charge of creating the operands and therefore their service-accounts;
- The namespace of the operands will only be known at the point of their installation and not when the operator is installed;
My reluctance (hence this question) concerns the necessary addition of privileges to the operator:
- Is it best practice for an operator to be creating ClusterRoleBindings in this context?
- Should an operator and its operands only use one service-account throughout?
- How else is it possible to apply cluster-level permissions to an operand's service-account that is namespace-specific & is different to the operator's own service-account?