Skip to content

Commit 9613ee0

Browse files
authored
Make PodSecurityPolicy name unique in k8s cluster when rbac.limit_to_namespace is true (#224)
- allows having multiple Pulsar clusters in different K8S namespaces but having the same helm release name - PodSecurityPolicy is a cluster-level-resource and name would collide without this change
1 parent dd0e6d8 commit 9613ee0

7 files changed

+26
-8
lines changed

Diff for: charts/pulsar/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ apiVersion: v2
2121
appVersion: "2.7.4"
2222
description: Apache Pulsar Helm chart for Kubernetes
2323
name: pulsar
24-
version: 2.7.10
24+
version: 2.7.11
2525
home: https://pulsar.apache.org
2626
sources:
2727
- https://github.com/apache/pulsar

Diff for: charts/pulsar/templates/autorecovery-rbac.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ subjects:
5959
apiVersion: policy/v1beta1
6060
kind: PodSecurityPolicy
6161
metadata:
62+
{{- if .Values.rbac.limit_to_namespace }}
63+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}-{{ template "pulsar.namespace" . }}"
64+
{{- else}}
6265
name: "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}"
63-
namespace: {{ template "pulsar.namespace" . }}
66+
{{- end}}
6467
spec:
6568
readOnlyRootFilesystem: false
6669
privileged: false

Diff for: charts/pulsar/templates/bookkeeper-rbac.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ subjects:
5959
apiVersion: policy/v1beta1
6060
kind: PodSecurityPolicy
6161
metadata:
62+
{{- if .Values.rbac.limit_to_namespace }}
63+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}-{{ template "pulsar.namespace" . }}"
64+
{{- else}}
6265
name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
63-
namespace: {{ template "pulsar.namespace" . }}
66+
{{- end}}
6467
spec:
6568
readOnlyRootFilesystem: false
6669
privileged: false

Diff for: charts/pulsar/templates/broker-rbac.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ subjects:
9797
apiVersion: policy/v1beta1
9898
kind: PodSecurityPolicy
9999
metadata:
100+
{{- if .Values.rbac.limit_to_namespace }}
101+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}-{{ template "pulsar.namespace" . }}"
102+
{{- else}}
100103
name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
101-
namespace: {{ template "pulsar.namespace" . }}
104+
{{- end}}
102105
spec:
103106
readOnlyRootFilesystem: false
104107
privileged: false

Diff for: charts/pulsar/templates/proxy-rbac.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ subjects:
5959
apiVersion: policy/v1beta1
6060
kind: PodSecurityPolicy
6161
metadata:
62+
{{- if .Values.rbac.limit_to_namespace }}
63+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}-{{ template "pulsar.namespace" . }}"
64+
{{- else}}
6265
name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
63-
namespace: {{ template "pulsar.namespace" . }}
66+
{{- end}}
6467
spec:
6568
readOnlyRootFilesystem: false
6669
privileged: false

Diff for: charts/pulsar/templates/toolset-rbac.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ subjects:
5959
apiVersion: policy/v1beta1
6060
kind: PodSecurityPolicy
6161
metadata:
62+
{{- if .Values.rbac.limit_to_namespace }}
63+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}-{{ template "pulsar.namespace" . }}"
64+
{{- else}}
6265
name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"
63-
namespace: {{ template "pulsar.namespace" . }}
66+
{{- end}}
6467
spec:
6568
readOnlyRootFilesystem: false
6669
privileged: false

Diff for: charts/pulsar/templates/zookeeper-rbac.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ subjects:
5959
apiVersion: policy/v1beta1
6060
kind: PodSecurityPolicy
6161
metadata:
62-
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
63-
namespace: {{ template "pulsar.namespace" . }}
62+
{{- if .Values.rbac.limit_to_namespace }}
63+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ template "pulsar.namespace" . }}"
64+
{{- else}}
65+
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
66+
{{- end}}
6467
spec:
6568
readOnlyRootFilesystem: false
6669
privileged: false

0 commit comments

Comments
 (0)