-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- while creating ACLs in the initContainer in the daemonset, change the default user and group of the otel image to 999 (this is because splunk-otel-collector has uid of 999) - add post delete hook which deletes ACLs set for directories used by agent, gateway and clusterReceiver while those pods run as non-root users --------- Co-authored-by: omrozowicz-splunk <[email protected]>
- Loading branch information
1 parent
d1d49e6
commit 45222e0
Showing
2 changed files
with
93 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
helm-charts/splunk-otel-collector/templates/revert-patch-log-dirs-hook.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{{- if or (and (.Values.fluentd.securityContext.runAsUser) (.Values.fluentd.securityContext.runAsGroup)) (and (.Values.agent.securityContext.runAsUser) (.Values.agent.securityContext.runAsGroup)) }} | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: {{ template "splunk-otel-collector.fullname" . }}-revert-patch-log-dir | ||
labels: | ||
{{- include "splunk-otel-collector.commonLabels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": post-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: revert-patch-log-dirs | ||
image: {{ template "splunk-otel-collector.image.initPatchLogDirs" . }} | ||
imagePullPolicy: {{ .Values.image.initPatchLogDirs.pullPolicy }} | ||
securityContext: | ||
runAsUser: 0 | ||
command: ['sh', '-c', ' | ||
setfacl --recursive --remove-all {{ .Values.logsCollection.checkpointPath }}; | ||
{{- if ne .Values.fluentd.config.posFilePrefix "/var/log/splunk-fluentd" }} | ||
setfacl --recursive --remove-all {{ dir .Values.fluentd.config.posFilePrefix }}; | ||
{{- end }} | ||
{{ if .Values.logsCollection.containers.enabled -}} | ||
if [ -d "/var/lib/docker/containers" ]; | ||
then | ||
setfacl --recursive --remove-all /var/lib/docker/containers; | ||
fi; | ||
if [ -d "/var/log/crio/pods" ]; | ||
then | ||
setfacl --recursive --remove-all /var/log/crio/pods; | ||
fi; | ||
if [ -d "/var/log/pods" ]; | ||
then | ||
setfacl --recursive --remove-all /var/log/pods; | ||
fi; | ||
{{- end }} | ||
{{- if .Values.logsCollection.journald.enabled }} | ||
if [ -d "{{ .Values.logsCollection.journald.directory }}" ]; | ||
then | ||
setfacl --recursive --remove-all {{ .Values.logsCollection.journald.directory }}; | ||
fi; | ||
{{- end }}'] | ||
volumeMounts: | ||
- name: checkpoint | ||
mountPath: {{ .Values.logsCollection.checkpointPath }} | ||
{{- if ne .Values.fluentd.config.posFilePrefix "/var/log/splunk-fluentd" }} | ||
- name: fluentd-checkpoint-dir | ||
mountPath: {{ dir .Values.fluentd.config.posFilePrefix }} | ||
{{- end }} | ||
{{- if .Values.logsCollection.containers.enabled }} | ||
- name: varlog | ||
mountPath: /var/log | ||
- name: varlibdockercontainers | ||
mountPath: /var/lib/docker/containers | ||
{{- end }} | ||
{{- if .Values.logsCollection.journald.enabled }} | ||
- name: journaldlogs | ||
mountPath: {{.Values.logsCollection.journald.directory}} | ||
{{- end }} | ||
volumes: | ||
- name: checkpoint | ||
hostPath: | ||
path: {{ .Values.logsCollection.checkpointPath }} | ||
- name: varlog | ||
hostPath: | ||
path: /var/log | ||
- name: varlibdockercontainers | ||
hostPath: | ||
path: /var/lib/docker/containers | ||
{{- if ne .Values.fluentd.config.posFilePrefix "/var/log/splunk-fluentd" }} | ||
- name: fluentd-checkpoint-dir | ||
hostPath: | ||
path: {{ dir .Values.fluentd.config.posFilePrefix }} | ||
type: DirectoryOrCreate | ||
{{- end }} | ||
{{- if .Values.logsCollection.journald.enabled }} | ||
- name: journaldlogs | ||
hostPath: | ||
path: {{.Values.logsCollection.journald.directory}} | ||
{{- end}} | ||
{{- end }} |