Skip to content

Commit 06300e7

Browse files
u023368dpage
authored andcommitted
Make init container security context configurable in the Helm chart (pgadmin-org#9646)
The two init containers in the Helm deployment template had hardcoded securityContext blocks, unlike the main container which already renders its context from .Values.containerSecurityContext via the renderSecurityContext helper. Switch the init containers to the same pattern so operators can customise (or disable) their security context. Default behaviour is unchanged: containerSecurityContext defaults to enabled with values identical to the previous hardcoded block, and the helper continues to gate appArmorProfile on global.compatibility.appArmor.enabled. Verified with helm template that the rendered init-container securityContext is unchanged for the default values, honours the appArmor toggle, and is omitted entirely when containerSecurityContext.enabled=false. Adds a 9.16 release note.
1 parent 397be4e commit 06300e7

2 files changed

Lines changed: 7 additions & 36 deletions

File tree

docs/en_US/release_notes_9_16.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ New features
2121
************
2222

2323
| `Issue #9626 <https://github.com/pgadmin-org/pgadmin4/issues/9626>`_ - Add support for the TOAST tuple target storage parameter in the Materialized View dialog.
24+
| `Issue #9646 <https://github.com/pgadmin-org/pgadmin4/issues/9646>`_ - Make the init container security context in the Helm chart configurable via containerSecurityContext, consistent with the main container.
2425
| `Issue #9699 <https://github.com/pgadmin-org/pgadmin4/issues/9699>`_ - Add support for closing a tab with a middle-click on its title.
2526
2627
Housekeeping

pkg/helm/templates/deployment.yaml

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -192,24 +192,9 @@ spec:
192192
limits:
193193
cpu: 50m
194194
memory: 64Mi
195-
securityContext:
196-
seLinuxOptions: {}
197-
runAsUser: 1001
198-
runAsGroup: 1001
199-
runAsNonRoot: true
200-
privileged: false
201-
readOnlyRootFilesystem: true
202-
allowPrivilegeEscalation: false
203-
capabilities:
204-
drop: ["ALL"]
205-
seccompProfile:
206-
type: RuntimeDefault
207-
{{- if .Values.global.compatibility.appArmor.enabled }}
208-
appArmorProfile:
209-
type: RuntimeDefault
210-
{{- end }}
211-
windowsOptions:
212-
hostProcess: false
195+
{{- if .Values.containerSecurityContext.enabled }}
196+
securityContext: {{- include "renderSecurityContext" (dict "securityContext" .Values.containerSecurityContext "context" .) | nindent 12 }}
197+
{{- end }}
213198
- name: unset-python3-cli-net-cap
214199
image: {{ template "pgadmin4.image" . }}
215200
imagePullPolicy: {{ .Values.image.pullPolicy }}
@@ -226,21 +211,6 @@ spec:
226211
limits:
227212
cpu: 50m
228213
memory: 64Mi
229-
securityContext:
230-
seLinuxOptions: {}
231-
runAsUser: 1001
232-
runAsGroup: 1001
233-
runAsNonRoot: true
234-
privileged: false
235-
readOnlyRootFilesystem: true
236-
allowPrivilegeEscalation: false
237-
capabilities:
238-
drop: ["ALL"]
239-
seccompProfile:
240-
type: RuntimeDefault
241-
{{- if .Values.global.compatibility.appArmor.enabled }}
242-
appArmorProfile:
243-
type: RuntimeDefault
244-
{{- end }}
245-
windowsOptions:
246-
hostProcess: false
214+
{{- if .Values.containerSecurityContext.enabled }}
215+
securityContext: {{- include "renderSecurityContext" (dict "securityContext" .Values.containerSecurityContext "context" .) | nindent 12 }}
216+
{{- end }}

0 commit comments

Comments
 (0)