@@ -46,6 +46,8 @@ local defaults = {
46
46
runbookURLPattern: 'https://runbooks.prometheus-operator.dev/runbooks/kube-state-metrics/%s' ,
47
47
},
48
48
},
49
+ // `enableProbes` allows users to opt-into upstream definitions for health probes.
50
+ enableProbes:: false ,
49
51
};
50
52
51
53
function (params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet' ) {
@@ -112,6 +114,8 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
112
114
{ name: 'https-main' , containerPort: 8443 },
113
115
],
114
116
image: ksm._config.kubeRbacProxyImage,
117
+ // When enabling probes, kube-rbac-proxy needs to always allow the /livez endpoint.
118
+ ignorePaths: if ksm._config.enableProbes then ['/livez' ] else super .ignorePaths,
115
119
}),
116
120
117
121
local kubeRbacProxySelf = krp(ksm._config.kubeRbacProxySelf {
@@ -122,6 +126,8 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
122
126
{ name: 'https-self' , containerPort: 9443 },
123
127
],
124
128
image: ksm._config.kubeRbacProxyImage,
129
+ // When enabling probes, kube-rbac-proxy needs to always allow the /readyz endpoint.
130
+ ignorePaths: if ksm._config.enableProbes then ['/readyz' ] else super .ignorePaths,
125
131
}),
126
132
127
133
networkPolicy: {
@@ -162,14 +168,15 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
162
168
automountServiceAccountToken: true ,
163
169
containers: std.map (function (c) c {
164
170
ports:: null ,
165
- livenessProbe:: null ,
166
- readinessProbe:: null ,
167
171
securityContext+: {
168
172
runAsGroup: 65534 ,
169
173
},
170
174
args: ['--host=127.0.0.1' , '--port=8081' , '--telemetry-host=127.0.0.1' , '--telemetry-port=8082' ],
171
175
resources: ksm._config.resources,
172
- }, super .containers) + [kubeRbacProxyMain, kubeRbacProxySelf],
176
+ } + if !ksm._config.enableProbes then {
177
+ livenessProbe:: null ,
178
+ readinessProbe:: null ,
179
+ } else {}, super .containers) + [kubeRbacProxyMain, kubeRbacProxySelf],
173
180
},
174
181
},
175
182
},
0 commit comments