J release changes
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / kong / templates / psp.yaml
1 {{- if and (.Values.podSecurityPolicy.enabled) }}
2 apiVersion: {{ include "kong.policyVersion" . }}
3 kind: PodSecurityPolicy
4 metadata:
5   name: {{ template "kong.serviceAccountName" . }}-psp
6   labels:
7     {{- include "kong.metaLabels" . | nindent 4 }}
8   {{- with .Values.podSecurityPolicy.labels }}
9   {{- range $key, $value := . }}
10     {{ $key }}: {{ $value }}
11   {{- end }}
12   {{- end }}
13   {{- with .Values.podSecurityPolicy.annotations }}
14   annotations:
15   {{- range $key, $value := . }}
16     {{ $key }}: {{ $value | quote }}
17   {{- end }}
18   {{- end }}
19 spec:
20 {{ .Values.podSecurityPolicy.spec | toYaml | indent 2 }}
21 ---
22 apiVersion: rbac.authorization.k8s.io/v1
23 kind: ClusterRole
24 metadata:
25   name: {{ template "kong.serviceAccountName" . }}-psp
26   labels:
27     {{- include "kong.metaLabels" . | nindent 4 }}
28 rules:
29   - apiGroups:
30       - policy
31     resources:
32       - podsecuritypolicies
33     verbs:
34       - use
35     resourceNames:
36       - {{ template "kong.serviceAccountName" . }}-psp
37 ---
38 apiVersion: rbac.authorization.k8s.io/v1
39 kind: ClusterRoleBinding
40 metadata:
41   name: {{ template "kong.serviceAccountName" . }}-psp
42   namespace: {{ template "kong.namespace" . }}
43   labels:
44     {{- include "kong.metaLabels" . | nindent 4 }}
45 subjects:
46   - kind: ServiceAccount
47     name: {{ template "kong.serviceAccountName" . }}
48     namespace: {{ template "kong.namespace" . }}
49 roleRef:
50   kind: ClusterRole
51   name: {{ template "kong.serviceAccountName" . }}-psp
52   apiGroup: rbac.authorization.k8s.io
53 {{- end }}