Skip to content

Commit

Permalink
helm: add podsecuritypolicy for fluent-bit (#1506)
Browse files Browse the repository at this point in the history
  • Loading branch information
terjesannum authored and cyriltovena committed Jan 15, 2020
1 parent 1761db6 commit 9773b11
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion production/helm/fluent-bit/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: "v1"
name: fluent-bit
version: 0.0.3
version: 0.0.4
appVersion: v0.0.1
kubeVersion: "^1.10.0-0"
description: "Uses fluent-bit Loki go plugin for gathering logs and sending them to Loki"
Expand Down
33 changes: 33 additions & 0 deletions production/helm/fluent-bit/templates/podsecuritypolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- if .Values.rbac.pspEnabled }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ template "fluent-bit-loki.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "fluent-bit-loki.name" . }}
chart: {{ template "fluent-bit-loki.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
privileged: false
allowPrivilegeEscalation: false
volumes:
- 'secret'
- 'configMap'
- 'hostPath'
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
rule: 'RunAsAny'
seLinux:
rule: 'RunAsAny'
supplementalGroups:
rule: 'RunAsAny'
fsGroup:
rule: 'RunAsAny'
readOnlyRootFilesystem: true
requiredDropCapabilities:
- ALL
{{- end }}
19 changes: 19 additions & 0 deletions production/helm/fluent-bit/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ template "fluent-bit-loki.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "fluent-bit-loki.name" . }}
chart: {{ template "fluent-bit-loki.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .Values.rbac.pspEnabled }}
rules:
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames: [{{ template "fluent-bit-loki.fullname" . }}]
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions production/helm/fluent-bit/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ template "fluent-bit-loki.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "fluent-bit-loki.name" . }}
chart: {{ template "fluent-bit-loki.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "fluent-bit-loki.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "fluent-bit-loki.serviceAccountName" . }}
{{- end }}
2 changes: 1 addition & 1 deletion production/helm/loki-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: "v1"
name: loki-stack
version: 0.24.0
version: 0.25.0
appVersion: v1.2.0
kubeVersion: "^1.10.0-0"
description: "Loki: like Prometheus, but for logs."
Expand Down

0 comments on commit 9773b11

Please sign in to comment.