Skip to content

Commit

Permalink
feat:separate exporter's securityContext
Browse files Browse the repository at this point in the history
  • Loading branch information
lancelot1989 committed Jan 15, 2025
1 parent 428c7bd commit a6011df
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions addons/kafka/templates/cmpd-broker-27.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ spec:
- name: jmx-exporter
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.jmxExporter.repository }}:{{ .Values.images.jmxExporter.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
{{- if .Values.container.securityContext }}
{{- if .Values.exporter.securityContext }}
securityContext:
{{- toYaml .Values.container.securityContext | nindent 10 }}
{{- toYaml .Values.exporter.securityContext | nindent 10 }}
{{- end }}
command:
- java
Expand Down
4 changes: 2 additions & 2 deletions addons/kafka/templates/cmpd-broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ spec:
- name: jmx-exporter
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.jmxExporter.repository }}:{{ .Values.images.jmxExporter.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
{{- if .Values.container.securityContext }}
{{- if .Values.exporter.securityContext }}
securityContext:
{{- toYaml .Values.container.securityContext | nindent 10 }}
{{- toYaml .Values.exporter.securityContext | nindent 10 }}
{{- end }}
command:
- java
Expand Down
4 changes: 2 additions & 2 deletions addons/kafka/templates/cmpd-combine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ spec:
- name: jmx-exporter
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.jmxExporter.repository }}:{{ .Values.images.jmxExporter.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
{{- if .Values.container.securityContext }}
{{- if .Values.exporter.securityContext }}
securityContext:
{{- toYaml .Values.container.securityContext | nindent 10 }}
{{- toYaml .Values.exporter.securityContext | nindent 10 }}
{{- end }}
command:
- java
Expand Down
4 changes: 2 additions & 2 deletions addons/kafka/templates/cmpd-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ spec:
- name: jmx-exporter
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.jmxExporter.repository }}:{{ .Values.images.jmxExporter.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
{{- if .Values.container.securityContext }}
{{- if .Values.exporter.securityContext }}
securityContext:
{{- toYaml .Values.container.securityContext | nindent 10 }}
{{- toYaml .Values.exporter.securityContext | nindent 10 }}
{{- end }}
command:
- java
Expand Down
8 changes: 4 additions & 4 deletions addons/kafka/templates/cmpd-exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ spec:
- name: kafka-exporter
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.kafkaExporter.repository }}:{{ .Values.images.kafkaExporter.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
{{- if .Values.container.securityContext }}
securityContext:
{{- toYaml .Values.container.securityContext | nindent 10 }}
{{- end }}
{{- if .Values.exporter.securityContext }}
securityContext:
{{- toYaml .Values.exporter.securityContext | nindent 8 }}
{{- end }}
env:
- name: SERVICE_PORT
value: "9308"
Expand Down
6 changes: 6 additions & 0 deletions addons/kafka/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,11 @@ securityContext:
container:
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1001

## exporter security context settings
exporter:
securityContext:
runAsNonRoot: true
runAsUser: 1001

0 comments on commit a6011df

Please sign in to comment.