clusterrole.yaml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {{- if or (.Values.clusterRole.create) (.Values.presets.kubernetesAttributes.enabled) (.Values.presets.clusterMetrics.enabled) (.Values.presets.kubeletMetrics.enabled) -}}
  2. apiVersion: rbac.authorization.k8s.io/v1
  3. kind: ClusterRole
  4. metadata:
  5. name: {{ include "opentelemetry-collector.clusterRoleName" . }}
  6. labels:
  7. {{- include "opentelemetry-collector.labels" . | nindent 4 }}
  8. {{- if .Values.clusterRole.annotations }}
  9. annotations:
  10. {{- range $key, $value := .Values.clusterRole.annotations }}
  11. {{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
  12. {{- end }}
  13. {{- end }}
  14. rules:
  15. {{- if .Values.clusterRole.rules -}}
  16. {{ toYaml .Values.clusterRole.rules | nindent 2 -}}
  17. {{- end }}
  18. {{- if .Values.presets.kubernetesAttributes.enabled}}
  19. - apiGroups: [""]
  20. resources: ["pods", "namespaces"]
  21. verbs: ["get", "watch", "list"]
  22. {{- end }}
  23. {{- if .Values.presets.clusterMetrics.enabled}}
  24. - apiGroups: [""]
  25. resources: ["events", "namespaces", "namespaces/status", "nodes", "nodes/spec", "pods", "pods/status", "replicationcontrollers", "replicationcontrollers/status", "resourcequotas", "services" ]
  26. verbs: ["get", "list", "watch"]
  27. - apiGroups: ["apps"]
  28. resources: ["daemonsets", "deployments", "replicasets", "statefulsets"]
  29. verbs: ["get", "list", "watch"]
  30. - apiGroups: ["extensions"]
  31. resources: ["daemonsets", "deployments", "replicasets"]
  32. verbs: ["get", "list", "watch"]
  33. - apiGroups: ["batch"]
  34. resources: ["jobs", "cronjobs"]
  35. verbs: ["get", "list", "watch"]
  36. - apiGroups: ["autoscaling"]
  37. resources: ["horizontalpodautoscalers"]
  38. verbs: ["get", "list", "watch"]
  39. {{- end}}
  40. {{- if .Values.presets.kubeletMetrics.enabled}}
  41. - apiGroups: [""]
  42. resources: ["nodes/stats"]
  43. verbs: ["get", "watch", "list"]
  44. {{- end }}
  45. {{- end }}