| Giorgi Lekveishvili | ec6b3cc | 2023-12-01 16:30:04 +0400 | [diff] [blame] | 1 | {{- if and .Values.autoscaler.enabled .Values.rbac.create }} |
| 2 | --- |
| 3 | apiVersion: rbac.authorization.k8s.io/v1 |
| 4 | kind: ClusterRole |
| 5 | metadata: |
| 6 | name: {{ template "coredns.fullname" . }}-autoscaler |
| 7 | labels: {{- include "coredns.labels.autoscaler" . | nindent 4 }} |
| 8 | {{- if .Values.customLabels }} |
| 9 | {{ toYaml .Values.customLabels | indent 4 }} |
| 10 | {{- end }} |
| 11 | {{- with .Values.customAnnotations }} |
| 12 | annotations: |
| 13 | {{- toYaml . | nindent 4 }} |
| 14 | {{- end }} |
| 15 | rules: |
| 16 | - apiGroups: [""] |
| 17 | resources: ["nodes"] |
| 18 | verbs: ["list","watch"] |
| 19 | - apiGroups: [""] |
| 20 | resources: ["replicationcontrollers/scale"] |
| 21 | verbs: ["get", "update"] |
| 22 | - apiGroups: ["extensions", "apps"] |
| 23 | resources: ["deployments/scale", "replicasets/scale"] |
| 24 | verbs: ["get", "update"] |
| 25 | # Remove the configmaps rule once below issue is fixed: |
| 26 | # kubernetes-incubator/cluster-proportional-autoscaler#16 |
| 27 | - apiGroups: [""] |
| 28 | resources: ["configmaps"] |
| 29 | verbs: ["get", "create"] |
| 30 | {{- end }} |