UPSTREAM: 58459: handle scheduler without exposed ports
@@ -196,6 +196,7 @@ func (o *Options) applyDeprecatedHealthzAddressToConfig() {
func (o *Options) applyDeprecatedHealthzPortToConfig() {
if o.healthzPort == -1 {
o.config.HealthzBindAddress = ""
+ o.config.MetricsBindAddress = ""
return
}
@@ -378,6 +379,7 @@ func NewSchedulerServer(config *componentconfig.KubeSchedulerConfiguration, mast
}
// Configz registration.
+ if len(config.MetricsBindAddress) > 0 || len(config.HealthzBindAddress) > 0 {
if c, err := configz.New("componentconfig"); err == nil {
c.Set(config)
} else {
@@ -385,6 +387,7 @@ func NewSchedulerServer(config *componentconfig.KubeSchedulerConfiguration, mast
// drop once we're in a separate process
utilruntime.HandleError(fmt.Errorf("unable to register configz: %s", err))
}
+ }
// Prepare some Kube clients.
client, leaderElectionClient, eventClient, err := createClients(config.ClientConnection, master)
@@ -408,7 +411,7 @@ func NewSchedulerServer(config *componentconfig.KubeSchedulerConfiguration, mast
// Prepare a healthz server. If the metrics bind address is the same as the
// healthz bind address, consolidate the servers into one.
var healthzServer *http.Server
- if len(config.HealthzBindAddress) != 0 {
+ if len(config.HealthzBindAddress) > 0 {
healthzServer = makeHealthzServer(config)
}
