{{- if .Values.rbac.create -}} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: labels: {{- include "ingress-nginx.labels" . | nindent 4 }} app.kubernetes.io/component: controller {{- with .Values.controller.labels }} {{- toYaml . | nindent 4 }} {{- end }} name: {{ include "ingress-nginx.fullname" . }} namespace: {{ .Release.Namespace }} rules: - apiGroups: - "" resources: - namespaces verbs: - get - apiGroups: - "" resources: - configmaps - pods - secrets - endpoints verbs: - get - list - watch - apiGroups: - "" resources: - services verbs: - get - list - watch - apiGroups: - networking.k8s.io resources: - ingresses verbs: - get - list - watch - apiGroups: - networking.k8s.io resources: - ingresses/status verbs: - update - apiGroups: - networking.k8s.io resources: - ingressclasses verbs: - get - list - watch # TODO(Jintao Zhang) # Once we release a new version of the controller, # we will be able to remove the configmap related permissions # We have used the Lease API for selection # ref: https://github.com/kubernetes/ingress-nginx/pull/8921 - apiGroups: - "" resources: - configmaps resourceNames: - {{ include "ingress-nginx.controller.electionID" . }} verbs: - get - update - apiGroups: - "" resources: - configmaps verbs: - create - apiGroups: - coordination.k8s.io resources: - leases resourceNames: - {{ include "ingress-nginx.controller.electionID" . }} verbs: - get - update - apiGroups: - coordination.k8s.io resources: - leases verbs: - create - apiGroups: - "" resources: - events verbs: - create - patch - apiGroups: - discovery.k8s.io resources: - endpointslices verbs: - list - watch - get {{- if .Values.podSecurityPolicy.enabled }} - apiGroups: [{{ template "podSecurityPolicy.apiGroup" . }}] resources: ['podsecuritypolicies'] verbs: ['use'] {{- with .Values.controller.existingPsp }} resourceNames: [{{ . }}] {{- else }} resourceNames: [{{ include "ingress-nginx.fullname" . }}] {{- end }} {{- end }} {{- end }}