2023-04-12 11:14:31 +00:00
|
|
|
{{- if and .Values.podSecurityPolicy.create (semverCompare "<=1.25-0" .Capabilities.KubeVersion.GitVersion) -}}
|
2020-12-08 15:05:25 +00:00
|
|
|
apiVersion: policy/v1beta1
|
|
|
|
kind: PodSecurityPolicy
|
|
|
|
metadata:
|
|
|
|
name: {{ include "fluent-bit.fullname" . }}
|
2021-04-07 10:00:53 +00:00
|
|
|
{{- if .Values.podSecurityPolicy.annotations }}
|
|
|
|
annotations:
|
|
|
|
{{- toYaml .Values.podSecurityPolicy.annotations | nindent 4 }}
|
|
|
|
{{- end }}
|
2020-12-08 15:05:25 +00:00
|
|
|
spec:
|
|
|
|
privileged: false
|
|
|
|
# Required to prevent escalations to root.
|
|
|
|
allowPrivilegeEscalation: false
|
|
|
|
# This is redundant with non-root + disallow privilege escalation,
|
|
|
|
# but we can provide it for defense in depth.
|
|
|
|
requiredDropCapabilities:
|
|
|
|
- ALL
|
|
|
|
volumes:
|
|
|
|
- '*'
|
2021-08-27 10:14:46 +00:00
|
|
|
hostNetwork: {{ .Values.hostNetwork }}
|
2020-12-08 15:05:25 +00:00
|
|
|
hostIPC: false
|
|
|
|
hostPID: false
|
|
|
|
runAsUser:
|
|
|
|
# TODO: Require the container to run without root privileges.
|
|
|
|
rule: 'RunAsAny'
|
|
|
|
seLinux:
|
|
|
|
# This policy assumes the nodes are using AppArmor rather than SELinux.
|
|
|
|
rule: 'RunAsAny'
|
|
|
|
supplementalGroups:
|
|
|
|
rule: 'MustRunAs'
|
|
|
|
ranges:
|
|
|
|
# Forbid adding the root group.
|
|
|
|
- min: 1
|
|
|
|
max: 65535
|
|
|
|
fsGroup:
|
|
|
|
rule: 'MustRunAs'
|
|
|
|
ranges:
|
|
|
|
# Forbid adding the root group.
|
|
|
|
- min: 1
|
|
|
|
max: 65535
|
|
|
|
readOnlyRootFilesystem: false
|
|
|
|
{{- end }}
|