-
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.
* fix: enable running otel and fluentd with the following security settings: readOnlyRootFilesystem, allowPrivilegeEscalation, seccompProfile, runAsNonRoot. * fix: add condition for adding fluentd-checkpoint-dir volume in post delete hook * fix: comment about issues with cri-o runtime * Update helm-charts/splunk-otel-collector/templates/configmap-fluentd.yaml Co-authored-by: harshit-splunk <[email protected]> * fix: run pre-commit * Address review comments * fix pre-commit * fix: change default user and group to 999 in patch-log-dirs init container Co-authored-by: harshit-splunk <[email protected]> Co-authored-by: harshit-splunk <[email protected]> Co-authored-by: Antoine Toulme <[email protected]>
- Loading branch information
1 parent
921de28
commit a9f24c0
Showing
13 changed files
with
335 additions
and
39 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
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 d:m::rx,m::rx,d:g:{{ .Values.agent.securityContext.runAsGroup | default 999 }}:rx,g:{{ .Values.agent.securityContext.runAsGroup | default 999 }}:rx {{ .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 }} |
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
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
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
Oops, something went wrong.