Skip to content

Commit be044df

Browse files
committed
OCPBUGS-33620: define *probes for KSM
Signed-off-by: Pranshu Srivastava <[email protected]>
1 parent 7015893 commit be044df

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

assets/kube-state-metrics/deployment.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,24 @@ spec:
5757
^kube_pod_completion_time$,
5858
^kube_pod_status_scheduled$
5959
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.12.0
60+
livenessProbe:
61+
exec:
62+
command:
63+
- sh
64+
- -c
65+
- if [ -x "$(command -v curl)" ]; then exec curl -s -I -f http://localhost:8081/healthz; elif [ -x "$(command -v wget)" ]; then exec wget --quiet --tries=1 --spider http://localhost:8081/healthz; else exit 1; fi
6066
name: kube-state-metrics
67+
ports:
68+
- containerPort: 8081
69+
name: metrics
70+
- containerPort: 8082
71+
name: self
72+
readinessProbe:
73+
exec:
74+
command:
75+
- sh
76+
- -c
77+
- if [ -x "$(command -v curl)" ]; then exec curl -s -I -f http://localhost:8082/; elif [ -x "$(command -v wget)" ]; then exec wget --quiet --tries=1 --spider http://localhost:8082/; else exit 1; fi
6178
resources:
6279
requests:
6380
cpu: 2m

jsonnet/components/kube-state-metrics.libsonnet

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,38 @@ function(params)
266266
readOnly: true,
267267
},
268268
],
269+
local metricsPort = 8081,
270+
local selfPort = 8082,
271+
ports::: [
272+
{
273+
containerPort: metricsPort,
274+
name: 'metrics',
275+
},
276+
{
277+
containerPort: selfPort,
278+
name: 'self',
279+
},
280+
],
281+
local livenessProbePath = 'healthz',
282+
local readinessProbePath = '',
283+
livenessProbe::: {
284+
exec: {
285+
command: [
286+
'sh',
287+
'-c',
288+
'if [ -x "$(command -v curl)" ]; then exec curl -s -I -f http://localhost:%s/%s; elif [ -x "$(command -v wget)" ]; then exec wget --quiet --tries=1 --spider http://localhost:%s/%s; else exit 1; fi' % [metricsPort, livenessProbePath, metricsPort, livenessProbePath],
289+
],
290+
},
291+
},
292+
readinessProbe::: {
293+
exec: {
294+
command: [
295+
'sh',
296+
'-c',
297+
'if [ -x "$(command -v curl)" ]; then exec curl -s -I -f http://localhost:%s/%s; elif [ -x "$(command -v wget)" ]; then exec wget --quiet --tries=1 --spider http://localhost:%s/%s; else exit 1; fi' % [selfPort, readinessProbePath, selfPort, readinessProbePath],
298+
],
299+
},
300+
},
269301
},
270302
super.containers,
271303
),

0 commit comments

Comments
 (0)