Skip to content

Commit 0a4c174

Browse files
committed
chore: add metrics service to prometheus component
Include metrics_service.yaml in the prometheus kustomize Component so that deploying with the prometheus component provides both the ServiceMonitor and the matching Service for metrics scraping. Add app.kubernetes.io/name selector to Service and ServiceMonitor to uniquely target this operator's pods in shared namespaces.
1 parent a5f23f8 commit 0a4c174

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

config/default/metrics_service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ spec:
1515
targetPort: 8443
1616
selector:
1717
control-plane: controller-manager
18+
app.kubernetes.io/name: network-services-operator

config/prometheus/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1
22
kind: Component
33
resources:
44
- monitor.yaml
5+
- metrics_service.yaml
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
control-plane: controller-manager
6+
app.kubernetes.io/name: network-services-operator
7+
app.kubernetes.io/managed-by: kustomize
8+
name: controller-manager-metrics-service
9+
namespace: system
10+
spec:
11+
ports:
12+
- name: https
13+
port: 8443
14+
protocol: TCP
15+
targetPort: 8443
16+
selector:
17+
control-plane: controller-manager
18+
app.kubernetes.io/name: network-services-operator

config/prometheus/monitor.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ spec:
2828
selector:
2929
matchLabels:
3030
control-plane: controller-manager
31+
app.kubernetes.io/name: network-services-operator

0 commit comments

Comments
 (0)