-
Notifications
You must be signed in to change notification settings - Fork 34
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
Added logic to watch all namespaces #38
base: main
Are you sure you want to change the base?
Conversation
Default value is false to maintain backward compatability
Updated logic around RoleBinding vs ClusterRoleBinding based on watchAllNamespaces value
|
||
|
||
|
||
### Helm Chart |
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.
I would skip this paragraph completely.
|
||
The Helm chart consists of several components. The Kubernetes configurations associated with the Helm chart are located under `crds/` and `templates/`. | ||
|
||
#### Custom Resource Definition |
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.
I would skip this paragraph completely.
|
||
The Custom Resource Definition under `crds/app.terraform.io_workspaces_crd.yaml` defines that the Workspace Custom Resource schema. | ||
|
||
#### Role-Based Access Control |
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.
I would skip this paragraph completely.
fieldPath: metadata.namespace | ||
``` | ||
|
||
When deploying, if you want to explicitly watch all namespaces, |
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.
Line wrapping should be on 80 characters.
|
||
#### Namespace Scope | ||
|
||
To ensure the operator does not have access to secrets or resource beyond the namespace, the Helm chart scopes the operator's deployment to a namespace. |
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.
Line wrapping should be on 80 characters.
Define the kind of Role to use | ||
*/}} | ||
{{- define "terraform.getRole" -}} | ||
{{- if .Values.syncWorkspace.watchAllNamespaces -}} |
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.
I would change this to this:
{{/*
Define the kind of Role to use
*/}}
{{- define "terraform.getRole" -}}
{{- if or .Values.syncWorkspace.watchAllNamespaces (or (empty .Values.syncWorkspace.k8WatchNamespace) (eq (.Values.syncWorkspace.k8WatchNamespace | toString) .Release.Namespace)) }}
{{- "ClusterRole" }}
{{- else }}
{{- "Role" }}
{{- end }}
{{- end -}}
I would love to see this PR merged - any chance of getting some traction here please ? |
The motivation for this PR is that currently, this helm chart only provides the option to watch a single namespace either be it the release namespace or the value in the
k8WatchNamespace
. This PR provides the functionality to explicitly allow the operator to watch all namespaces.This pull request adds:
watchAllNamespaces
(default tofalse
) to watch for workspace CRDs in all namespacesk8WatchNamespace
var and the newwatchAllNamespaces
varWe're raising this as a draft PR and then If you folks are OK with these changes - we can add all the required tests as per guidelines.