From 1956a870ff7bf1c50bcc60f03ae72322e1d8ea70 Mon Sep 17 00:00:00 2001 From: Frank Kelly <62910985+frankjkelly@users.noreply.github.com> Date: Fri, 12 Nov 2021 10:56:35 -0500 Subject: [PATCH] =?UTF-8?q?Fixes=20#173=20Support=20both=20Role=20Binding?= =?UTF-8?q?=20and=20Cluster=20Role=20Binding=20dependi=E2=80=A6=20(#174)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixes #173 Support both Role Binding and Cluster Role Binding depending on rbac.limit_to_namespace * Rev version * Get Role/Cluster the right way around --- charts/pulsar/Chart.yaml | 2 +- .../templates/broker-cluster-role-binding.yaml | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/Chart.yaml index 4265d63..e628ddd 100644 --- a/charts/pulsar/Chart.yaml +++ b/charts/pulsar/Chart.yaml @@ -21,7 +21,7 @@ apiVersion: v1 appVersion: "2.7.2" description: Apache Pulsar Helm chart for Kubernetes name: pulsar -version: 2.7.4 +version: 2.7.5 home: https://pulsar.apache.org sources: - https://github.com/apache/pulsar diff --git a/charts/pulsar/templates/broker-cluster-role-binding.yaml b/charts/pulsar/templates/broker-cluster-role-binding.yaml index d76f9c1..706e1ba 100644 --- a/charts/pulsar/templates/broker-cluster-role-binding.yaml +++ b/charts/pulsar/templates/broker-cluster-role-binding.yaml @@ -22,17 +22,24 @@ apiVersion: rbac.authorization.k8s.io/v1 {{- if .Values.rbac.limit_to_namespace }} kind: RoleBinding +metadata: + name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}-rolebinding" {{- else}} kind: ClusterRoleBinding -{{- end}} metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}-clusterrolebinding" +{{- end}} labels: {{- include "pulsar.standardLabels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io +{{- if .Values.rbac.limit_to_namespace }} + kind: Role + name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}-role" +{{- else}} kind: ClusterRole name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}-clusterrole" +{{- end}} subjects: - kind: ServiceAccount name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}-acct" @@ -40,9 +47,15 @@ subjects: --- apiVersion: rbac.authorization.k8s.io/v1 +{{- if .Values.rbac.limit_to_namespace }} +kind: Role +metadata: + name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}-role" +{{- else}} kind: ClusterRole metadata: name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}-clusterrole" +{{- end}} labels: {{- include "pulsar.standardLabels" . | nindent 4 }} rules: @@ -67,4 +80,4 @@ rules: - patch --- -{{- end }} \ No newline at end of file +{{- end }}