From aaac96c6605625f9ba0a6825e0f4d5cb04b5cb77 Mon Sep 17 00:00:00 2001 From: Han Kang Date: Wed, 17 Apr 2019 15:59:46 -0700 Subject: [PATCH] Two bug fixes: (1) at least log something out if we fail to register our health check, (2) actually register a prometheus metric. I delete the deprecated metric in this block because there isn't any point to it, since no one can be broken by changing a metric that doesn't get collected --- pkg/master/master.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pkg/master/master.go b/pkg/master/master.go index 972397da8b1..8c24f3d3df7 100644 --- a/pkg/master/master.go +++ b/pkg/master/master.go @@ -469,15 +469,10 @@ func (m *Master) InstallLegacyAPI(c *completedConfig, restOptionsGetter generic. func (m *Master) installTunneler(nodeTunneler tunneler.Tunneler, nodeClient corev1client.NodeInterface) { nodeTunneler.Run(nodeAddressProvider{nodeClient}.externalAddresses) - m.GenericAPIServer.AddHealthChecks(healthz.NamedCheck("SSH Tunnel Check", tunneler.TunnelSyncHealthChecker(nodeTunneler))) - prometheus.NewGaugeFunc(prometheus.GaugeOpts{ - Name: "apiserver_proxy_tunnel_sync_duration_seconds", - Help: "The time since the last successful synchronization of the SSH tunnels for proxy requests.", - }, func() float64 { return float64(nodeTunneler.SecondsSinceSync()) }) - prometheus.NewGaugeFunc(prometheus.GaugeOpts{ - Name: "apiserver_proxy_tunnel_sync_latency_secs", - Help: "(Deprecated) The time since the last successful synchronization of the SSH tunnels for proxy requests.", - }, func() float64 { return float64(nodeTunneler.SecondsSinceSync()) }) + err := m.GenericAPIServer.AddHealthChecks(healthz.NamedCheck("SSH Tunnel Check", tunneler.TunnelSyncHealthChecker(nodeTunneler))) + if err != nil { + klog.Errorf("Failed adding ssh tunnel health check %v\n", err) + } } // RESTStorageProvider is a factory type for REST storage.