diff --git a/charts/operator/templates/deployment.yaml b/charts/operator/templates/deployment.yaml index 74dc07d..2aa4769 100644 --- a/charts/operator/templates/deployment.yaml +++ b/charts/operator/templates/deployment.yaml @@ -13,6 +13,11 @@ spec: labels: {{- include "operator.selectorLabels" . | nindent 8 }} annotations: kubectl.kubernetes.io/default-container: manager + {{- if and .Values.metrics.enabled .Values.metrics.podScrapeAnnotations }} + prometheus.io/scrape: "true" + prometheus.io/port: {{ .Values.metrics.port | quote }} + prometheus.io/path: "/metrics" + {{- end }} spec: serviceAccountName: {{ include "operator.serviceAccountName" . }} priorityClassName: {{ .Values.priorityClassName }} diff --git a/charts/operator/values.yaml b/charts/operator/values.yaml index 48403ca..8cf0753 100644 --- a/charts/operator/values.yaml +++ b/charts/operator/values.yaml @@ -103,6 +103,14 @@ metrics: type: ClusterIP serviceMonitor: enabled: true + # Pod-level prometheus.io scrape annotations. The EKS clusters scrape with the + # Grafana Agent (→ Amazon Managed Prometheus) by pod annotation, with no + # prometheus-operator — so the ServiceMonitor above is consumed only on + # kube-prometheus-stack clusters (kx). These annotations make the operator's + # controller-runtime reconcile metrics reach AMP in prod. The operator + # NetworkPolicy already allows scrape from the monitoring namespace (where the + # Grafana Agent runs). + podScrapeAnnotations: true resources: requests: