Skip to content

Commit 6db3307

Browse files
authored
Improve init container (#1251)
<!-- ### Contribution Checklist - Name the pull request in the form "[charts/<chart-name>] Title of the pull request". Skip *[charts/<chart-name>]* if the PR doesn't change a specific chart. E.g. `[docs] Fix typo in README`. - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review. - Each pull request should address only one issue, not mix up code from multiple issues. - Each commit in the pull request has a meaningful commit message - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below. **(The sections below can be removed for hotfixes of typos)** --> *(If this PR fixes a github issue, please add `Fixes #<xyz>`.)* Fixes #<xyz> *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)* Master Issue: #<xyz> ### Motivation *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications *Describe the modifications you've done.* ### Verifying this change - [ ] Make sure that the change passes the CI checks. *(Please pick either of the following options)* This change is a trivial rework / code cleanup without any test coverage. *(or)* This change is already covered by existing tests, such as *(please describe tests)*. *(or)* This change added tests and can be verified as follows: *(example:)* - *Added integration tests for end-to-end deployment with large payloads (10MB)* - *Extended integration test for recovery after broker failure* ### Documentation Check the box below. Need to update docs? - [ ] `doc-required` (If you need help on updating docs, create a doc issue) - [ ] `no-need-doc` (Please explain why) - [ ] `doc` (If this PR contains doc changes)
1 parent f6414b1 commit 6db3307

File tree

6 files changed

+22
-0
lines changed

6 files changed

+22
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,12 @@ spec:
364364
env;
365365
{{- end }}
366366
bin/pulsar-metadata-tool cleanup
367+
{{- if .Values.bookkeeper.initContainerSecurityContext }}
368+
securityContext: {{- toYaml .Values.bookkeeper.initContainerSecurityContext | nindent 16 }}
369+
{{- end }}
370+
{{- if .Values.bookkeeper.resources }}
371+
resources: {{- toYaml .Values.bookkeeper.resources | nindent 16 }}
372+
{{- end }}
367373
env:
368374
- name: METADATA_TOOL_CONF
369375
value: "/pulsar-metadata-tool/conf/pulsar-metadata-tool/pulsar-metadata-tool.properties"

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ spec:
7171
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.customTools.restore.component }}"
7272
image: "{{ .Values.images.zookeeper.customTools.restore.repository }}:{{ .Values.images.zookeeper.customTools.restore.tag }}"
7373
imagePullPolicy: {{ .Values.zookeeper.customTools.restore.pullPolicy }}
74+
{{- if .Values.zookeeper.initContainerSecurityContext }}
75+
securityContext: {{- toYaml .Values.zookeeper.initContainerSecurityContext | nindent 10 }}
76+
{{- end }}
7477
command: ["sh", "-c"]
7578
args:
7679
- >

charts/sn-platform-slim/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ zookeeper:
639639
advanced: {}
640640
securityContext:
641641
runAsNonRoot: true
642+
initContainerSecurityContext: {}
642643
tolerations: []
643644
gracePeriod: 30
644645
# Resources requests/limits for both init containers and app containers
@@ -888,6 +889,7 @@ bookkeeper:
888889
annotations: {}
889890
securityContext:
890891
runAsNonRoot: true
892+
initContainerSecurityContext: {}
891893
tolerations: []
892894
gracePeriod: 30
893895
# The minimum number of seconds for new pods to be ready.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,12 @@ spec:
364364
env;
365365
{{- end }}
366366
bin/pulsar-metadata-tool cleanup
367+
{{- if .Values.bookkeeper.initContainerSecurityContext }}
368+
securityContext: {{- toYaml .Values.bookkeeper.initContainerSecurityContext | nindent 16 }}
369+
{{- end }}
370+
{{- if .Values.bookkeeper.resources }}
371+
resources: {{- toYaml .Values.bookkeeper.resources | nindent 16 }}
372+
{{- end }}
367373
env:
368374
- name: METADATA_TOOL_CONF
369375
value: "/pulsar-metadata-tool/conf/pulsar-metadata-tool/pulsar-metadata-tool.properties"

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ spec:
7171
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.customTools.restore.component }}"
7272
image: "{{ .Values.images.zookeeper.customTools.restore.repository }}:{{ .Values.images.zookeeper.customTools.restore.tag }}"
7373
imagePullPolicy: {{ .Values.zookeeper.customTools.restore.pullPolicy }}
74+
{{- if .Values.zookeeper.initContainerSecurityContext }}
75+
securityContext: {{- toYaml .Values.zookeeper.initContainerSecurityContext | nindent 10 }}
76+
{{- end }}
7477
command: ["sh", "-c"]
7578
args:
7679
- >

charts/sn-platform/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ zookeeper:
714714
advanced: {}
715715
securityContext:
716716
runAsNonRoot: true
717+
initContainerSecurityContext: {}
717718
tolerations: []
718719
gracePeriod: 30
719720
# Resources requests/limits for both init containers and app containers
@@ -963,6 +964,7 @@ bookkeeper:
963964
annotations: {}
964965
securityContext:
965966
runAsNonRoot: true
967+
initContainerSecurityContext: {}
966968
tolerations: []
967969
gracePeriod: 30
968970
# The minimum number of seconds for new pods to be ready.

0 commit comments

Comments
 (0)