From 137cdb3b015fcffe07161374415dbfd67c1fab73 Mon Sep 17 00:00:00 2001 From: agent-company Date: Sat, 30 May 2026 05:05:32 +0000 Subject: [PATCH] [Phase 4] flux: add Prometheus ServiceMonitor manifests for all three API services Add flux/{zip-enrichment,holidays,air-quality}/servicemonitor.yaml so Prometheus (kube-prometheus-stack) can auto-discover and scrape each API service once deployed. Each ServiceMonitor: - Selects pods via app.kubernetes.io/name label - Scrapes /metrics on the http port every 30s - Uses release: kube-prometheus-stack label to match Prometheus selector - Lives in the same namespace as the API service Add each servicemonitor.yaml to its kustomization.yaml resources list. kustomize build flux/ passes with no errors. Closes leeworks-agents/api-company#110 --- flux/air-quality/kustomization.yaml | 1 + flux/air-quality/servicemonitor.yaml | 15 +++++++++++++++ flux/holidays/kustomization.yaml | 1 + flux/holidays/servicemonitor.yaml | 15 +++++++++++++++ flux/zip-enrichment/kustomization.yaml | 1 + flux/zip-enrichment/servicemonitor.yaml | 15 +++++++++++++++ 6 files changed, 48 insertions(+) create mode 100644 flux/air-quality/servicemonitor.yaml create mode 100644 flux/holidays/servicemonitor.yaml create mode 100644 flux/zip-enrichment/servicemonitor.yaml diff --git a/flux/air-quality/kustomization.yaml b/flux/air-quality/kustomization.yaml index 7ca00db..4902d2d 100644 --- a/flux/air-quality/kustomization.yaml +++ b/flux/air-quality/kustomization.yaml @@ -4,3 +4,4 @@ resources: - namespace.yaml - externalsecret.yaml - helmrelease.yaml + - servicemonitor.yaml diff --git a/flux/air-quality/servicemonitor.yaml b/flux/air-quality/servicemonitor.yaml new file mode 100644 index 0000000..603a223 --- /dev/null +++ b/flux/air-quality/servicemonitor.yaml @@ -0,0 +1,15 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: air-quality + namespace: air-quality + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app.kubernetes.io/name: air-quality + endpoints: + - port: http + path: /metrics + interval: 30s diff --git a/flux/holidays/kustomization.yaml b/flux/holidays/kustomization.yaml index 7ca00db..4902d2d 100644 --- a/flux/holidays/kustomization.yaml +++ b/flux/holidays/kustomization.yaml @@ -4,3 +4,4 @@ resources: - namespace.yaml - externalsecret.yaml - helmrelease.yaml + - servicemonitor.yaml diff --git a/flux/holidays/servicemonitor.yaml b/flux/holidays/servicemonitor.yaml new file mode 100644 index 0000000..41a62dd --- /dev/null +++ b/flux/holidays/servicemonitor.yaml @@ -0,0 +1,15 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: holidays + namespace: holidays + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app.kubernetes.io/name: holidays + endpoints: + - port: http + path: /metrics + interval: 30s diff --git a/flux/zip-enrichment/kustomization.yaml b/flux/zip-enrichment/kustomization.yaml index 7ca00db..4902d2d 100644 --- a/flux/zip-enrichment/kustomization.yaml +++ b/flux/zip-enrichment/kustomization.yaml @@ -4,3 +4,4 @@ resources: - namespace.yaml - externalsecret.yaml - helmrelease.yaml + - servicemonitor.yaml diff --git a/flux/zip-enrichment/servicemonitor.yaml b/flux/zip-enrichment/servicemonitor.yaml new file mode 100644 index 0000000..cb9d10c --- /dev/null +++ b/flux/zip-enrichment/servicemonitor.yaml @@ -0,0 +1,15 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: zip-enrichment + namespace: zip-enrichment + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app.kubernetes.io/name: zip-enrichment + endpoints: + - port: http + path: /metrics + interval: 30s