Skip to content

Commit 7c9326d

Browse files
committed
MINOR: kubernetes-ingress: wire kube-prometheus-stack into CI for KEDA Prometheus trigger
The deployment-keda-values.yaml ci test configures a KEDA ScaledObject with a Prometheus trigger, but the CI environment did not provide a Prometheus instance, so the scaler could never resolve metrics and the ServiceMonitor/PodMonitor wiring was untested. Install kube-prometheus-stack via Helm in install_charts.sh (Grafana, Alertmanager, node-exporter and kube-state-metrics disabled to keep the Kind cluster light) and switch the KEDA install from a raw manifest apply to the kedacore/keda Helm chart for consistency. Update the keda ci values to enable PodMonitor and point the Prometheus trigger at the Service name produced by kube-prometheus-stack (prometheus-kube-prometheus-stack-prometheus.default.svc). ServiceMonitor/PodMonitor selectors are relaxed via {serviceMonitor,podMonitor}SelectorNilUsesHelmValues=false so the operator picks up monitors from any namespace, which is what the chart templates emit by default. Signed-off-by: Dinko Korunic <dkorunic@haproxy.com>
1 parent 4bf85c5 commit 7c9326d

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

.circleci/install_charts.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ readonly CT_VERSION=latest
88
readonly KIND_VERSION=v0.31.0
99
readonly CLUSTER_NAME=chart-testing
1010
readonly REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel)}"
11-
readonly KEDA_VERSION=2.19.0
1211

1312
find_latest_tag() {
1413
if ! git describe --tags --abbrev=0 2>/dev/null; then
@@ -60,8 +59,30 @@ install_local_path_provisioner() {
6059
docker_exec kubectl apply -f "https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml"
6160
}
6261

62+
install_prometheus() {
63+
docker_exec helm install prometheus prometheus-community/kube-prometheus-stack \
64+
--set grafana.enabled=false \
65+
--set alertmanager.enabled=false \
66+
--set nodeExporter.enabled=false \
67+
--set kubeStateMetrics.enabled=false \
68+
--set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false \
69+
--set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false \
70+
--set prometheus.prometheusSpec.retention=1h \
71+
--set prometheus.prometheusSpec.resources.requests.cpu=100m \
72+
--set prometheus.prometheusSpec.resources.requests.memory=256Mi \
73+
--set prometheus.prometheusSpec.resources.limits.memory=512Mi \
74+
--wait \
75+
--timeout 120s || true
76+
}
77+
6378
install_keda() {
64-
docker_exec kubectl apply --server-side -f "https://github.com/kedacore/keda/releases/download/v${KEDA_VERSION}/keda-${KEDA_VERSION}-core.yaml" || true
79+
docker_exec helm install keda kedacore/keda \
80+
--set resources.operator.requests.cpu=50m \
81+
--set resources.operator.requests.memory=64Mi \
82+
--set resources.metricServer.requests.cpu=50m \
83+
--set resources.metricServer.requests.memory=64Mi \
84+
--wait \
85+
--timeout 90s || true
6586
}
6687

6788
install_charts() {
@@ -111,6 +132,7 @@ main() {
111132

112133
create_kind_cluster
113134
install_local_path_provisioner
135+
install_prometheus
114136
install_keda
115137
install_charts
116138
else
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
controller:
2+
podMonitor:
3+
enabled: true
24
keda:
35
enabled: true
46
minReplicas: 2
57
maxReplicas: 10
68
triggers:
79
- type: prometheus
810
metadata:
9-
serverAddress: http://prometheus.monitoring.svc:9090
11+
serverAddress: http://prometheus-kube-prometheus-stack-prometheus.default.svc:9090
1012
metricName: haproxy_process_idle_time_percent
1113
threshold: "50"
1214
query: avg(haproxy_process_idle_time_percent)

0 commit comments

Comments
 (0)