From ca585caa5d76d00128fba18c03f8f11735af174a Mon Sep 17 00:00:00 2001 From: Tomislav Plavcic Date: Wed, 29 May 2024 11:37:00 +0200 Subject: [PATCH] K8SPG-585 - pg-operator - Add namespace into templates --- charts/pg-operator/Chart.yaml | 2 +- charts/pg-operator/templates/deployment.yaml | 1 + charts/pg-operator/templates/role-binding.yaml | 9 +++++---- charts/pg-operator/templates/role.yaml | 3 +++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/charts/pg-operator/Chart.yaml b/charts/pg-operator/Chart.yaml index e43d56b1..ea01a36e 100644 --- a/charts/pg-operator/Chart.yaml +++ b/charts/pg-operator/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pg-operator description: 'A Helm chart to deploy the Percona Operator for PostgreSQL' type: application -version: 2.3.4 +version: 2.3.5 appVersion: 2.3.1 home: https://docs.percona.com/percona-operator-for-postgresql/2.0/ maintainers: diff --git a/charts/pg-operator/templates/deployment.yaml b/charts/pg-operator/templates/deployment.yaml index d658e4e0..2f8ef214 100644 --- a/charts/pg-operator/templates/deployment.yaml +++ b/charts/pg-operator/templates/deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "postgres-operator.fullname" . }} + namespace: {{ .Release.Namespace }} labels: {{ include "postgres-operator.labels" . | indent 4 }} pgv2.percona.com/control-plane: postgres-operator diff --git a/charts/pg-operator/templates/role-binding.yaml b/charts/pg-operator/templates/role-binding.yaml index 6f5e55c1..034e393a 100644 --- a/charts/pg-operator/templates/role-binding.yaml +++ b/charts/pg-operator/templates/role-binding.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "postgres-operator.fullname" . }} + namespace: {{ .Release.Namespace }} --- {{- if or .Values.watchNamespace .Values.watchAllNamespaces }} kind: ClusterRoleBinding @@ -11,9 +12,9 @@ kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ include "postgres-operator.fullname" . }} - {{- if .Values.watchNamespace }} - namespace: {{ .Values.watchNamespace }} - {{- end }} +{{- if not (or .Values.watchNamespace .Values.watchAllNamespaces) }} + namespace: {{ .Release.Namespace }} +{{- end }} labels: {{ include "postgres-operator.labels" . | indent 4 }} subjects: @@ -29,4 +30,4 @@ roleRef: kind: Role {{- end }} name: {{ include "postgres-operator.fullname" . }} - apiGroup: rbac.authorization.k8s.io \ No newline at end of file + apiGroup: rbac.authorization.k8s.io diff --git a/charts/pg-operator/templates/role.yaml b/charts/pg-operator/templates/role.yaml index 68772664..0a268a51 100644 --- a/charts/pg-operator/templates/role.yaml +++ b/charts/pg-operator/templates/role.yaml @@ -6,6 +6,9 @@ kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ include "postgres-operator.fullname" . }} +{{- if not (or .Values.watchNamespace .Values.watchAllNamespaces) }} + namespace: {{ .Release.Namespace }} +{{- end }} labels: {{ include "postgres-operator.labels" . | indent 4 }} rules: