Unverified Commit 73f95837 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #58459 from deads2k/scheduler-04-handle-empty

Automatic merge from submit-queue (batch tested with PRs 58446, 58459, 58340). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. handle scheduler without exposed ports Plumbs the scheduler port opt out more completely. When the metrics server was added, the deprecated paths forgot about it.
parents 0dd88a1f 5d084758
...@@ -194,6 +194,7 @@ func (o *Options) applyDeprecatedHealthzAddressToConfig() { ...@@ -194,6 +194,7 @@ func (o *Options) applyDeprecatedHealthzAddressToConfig() {
func (o *Options) applyDeprecatedHealthzPortToConfig() { func (o *Options) applyDeprecatedHealthzPortToConfig() {
if o.healthzPort == -1 { if o.healthzPort == -1 {
o.config.HealthzBindAddress = "" o.config.HealthzBindAddress = ""
o.config.MetricsBindAddress = ""
return return
} }
...@@ -374,10 +375,13 @@ func NewSchedulerServer(config *componentconfig.KubeSchedulerConfiguration, mast ...@@ -374,10 +375,13 @@ func NewSchedulerServer(config *componentconfig.KubeSchedulerConfiguration, mast
} }
// Configz registration. // Configz registration.
if c, err := configz.New("componentconfig"); err == nil { // only register if we're actually exposing it somewhere
c.Set(config) if len(config.MetricsBindAddress) > 0 || len(config.HealthzBindAddress) > 0 {
} else { if c, err := configz.New("componentconfig"); err == nil {
return nil, fmt.Errorf("unable to register configz: %s", err) c.Set(config)
} else {
return nil, fmt.Errorf("unable to register configz: %s", err)
}
} }
// Prepare some Kube clients. // Prepare some Kube clients.
...@@ -402,7 +406,7 @@ func NewSchedulerServer(config *componentconfig.KubeSchedulerConfiguration, mast ...@@ -402,7 +406,7 @@ func NewSchedulerServer(config *componentconfig.KubeSchedulerConfiguration, mast
// Prepare a healthz server. If the metrics bind address is the same as the // Prepare a healthz server. If the metrics bind address is the same as the
// healthz bind address, consolidate the servers into one. // healthz bind address, consolidate the servers into one.
var healthzServer *http.Server var healthzServer *http.Server
if len(config.HealthzBindAddress) != 0 { if len(config.HealthzBindAddress) > 0 {
healthzServer = makeHealthzServer(config) healthzServer = makeHealthzServer(config)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment