apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: nginx-controller-role
rules:
    - apiGroups:
        - ""
      resources:
        - namespaces
      verbs:
        - get
    - apiGroups:
        - ""
      resources:
        - configmaps
        - pods
        - secrets
        - endpoints
      verbs:
        - get
        - list
        - watch
    - apiGroups:
        - ""
      resources:
        - services
      verbs:
        - get
        - list
        - update
        - watch
    - apiGroups:
        - extensions
        - "networking.k8s.io" # k8s 1.14+
      resources:
        - ingresses
      verbs:
        - get
        - list
        - watch
    - apiGroups:
        - extensions
        - "networking.k8s.io" # k8s 1.14+
      resources:
        - ingresses/status
      verbs:
        - update
    - apiGroups:
        - ""
      resources:
        - configmaps
      resourceNames:
        - "nginx-template"
      verbs:
        - get
        - update
    - apiGroups:
        - ""
      resources:
        - configmaps
      verbs:
        - create
        - update
    - apiGroups:
        - ""
      resources:
        - endpoints
      verbs:
        - create
        - get
        - update
    - apiGroups:
        - ""
      resources:
        - events
      verbs:
        - create
        - patch