Skip to content

Commit

Permalink
Expose metrics service in Kubernetes
Browse files Browse the repository at this point in the history
Issue: COSI-46
  • Loading branch information
anurag4DSB committed Dec 19, 2024
1 parent 6701bdc commit 8f4f38a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
app.kubernetes.io/component: driver
app.kubernetes.io/version: main
app.kubernetes.io/managed-by: kustomize
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
prometheus.io/path: "/metrics"
spec:
serviceAccountName: scality-object-storage-provisioner
containers:
Expand All @@ -24,6 +28,7 @@ spec:
args:
- "--driver-prefix=cosi"
- "--v=$(COSI_DRIVER_LOG_LEVEL)"
- "--metrics-address=0.0.0.0:8080"
volumeMounts:
- mountPath: /var/lib/cosi
name: socket
Expand Down
1 change: 1 addition & 0 deletions kustomize/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ resources:
- serviceaccount.yaml
- rbac.yaml
- deployment.yaml
- metrics-service.yaml
14 changes: 14 additions & 0 deletions kustomize/base/metrics-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: scality-cosi-metrics
labels:
app.kubernetes.io/name: scality-cosi-driver
app.kubernetes.io/part-of: container-object-storage-interface
spec:
selector:
app.kubernetes.io/name: scality-cosi-driver
ports:
- protocol: TCP
port: 8080 # The port Prometheus will scrape
targetPort: 8080 # The port exposed by the container
3 changes: 3 additions & 0 deletions kustomize/base/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ rules:
- apiGroups: [""]
resources: ["secrets", "events"]
verbs: ["get", "delete", "update", "create"]
- apiGroups: [""]
resources: ["services", "endpoints"]
verbs: ["get", "list", "watch"]

---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
1 change: 1 addition & 0 deletions kustomize/overlays/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ resources:
- ../../base/namespace.yaml
- ../../base/serviceaccount.yaml
- ../../base/rbac.yaml
- ../../metrics-service.yaml

commonLabels:
app.kubernetes.io/version: main
Expand Down

0 comments on commit 8f4f38a

Please sign in to comment.