Skip to content

Commit 41d531d

Browse files
authored
Avoid nil pointer for authorizationPolicy (#1246)
```yaml broker: replicaCount: 1 component: broker authorizationPolicy: null # Explicitly set to null ``` Explicitly set to null will cause NPE.
1 parent b13e11c commit 41d531d

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

charts/sn-platform-slim/templates/bookkeeper/bookkeeper-authorizationpolicy.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ metadata:
1010
namespace: {{ template "pulsar.namespace" . }}
1111
spec:
1212
rules:
13-
- {{- if .Values.bookkeeper.authorizationPolicy.from }}
13+
- {{- if and .Values.bookkeeper.authorizationPolicy .Values.bookkeeper.authorizationPolicy.from }}
1414
from:
1515
{{ toYaml .Values.bookkeeper.authorizationPolicy.from | indent 4 }}
1616
{{- end }}
17-
{{- if .Values.bookkeeper.authorizationPolicy.to }}
17+
{{- if and .Values.bookkeeper.authorizationPolicy .Values.bookkeeper.authorizationPolicy.to }}
1818
to:
1919
{{ toYaml .Values.bookkeeper.authorizationPolicy.to | indent 4 }}
2020
{{- else }}
@@ -39,11 +39,11 @@ metadata:
3939
namespace: {{ template "pulsar.namespace" . }}
4040
spec:
4141
rules:
42-
- {{- if .Values.autorecovery.authorizationPolicy.from }}
42+
- {{- if and .Values.autorecovery.authorizationPolicy .Values.autorecovery.authorizationPolicy.from }}
4343
from:
4444
{{ toYaml .Values.autorecovery.authorizationPolicy.from | indent 4 }}
4545
{{- end }}
46-
{{- if .Values.autorecovery.authorizationPolicy.to }}
46+
{{- if and .Values.autorecovery.authorizationPolicy .Values.autorecovery.authorizationPolicy.to }}
4747
to:
4848
{{ toYaml .Values.autorecovery.authorizationPolicy.to | indent 4 }}
4949
{{- else }}

charts/sn-platform-slim/templates/broker/broker-authorizationpolicy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ metadata:
1010
namespace: {{ template "pulsar.namespace" . }}
1111
spec:
1212
rules:
13-
- {{- if .Values.broker.authorizationPolicy.from }}
13+
- {{- if and .Values.broker.authorizationPolicy .Values.broker.authorizationPolicy.from }}
1414
from:
1515
{{ toYaml .Values.broker.authorizationPolicy.from | indent 4 }}
1616
{{- end }}
17-
{{- if .Values.broker.authorizationPolicy.to }}
17+
{{- if and .Values.broker.authorizationPolicy .Values.broker.authorizationPolicy.to }}
1818
to:
1919
{{ toYaml .Values.broker.authorizationPolicy.to | indent 4 }}
2020
{{- else }}

charts/sn-platform-slim/templates/zookeeper/zookeeper-authorizationpolicy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ metadata:
1010
namespace: {{ template "pulsar.namespace" . }}
1111
spec:
1212
rules:
13-
- {{- if .Values.zookeeper.authorizationPolicy.from }}
13+
- {{- if and .Values.zookeeper.authorizationPolicy .Values.zookeeper.authorizationPolicy.from }}
1414
from:
1515
{{ toYaml .Values.zookeeper.authorizationPolicy.from | indent 4 }}
1616
{{- end }}
17-
{{- if .Values.zookeeper.authorizationPolicy.to }}
17+
{{- if and .Values.zookeeper.authorizationPolicy .Values.zookeeper.authorizationPolicy.to }}
1818
to:
1919
{{ toYaml .Values.zookeeper.authorizationPolicy.to | indent 4 }}
2020
{{- else }}

charts/sn-platform/templates/bookkeeper/bookkeeper-authorizationpolicy.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ metadata:
1010
namespace: {{ template "pulsar.namespace" . }}
1111
spec:
1212
rules:
13-
- {{- if .Values.bookkeeper.authorizationPolicy.from }}
13+
- {{- if and .Values.bookkeeper.authorizationPolicy .Values.bookkeeper.authorizationPolicy.from }}
1414
from:
1515
{{ toYaml .Values.bookkeeper.authorizationPolicy.from | indent 4 }}
1616
{{- end }}
17-
{{- if .Values.bookkeeper.authorizationPolicy.to }}
17+
{{- if and .Values.bookkeeper.authorizationPolicy .Values.bookkeeper.authorizationPolicy.to }}
1818
to:
1919
{{ toYaml .Values.bookkeeper.authorizationPolicy.to | indent 4 }}
2020
{{- else }}
@@ -39,11 +39,11 @@ metadata:
3939
namespace: {{ template "pulsar.namespace" . }}
4040
spec:
4141
rules:
42-
- {{- if .Values.autorecovery.authorizationPolicy.from }}
42+
- {{- if and .Values.autorecovery.authorizationPolicy .Values.autorecovery.authorizationPolicy.from }}
4343
from:
4444
{{ toYaml .Values.autorecovery.authorizationPolicy.from | indent 4 }}
4545
{{- end }}
46-
{{- if .Values.autorecovery.authorizationPolicy.to }}
46+
{{- if and .Values.autorecovery.authorizationPolicy .Values.autorecovery.authorizationPolicy.to }}
4747
to:
4848
{{ toYaml .Values.autorecovery.authorizationPolicy.to | indent 4 }}
4949
{{- else }}

charts/sn-platform/templates/broker/broker-authorizationpolicy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ metadata:
1010
namespace: {{ template "pulsar.namespace" . }}
1111
spec:
1212
rules:
13-
- {{- if .Values.broker.authorizationPolicy.from }}
13+
- {{- if and .Values.broker.authorizationPolicy .Values.broker.authorizationPolicy.from }}
1414
from:
1515
{{ toYaml .Values.broker.authorizationPolicy.from | indent 4 }}
1616
{{- end }}
17-
{{- if .Values.broker.authorizationPolicy.to }}
17+
{{- if and .Values.broker.authorizationPolicy .Values.broker.authorizationPolicy.to }}
1818
to:
1919
{{ toYaml .Values.broker.authorizationPolicy.to | indent 4 }}
2020
{{- else }}

charts/sn-platform/templates/zookeeper/zookeeper-authorizationpolicy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ metadata:
1010
namespace: {{ template "pulsar.namespace" . }}
1111
spec:
1212
rules:
13-
- {{- if .Values.zookeeper.authorizationPolicy.from }}
13+
- {{- if and .Values.zookeeper.authorizationPolicy .Values.zookeeper.authorizationPolicy.from }}
1414
from:
1515
{{ toYaml .Values.zookeeper.authorizationPolicy.from | indent 4 }}
1616
{{- end }}
17-
{{- if .Values.zookeeper.authorizationPolicy.to }}
17+
{{- if and .Values.zookeeper.authorizationPolicy .Values.zookeeper.authorizationPolicy.to }}
1818
to:
1919
{{ toYaml .Values.zookeeper.authorizationPolicy.to | indent 4 }}
2020
{{- else }}

0 commit comments

Comments
 (0)