Skip to content
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

K8SPSMDB-930 - psmdb-operator - Fix watchNamespace #296

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/psmdb-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: "1.15.0"
description: A Helm chart for deploying the Percona Operator for MongoDB
name: psmdb-operator
home: https://docs.percona.com/percona-operator-for-mongodb/
version: 1.15.2
version: 1.15.3
maintainers:
- name: tplavcic
email: [email protected]
Expand Down
3 changes: 2 additions & 1 deletion charts/psmdb-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ The chart can be customized using the following configurable parameters:
| `nodeSelector` | Labels for Pod assignment | `{}` |
| `podAnnotations` | Annotations for pod | `{}` |
| `podSecurityContext` | Pod Security Context | `{}` |
| `watchNamespace` | Set when a different from default namespace is needed to watch | `""` |
| `watchNamespace` | Set when a different from default namespace is needed to watch (comma separated if multiple needed) | `""` |
| `createNamespace` | Set if you want to create watched namespaces with helm | `false` |
| `rbac.create` | If false RBAC will not be created. RBAC resources will need to be created manually | `true` |
| `securityContext` | Container Security Context | `{}` |
| `serviceAccount.create` | If false the ServiceAccounts will not be created. The ServiceAccounts must be created manually | `true` |
Expand Down
7 changes: 5 additions & 2 deletions charts/psmdb-operator/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{{ if .Values.watchNamespace }}
{{ if and .Values.watchNamespace .Values.createNamespace }}
{{ range ( split "," .Values.watchNamespace ) }}
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.watchNamespace }}
name: {{ trim . }}
annotations:
helm.sh/resource-policy: keep
---
{{ end }}
{{ end }}
6 changes: 2 additions & 4 deletions charts/psmdb-operator/templates/role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: service-account-{{ include "psmdb-operator.fullname" . }}
{{- if .Values.watchNamespace }}
namespace: {{ .Values.watchNamespace }}
{{- else if not .Values.watchAllNamespaces }}
{{- if not (or .Values.watchNamespace .Values.watchAllNamespaces) }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
labels:
{{ include "psmdb-operator.labels" . | indent 4 }}
subjects:
Expand Down
2 changes: 2 additions & 0 deletions charts/psmdb-operator/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "psmdb-operator.fullname" . }}
{{- if not (or .Values.watchNamespace .Values.watchAllNamespaces) }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
{{ include "psmdb-operator.labels" . | indent 4 }}
rules:
Expand Down
3 changes: 3 additions & 0 deletions charts/psmdb-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ disableTelemetry: false

# set if you want to specify a namespace to watch
# defaults to `.Release.namespace` if left blank
# multiple namespaces can be specified and separated by comma
# watchNamespace:
# set if you want that watched namespaces are created by helm
# createNamespace: false

# set if operator should be deployed in cluster wide mode. defaults to false
watchAllNamespaces: false
Expand Down
Loading