-
Notifications
You must be signed in to change notification settings - Fork 845
feat: operator watch namespaces #6434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: operator watch namespaces #6434
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an additional situation we will want to cover, but we might choose to reprioritise and deal with it in a separate PR:
-
clusterwide: True
,watchNamespaces
not set -- watch all namespaces -
clusterwide: True
,watchNamespaces
is set and we allow the operator ClusterRole/ClusterRoleBinding permissions. Here, the operator only watches some namespaces but has the permissions to watch any namespace. In security-restricted environments, this is problematic. However, other operators like postgres or spark also only offer this option. -
clusterwide: False
,watchNamespaces
not set -- only watch the namespace where the operator is installed -
clusterwide: False
,watchNamespaces
is set -- we only give permissions to the operator to watch the specific list of namespaces. The helm chart needs to create RoleBindings in each namespace in the list (or which matches a specific criteria) during the call tohelm install
orhelm upgrade
. These RoleBindings should give the operator’s service account the necessary privileges in the namespace.
Before we merge this, let's test for sane behaviour when instantiating two operators in |
In this case, although the scheduler seems to behave ok for model loading/unloading, there are some errors which pop up in the operator. When loading:
When unloading:
This is a faulty configuration anyways, and maybe we should address it in a future PR. |
@@ -183,7 +183,7 @@ rules: | |||
- list | |||
- watch | |||
--- | |||
{{- if .Values.controller.clusterwide -}} | |||
{{- if and (not .Values.controller.skipClusterRoleCreation) (or .Values.controller.clusterwide .Values.controller.watchNamespaces) -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the cluster role specific to the operator. Perhaps we should reflect that in the value name? Something like skipOperatorClusterRoleCreation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just a small suggestion on the helm value name
* Modified helm-chart to watch for specific namespaces * Included watch-namespaces flag and validation of the flags * Removed extra indent * Fixed autogenerated charts * Added new line at the end of patch_controller.yaml * Refactored operator code so watchNamespaces if used in conjuction with clusterwide * Ensure the current namespace is included in the cache config and imporved parsing * Implemented the option to skip the creation of ClusterRole * Replaced Release.Name with Release.Namespace * Fixed rolebinding config * Remove namespace from the name of rolebind since it is not required * Improved flag description * Renamed skipClusterRoleCreation to skipOperatorClusterRoleCreation
What this PR does / why we need it:
This PR implements the option to configure the operator to watch specific namespaces.
To install the operator to watch specific namespaces, run:
helm upgrade seldon-core-v2-setup ./seldon-core-v2-setup/ --namespace seldon-mesh --set "controller.watchNamespaces={seldon-mesh,seldon-mesh-2}" --set controller.clusterwide=false --install
In the example above, the operator will watch only
seldon-mesh
andseldon-mesh-2
namespaces.Configuration details:
clusterwide
flag is set totrue
andwatchNamespace
is not set, then all the namespaces will be watchedclusterwide
flag is set totrue
andwatchNamespaces
is set, then the operator will watch the namespaces specifiedclusterwide
flag is set tofalse
, then the operator will watch thePOD_NAMESPACE
which is the same as the release namespace.Additionally, if a user wants to have a controller in
ns1
watching theseldon-mesh-1
, and another controller inns2
watchingseldon-mesh-2
, they can use--set controller.skipClusterRoleCreation
to overcome the error from recreating the same cluster role twice.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: