-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[kibana] Add pod security policy to template #641
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {{- if .Values.managedServiceAccount }} | ||
| apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
| kind: ClusterRole | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need |
||
| metadata: | ||
| name: {{ template "kibana.serviceAccount" . }}-cluster-role | ||
| labels: | ||
| app: "{{ template "kibana.fullname" . }}" | ||
| chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
| heritage: {{ .Release.Service | quote }} | ||
| release: {{ .Release.Name | quote }} | ||
| rules: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a specific rule for |
||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - namespaces | ||
| - pods | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
| {{- end -}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| {{- if .Values.managedServiceAccount }} | ||
| apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: {{ template "kibana.serviceAccount" . }}-cluster-role-binding | ||
| labels: | ||
| app: "{{ template "kibana.fullname" . }}" | ||
| chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
| heritage: {{ .Release.Service | quote }} | ||
| release: {{ .Release.Name | quote }} | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: {{ template "kibana.serviceAccount" . }}-cluster-role | ||
| apiGroup: rbac.authorization.k8s.io | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ template "kibana.serviceAccount" . }} | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- end -}} |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,8 +33,8 @@ spec: | |||||||||||||
| {{- end }} | ||||||||||||||
| securityContext: | ||||||||||||||
| {{ toYaml .Values.podSecurityContext | indent 8 }} | ||||||||||||||
| {{- if .Values.serviceAccount }} | ||||||||||||||
| serviceAccount: {{ .Values.serviceAccount }} | ||||||||||||||
| {{- if .Values.rbac.serviceAccountName }} | ||||||||||||||
| serviceAccount: {{ .Values.rbac.serviceAccountName }} | ||||||||||||||
|
Comment on lines
+36
to
+37
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a default
Suggested change
|
||||||||||||||
| {{- end }} | ||||||||||||||
| volumes: | ||||||||||||||
| {{- range .Values.secretMounts }} | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| {{- if .Values.podSecurityPolicy.create -}} | ||
| {{- $fullName := include "kibana.fullname" . -}} | ||
| apiVersion: policy/v1beta1 | ||
| kind: PodSecurityPolicy | ||
| metadata: | ||
| name: {{ default $fullName .Values.podSecurityPolicy.name | quote }} | ||
| labels: | ||
| heritage: {{ .Release.Service | quote }} | ||
| release: {{ .Release.Name | quote }} | ||
| chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
| app: {{ $fullName | quote }} | ||
| spec: | ||
| {{ toYaml .Values.podSecurityPolicy.spec | indent 2 }} | ||
| {{- end -}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| {{- if .Values.managedServiceAccount }} | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: {{ template "kibana.serviceAccount" . }} | ||
| labels: | ||
| app: "{{ template "kibana.fullname" . }}" | ||
| chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
| heritage: {{ .Release.Service | quote }} | ||
| release: {{ .Release.Name | quote }} | ||
| {{- end -}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,7 +72,32 @@ securityContext: | |
| runAsNonRoot: true | ||
| runAsUser: 1000 | ||
|
|
||
| serviceAccount: "" | ||
| # Whether this chart should self-manage its service account, role, and associated role binding. | ||
| managedServiceAccount: true | ||
|
|
||
| rbac: | ||
| create: false | ||
| serviceAccountName: "" | ||
|
|
||
| podSecurityPolicy: | ||
| create: false | ||
| name: "" | ||
| spec: | ||
| privileged: true | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| fsGroup: | ||
| rule: RunAsAny | ||
| runAsUser: | ||
| rule: RunAsAny | ||
| seLinux: | ||
| rule: RunAsAny | ||
| supplementalGroups: | ||
| rule: RunAsAny | ||
| volumes: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add |
||
| - secret | ||
| - configMap | ||
| - persistentVolumeClaim | ||
| - projected | ||
| - emptyDir | ||
|
|
||
| # This is the PriorityClass settings as defined in | ||
| # https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you checking
podSecurityPolicy.namevalue if you're not usingkibana.serviceAccountinkibana/templates/podsecuritypolicy.yaml?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer removing
kibana.serviceAccounttemplate and keepingClusterRole,ClusterRoleBindingandServiceAccountname consistent with what we have in most other charts (you can checkLogstashchart for that).