Skip to content

Commit

Permalink
Change container and image name patching host logs directories (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax authored Sep 14, 2022
1 parent 35bd06c commit e1767ec
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added

- A way to provide a custom image for init container patching host log directories (#534, #535)

## [0.58.0] - 2022-08-24

### Changed
Expand Down
6 changes: 3 additions & 3 deletions helm-charts/splunk-otel-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ Create the opentelemetry collector image name.
{{- end -}}

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

{{/*
Expand Down
5 changes: 3 additions & 2 deletions helm-charts/splunk-otel-collector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ spec:
mountPath: /var/lib/docker/containers
{{- end }}
{{- if and $agent.securityContext.runAsUser $agent.securityContext.runAsGroup }}
- name: chown
image: {{ template "splunk-otel-collector.image.chown" . }}
- name: patch-log-dirs
image: {{ template "splunk-otel-collector.image.initPatchLogDirs" . }}
imagePullPolicy: {{ .Values.image.initPatchLogDirs.pullPolicy }}
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
2 changes: 1 addition & 1 deletion helm-charts/splunk-otel-collector/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@
}
}
},
"chown": {
"initPatchLogDirs": {
"type": "object",
"additionalProperties": false,
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ image:

# 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:
initPatchLogDirs:
# 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
Expand Down

0 comments on commit e1767ec

Please sign in to comment.