Skip to content

Commit

Permalink
Add an option to change image for chown init container (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
pratik141 committed Sep 12, 2022
1 parent 0800270 commit 35bd06c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
7 changes: 7 additions & 0 deletions helm-charts/splunk-otel-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ Create the opentelemetry collector image name.
{{- printf "%s:%s" .Values.image.otelcol.repository (.Values.image.otelcol.tag | default .Chart.AppVersion) -}}
{{- end -}}

{{/*
Create the chown image name.
*/}}
{{- define "splunk-otel-collector.image.chown" -}}
{{- printf "%s:%s" .Values.image.chown.repository (.Values.image.chown.tag | default "latest") -}}
{{- end -}}

{{/*
Convert memory value from resources.limit to numeric value in MiB to be used by otel memory_limiter processor.
*/}}
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/splunk-otel-collector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ spec:
{{- end }}
{{- if and $agent.securityContext.runAsUser $agent.securityContext.runAsGroup }}
- name: chown
image: registry.access.redhat.com/ubi8/ubi
image: {{ template "splunk-otel-collector.image.chown" . }}
command: ['sh', '-c', '
mkdir -p {{ .Values.logsCollection.checkpointPath }};
chown -Rv {{ $agent.securityContext.runAsUser | default 20000 }}:{{ $agent.securityContext.runAsGroup | default 20000 }} {{ .Values.logsCollection.checkpointPath }};
Expand Down
20 changes: 20 additions & 0 deletions helm-charts/splunk-otel-collector/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,26 @@
]
}
}
},
"chown": {
"type": "object",
"additionalProperties": false,
"properties": {
"repository": {
"type": "string"
},
"tag": {
"type": "string"
},
"pullPolicy": {
"type": "string",
"enum": [
"IfNotPresent",
"Always",
"Never"
]
}
}
}
}
},
Expand Down
10 changes: 10 additions & 0 deletions helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,16 @@ image:
# The policy that specifies when the user wants the opentelemetry collector images to be pulled
pullPolicy: IfNotPresent

# Image to be used by init container that patches log directories on the host, so the collector can read from them as a non-root user.
# Effective only if `agent.securityContext.runAsUser` and `agent.securityContext.runAsGroup` are set to non-zero values.
chown:
# The registry and name of the Universal Base Image 9 image to pull
repository: registry.access.redhat.com/ubi9/ubi
# The tag of the Universal Base Image 9, default value is latest
tag: ""
# The policy that specifies when the user wants the Universal Base images to be pulled
pullPolicy: IfNotPresent


################################################################################
# Extra system configuration
Expand Down

0 comments on commit 35bd06c

Please sign in to comment.