blob: f9ec709745bd86a52118fa773a0755c2461385b8 [file] [log] [blame]
Giorgi Lekveishvilicccf72f2023-05-19 16:13:22 +04001{{- if and .Values.controller.admissionWebhooks.enabled .Values.controller.admissionWebhooks.patch.enabled (not .Values.controller.admissionWebhooks.certManager.enabled) -}}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +04002apiVersion: rbac.authorization.k8s.io/v1
3kind: ClusterRole
4metadata:
5 name: {{ include "ingress-nginx.fullname" . }}-admission
6 annotations:
7 "helm.sh/hook": pre-install,pre-upgrade,post-install,post-upgrade
8 "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
9 labels:
10 {{- include "ingress-nginx.labels" . | nindent 4 }}
11 app.kubernetes.io/component: admission-webhook
Giorgi Lekveishvilicccf72f2023-05-19 16:13:22 +040012 {{- with .Values.controller.admissionWebhooks.patch.labels }}
13 {{- toYaml . | nindent 4 }}
14 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040015rules:
16 - apiGroups:
17 - admissionregistration.k8s.io
18 resources:
19 - validatingwebhookconfigurations
20 verbs:
21 - get
22 - update
23{{- if .Values.podSecurityPolicy.enabled }}
24 - apiGroups: ['extensions']
25 resources: ['podsecuritypolicies']
26 verbs: ['use']
27 resourceNames:
28 {{- with .Values.controller.admissionWebhooks.existingPsp }}
29 - {{ . }}
30 {{- else }}
31 - {{ include "ingress-nginx.fullname" . }}-admission
32 {{- end }}
33{{- end }}
34{{- end }}