clusterrole.yaml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. {{- if or (.Values.clusterRole.create) (.Values.presets.kubernetesAttributes.enabled) (.Values.presets.clusterMetrics.enabled) (.Values.presets.kubeletMetrics.enabled) (.Values.presets.kubernetesEvents.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. - apiGroups: ["apps"]
  23. resources: ["replicasets"]
  24. verbs: ["get", "list", "watch"]
  25. - apiGroups: ["extensions"]
  26. resources: ["replicasets"]
  27. verbs: ["get", "list", "watch"]
  28. {{- end }}
  29. {{- if .Values.presets.clusterMetrics.enabled}}
  30. - apiGroups: [""]
  31. resources: ["events", "namespaces", "namespaces/status", "nodes", "nodes/spec", "pods", "pods/status", "replicationcontrollers", "replicationcontrollers/status", "resourcequotas", "services" ]
  32. verbs: ["get", "list", "watch"]
  33. - apiGroups: ["apps"]
  34. resources: ["daemonsets", "deployments", "replicasets", "statefulsets"]
  35. verbs: ["get", "list", "watch"]
  36. - apiGroups: ["extensions"]
  37. resources: ["daemonsets", "deployments", "replicasets"]
  38. verbs: ["get", "list", "watch"]
  39. - apiGroups: ["batch"]
  40. resources: ["jobs", "cronjobs"]
  41. verbs: ["get", "list", "watch"]
  42. - apiGroups: ["autoscaling"]
  43. resources: ["horizontalpodautoscalers"]
  44. verbs: ["get", "list", "watch"]
  45. {{- end}}
  46. {{- if .Values.presets.kubeletMetrics.enabled}}
  47. - apiGroups: [""]
  48. resources: ["nodes/stats"]
  49. verbs: ["get", "watch", "list"]
  50. {{- end }}
  51. {{- if .Values.presets.kubernetesEvents.enabled }}
  52. - apiGroups: ["events.k8s.io"]
  53. resources: ["events"]
  54. verbs: ["watch", "list"]
  55. {{- end }}
  56. {{- end }}