Skip to content

Commit 5e03427

Browse files
committed
Add PodMonitor resource for Prometheus monitoring
Add opendatahub.io/monitoring: 'true' label for odh/rhoai overlays. Signed-off-by: Ali Maredia <amaredia@redhat.com>
1 parent 9b2bb8c commit 5e03427

File tree

5 files changed

+47
-1
lines changed

5 files changed

+47
-1
lines changed

config/overlays/odh/kustomization.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,22 @@ namespace: opendatahub
1313
# 2. Import base configuration
1414
resources:
1515
- ../../default # Inherits everything from config/default/
16+
- ../../prometheus
1617
- networkpolicy.yaml
1718

1819
# 3. Delete the Namespace resource (ODH operator manages it)
20+
# Add monitoring label to PodMonitor
1921
patches:
2022
- path: delete-namespace.yaml
23+
- patch: |-
24+
- op: add
25+
path: /metadata/labels/opendatahub.io~1monitoring
26+
value: "true"
27+
target:
28+
group: monitoring.coreos.com
29+
version: v1
30+
kind: PodMonitor
31+
name: spark-operator-metrics-monitor
2132
2233
# 4. Add ODH-specific labels
2334
labels:

config/overlays/rhoai/kustomization.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,22 @@ namespace: redhat-ods-applications
1313
# 2. Import base configuration
1414
resources:
1515
- ../../default # Inherits everything from config/default/
16+
- ../../prometheus
1617
- networkpolicy.yaml
1718

1819
# 3. Delete the Namespace resource (RHOAI operator manages it)
20+
# Add monitoring label to PodMonitor
1921
patches:
2022
- path: delete-namespace.yaml
23+
- patch: |-
24+
- op: add
25+
path: /metadata/labels/opendatahub.io~1monitoring
26+
value: "true"
27+
target:
28+
group: monitoring.coreos.com
29+
version: v1
30+
kind: PodMonitor
31+
name: spark-operator-metrics-monitor
2132
2233
# 4. Add RHOAI-specific labels
2334
labels:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- podmonitor.yaml

config/prometheus/podmonitor.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: PodMonitor
3+
metadata:
4+
name: spark-operator-metrics-monitor
5+
namespace: system
6+
spec:
7+
podMetricsEndpoints:
8+
- port: metrics
9+
path: /metrics
10+
scheme: http
11+
selector:
12+
matchLabels:
13+
app.kubernetes.io/name: spark-operator
14+
app.kubernetes.io/component: controller

examples/openshift/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ CONTEXT ?= $(REPO_ROOT)
1414
LOCALBIN := $(REPO_ROOT)/bin
1515
export PATH := $(LOCALBIN):$(PATH)
1616

17+
# CLI tool: prefer oc if available, fall back to kubectl
18+
CLI ?= $(shell command -v oc 2>/dev/null || command -v kubectl 2>/dev/null)
19+
1720
# Configuration
1821
KIND_CLUSTER_NAME ?= spark-operator
1922
CLEANUP ?= true
23+
PODMONITOR_CRD_URL ?= https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/podmonitors-crd.json
2024

2125
##@ General
2226

@@ -80,8 +84,9 @@ test-docling-spark: ## Run Docling Spark test on KIND or OpenShift.
8084
CLEANUP=$(CLEANUP) $(TESTS_DIR)/test-docling-spark.sh
8185

8286
.PHONY: e2e-kustomize-test
83-
e2e-kustomize-test: ## Run Go e2e tests using Kustomize manifests for operator installation.
87+
e2e-kustomize-test: kind-setup ## Run Go e2e tests using Kustomize manifests for operator installation.
8488
@echo "Running Go e2e tests with Kustomize installation..."
89+
$(CLI) apply -f $(PODMONITOR_CRD_URL)
8590
cd $(REPO_ROOT) && INSTALL_METHOD=kustomize go test ./examples/openshift/tests/e2e/ -v -ginkgo.v -timeout 30m
8691

8792
.PHONY: test-all

0 commit comments

Comments
 (0)