From 042af3d17201ab7a770b3f85bd57bfd18522c6fa Mon Sep 17 00:00:00 2001 From: Nick Andreano Date: Mon, 17 Nov 2025 00:02:20 -0500 Subject: [PATCH] Added flag to enable processexporter metrics ingress --- charts/iap/Chart.yaml | 2 +- charts/iap/templates/ingress.yaml | 2 +- charts/iap/tests/ingress_test.yaml | 107 ++++++++++++++++++++++++++++- charts/iap/values.yaml | 2 + 4 files changed, 110 insertions(+), 3 deletions(-) diff --git a/charts/iap/Chart.yaml b/charts/iap/Chart.yaml index 685754b..21fbf94 100644 --- a/charts/iap/Chart.yaml +++ b/charts/iap/Chart.yaml @@ -10,7 +10,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.6.0 +version: 1.7.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/iap/templates/ingress.yaml b/charts/iap/templates/ingress.yaml index 38d7e1e..470b410 100644 --- a/charts/iap/templates/ingress.yaml +++ b/charts/iap/templates/ingress.yaml @@ -63,7 +63,7 @@ spec: number: {{ $.Values.service.port }} path: {{ $.Values.ingress.directAccess.path | default "/" }} pathType: {{ $.Values.ingress.pathType | default "Prefix" }} - {{- if and $.Values.processExporter $.Values.processExporter.enabled }} + {{- if and $.Values.processExporter $.Values.processExporter.enabled $.Values.processExporter.ingressEnabled }} - backend: service: name: {{ $.Values.service.name }}-headless-{{ $i }} diff --git a/charts/iap/tests/ingress_test.yaml b/charts/iap/tests/ingress_test.yaml index d6210fb..df3cdfc 100644 --- a/charts/iap/tests/ingress_test.yaml +++ b/charts/iap/tests/ingress_test.yaml @@ -1125,7 +1125,7 @@ tests: path: spec.rules[1].host value: iap-prod-1.example.com - - it: should work with process exporter and hostOverride + - it: should work with process exporter enabled and ingressEnabled true set: ingress: enabled: true @@ -1137,6 +1137,7 @@ tests: hostOverride: "metrics" processExporter: enabled: true + ingressEnabled: true service: port: 443 replicaCount: 1 @@ -1155,6 +1156,110 @@ tests: path: spec.rules[0].http.paths[1].path value: /metrics + - it: should not include metrics path when processExporter enabled but ingressEnabled false + set: + ingress: + enabled: true + loadBalancer: + enabled: false + directAccess: + enabled: true + baseDomain: example.com + processExporter: + enabled: true + ingressEnabled: false + service: + port: 443 + replicaCount: 1 + asserts: + - lengthEqual: + path: spec.rules + count: 1 + # Should only have main path, no metrics path + - lengthEqual: + path: spec.rules[0].http.paths + count: 1 + - equal: + path: spec.rules[0].http.paths[0].path + value: / + + - it: should not include metrics path when processExporter disabled + set: + ingress: + enabled: true + loadBalancer: + enabled: false + directAccess: + enabled: true + baseDomain: example.com + processExporter: + enabled: false + ingressEnabled: true + service: + port: 443 + replicaCount: 1 + asserts: + - lengthEqual: + path: spec.rules + count: 1 + # Should only have main path, no metrics path + - lengthEqual: + path: spec.rules[0].http.paths + count: 1 + - equal: + path: spec.rules[0].http.paths[0].path + value: / + + - it: should include metrics path for all replicas when processExporter enabled and ingressEnabled true + set: + ingress: + enabled: true + loadBalancer: + enabled: false + directAccess: + enabled: true + baseDomain: example.com + processExporter: + enabled: true + ingressEnabled: true + service: + port: 443 + replicaCount: 3 + asserts: + - lengthEqual: + path: spec.rules + count: 3 + # Each rule should have both main path and metrics path + - lengthEqual: + path: spec.rules[0].http.paths + count: 2 + - lengthEqual: + path: spec.rules[1].http.paths + count: 2 + - lengthEqual: + path: spec.rules[2].http.paths + count: 2 + # Verify metrics paths + - equal: + path: spec.rules[0].http.paths[1].path + value: /metrics + - equal: + path: spec.rules[1].http.paths[1].path + value: /metrics + - equal: + path: spec.rules[2].http.paths[1].path + value: /metrics + # Verify metrics backend service port names + - equal: + path: spec.rules[0].http.paths[1].backend.service.port.name + value: process-metrics + - equal: + path: spec.rules[1].http.paths[1].backend.service.port.name + value: process-metrics + - equal: + path: spec.rules[2].http.paths[1].backend.service.port.name + value: process-metrics + - it: should preserve service references with hostOverride set: ingress: diff --git a/charts/iap/values.yaml b/charts/iap/values.yaml index 96ad111..90ddb50 100644 --- a/charts/iap/values.yaml +++ b/charts/iap/values.yaml @@ -306,6 +306,8 @@ affinity: {} processExporter: # -- Enable process exporter sidecar container enabled: false + # -- Enable ingress configuration for process exporter metrics + ingressEnabled: false image: # -- Process exporter image repository repository: ncabatoff/process-exporter