controller-role.yaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. {{- if .Values.rbac.create -}}
  2. apiVersion: rbac.authorization.k8s.io/v1
  3. kind: Role
  4. metadata:
  5. labels:
  6. {{- include "ingress-nginx.labels" . | nindent 4 }}
  7. app.kubernetes.io/component: controller
  8. {{- with .Values.controller.labels }}
  9. {{- toYaml . | nindent 4 }}
  10. {{- end }}
  11. name: {{ include "ingress-nginx.fullname" . }}
  12. namespace: {{ .Release.Namespace }}
  13. rules:
  14. - apiGroups:
  15. - ""
  16. resources:
  17. - namespaces
  18. verbs:
  19. - get
  20. - apiGroups:
  21. - ""
  22. resources:
  23. - configmaps
  24. - pods
  25. - secrets
  26. - endpoints
  27. verbs:
  28. - get
  29. - list
  30. - watch
  31. - apiGroups:
  32. - ""
  33. resources:
  34. - services
  35. verbs:
  36. - get
  37. - list
  38. - watch
  39. - apiGroups:
  40. - networking.k8s.io
  41. resources:
  42. - ingresses
  43. verbs:
  44. - get
  45. - list
  46. - watch
  47. - apiGroups:
  48. - networking.k8s.io
  49. resources:
  50. - ingresses/status
  51. verbs:
  52. - update
  53. - apiGroups:
  54. - networking.k8s.io
  55. resources:
  56. - ingressclasses
  57. verbs:
  58. - get
  59. - list
  60. - watch
  61. # TODO(Jintao Zhang)
  62. # Once we release a new version of the controller,
  63. # we will be able to remove the configmap related permissions
  64. # We have used the Lease API for selection
  65. # ref: https://github.com/kubernetes/ingress-nginx/pull/8921
  66. - apiGroups:
  67. - ""
  68. resources:
  69. - configmaps
  70. resourceNames:
  71. - {{ include "ingress-nginx.controller.electionID" . }}
  72. verbs:
  73. - get
  74. - update
  75. - apiGroups:
  76. - ""
  77. resources:
  78. - configmaps
  79. verbs:
  80. - create
  81. - apiGroups:
  82. - coordination.k8s.io
  83. resources:
  84. - leases
  85. resourceNames:
  86. - {{ include "ingress-nginx.controller.electionID" . }}
  87. verbs:
  88. - get
  89. - update
  90. - apiGroups:
  91. - coordination.k8s.io
  92. resources:
  93. - leases
  94. verbs:
  95. - create
  96. - apiGroups:
  97. - ""
  98. resources:
  99. - events
  100. verbs:
  101. - create
  102. - patch
  103. - apiGroups:
  104. - discovery.k8s.io
  105. resources:
  106. - endpointslices
  107. verbs:
  108. - list
  109. - watch
  110. - get
  111. {{- if .Values.podSecurityPolicy.enabled }}
  112. - apiGroups: [{{ template "podSecurityPolicy.apiGroup" . }}]
  113. resources: ['podsecuritypolicies']
  114. verbs: ['use']
  115. {{- with .Values.controller.existingPsp }}
  116. resourceNames: [{{ . }}]
  117. {{- else }}
  118. resourceNames: [{{ include "ingress-nginx.fullname" . }}]
  119. {{- end }}
  120. {{- end }}
  121. {{- end }}