Commit 928bc7d 1 parent 9d3345d commit 928bc7d Copy full SHA for 928bc7d
File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,13 @@ func (cm *controllerManager) serveMetrics(stop <-chan struct{}) {
192
192
}
193
193
194
194
func (cm * controllerManager ) Start (stop <- chan struct {}) error {
195
+ // Metrics should be served whether the controller is leader or not.
196
+ // (If we don't serve metrics for non-leaders, prometheus will still scrape
197
+ // the pod but will get a connection refused)
198
+ if cm .metricsListener != nil {
199
+ go cm .serveMetrics (stop )
200
+ }
201
+
195
202
if cm .resourceLock != nil {
196
203
err := cm .startLeaderElection (stop )
197
204
if err != nil {
@@ -227,11 +234,6 @@ func (cm *controllerManager) start(stop <-chan struct{}) {
227
234
}
228
235
}()
229
236
230
- // Start the metrics server
231
- if cm .metricsListener != nil {
232
- go cm .serveMetrics (stop )
233
- }
234
-
235
237
// Wait for the caches to sync.
236
238
// TODO(community): Check the return value and write a test
237
239
cm .cache .WaitForCacheSync (stop )
You can’t perform that action at this time.
0 commit comments