Remove some dead options in KubeSchedulerConfiguration

The v1beta1 API had MetricsBindAddress and HealthzBindAddress fields
but they were removed in v1, and then never got removed from the
unversioned type when the v1beta1 API went away.
This commit is contained in:
Dan Winship 2024-01-19 10:05:04 -05:00
parent 05780d58bf
commit ed289f875e
4 changed files with 0 additions and 71 deletions

View File

@ -54,10 +54,6 @@ type KubeSchedulerConfiguration struct {
// ClientConnection specifies the kubeconfig file and client connection
// settings for the proxy server to use when communicating with the apiserver.
ClientConnection componentbaseconfig.ClientConnectionConfiguration
// HealthzBindAddress is the IP address and port for the health check server to serve on.
HealthzBindAddress string
// MetricsBindAddress is the IP address and port for the metrics server to serve on.
MetricsBindAddress string
// DebuggingConfiguration holds configuration for Debugging related features
// TODO: We might wanna make this a substruct like Debugging componentbaseconfig.DebuggingConfiguration

View File

@ -443,8 +443,6 @@ func autoConvert_config_KubeSchedulerConfiguration_To_v1_KubeSchedulerConfigurat
if err := v1alpha1.Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil {
return err
}
// WARNING: in.HealthzBindAddress requires manual conversion: does not exist in peer-type
// WARNING: in.MetricsBindAddress requires manual conversion: does not exist in peer-type
if err := v1alpha1.Convert_config_DebuggingConfiguration_To_v1alpha1_DebuggingConfiguration(&in.DebuggingConfiguration, &out.DebuggingConfiguration, s); err != nil {
return err
}

View File

@ -18,10 +18,7 @@ package validation
import (
"fmt"
"net"
"reflect"
"strconv"
"strings"
v1 "k8s.io/api/core/v1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
@ -68,32 +65,6 @@ func ValidateKubeSchedulerConfiguration(cc *config.KubeSchedulerConfiguration) u
}
errs = append(errs, validateCommonQueueSort(profilesPath, cc.Profiles)...)
}
if len(cc.HealthzBindAddress) > 0 {
host, port, err := splitHostIntPort(cc.HealthzBindAddress)
if err != nil {
errs = append(errs, field.Invalid(field.NewPath("healthzBindAddress"), cc.HealthzBindAddress, err.Error()))
} else {
if errMsgs := validation.IsValidIP(host); errMsgs != nil {
errs = append(errs, field.Invalid(field.NewPath("healthzBindAddress"), cc.HealthzBindAddress, strings.Join(errMsgs, ",")))
}
if port != 0 {
errs = append(errs, field.Invalid(field.NewPath("healthzBindAddress"), cc.HealthzBindAddress, "must be empty or with an explicit 0 port"))
}
}
}
if len(cc.MetricsBindAddress) > 0 {
host, port, err := splitHostIntPort(cc.MetricsBindAddress)
if err != nil {
errs = append(errs, field.Invalid(field.NewPath("metricsBindAddress"), cc.MetricsBindAddress, err.Error()))
} else {
if errMsgs := validation.IsValidIP(host); errMsgs != nil {
errs = append(errs, field.Invalid(field.NewPath("metricsBindAddress"), cc.MetricsBindAddress, strings.Join(errMsgs, ",")))
}
if port != 0 {
errs = append(errs, field.Invalid(field.NewPath("metricsBindAddress"), cc.MetricsBindAddress, "must be empty or with an explicit 0 port"))
}
}
}
errs = append(errs, validatePercentageOfNodesToScore(field.NewPath("percentageOfNodesToScore"), cc.PercentageOfNodesToScore))
@ -110,18 +81,6 @@ func ValidateKubeSchedulerConfiguration(cc *config.KubeSchedulerConfiguration) u
return utilerrors.Flatten(utilerrors.NewAggregate(errs))
}
func splitHostIntPort(s string) (string, int, error) {
host, port, err := net.SplitHostPort(s)
if err != nil {
return "", 0, err
}
portInt, err := strconv.Atoi(port)
if err != nil {
return "", 0, err
}
return host, portInt, err
}
func validatePercentageOfNodesToScore(path *field.Path, percentageOfNodesToScore *int32) error {
if percentageOfNodesToScore != nil {
if *percentageOfNodesToScore < 0 || *percentageOfNodesToScore > 100 {

View File

@ -103,12 +103,6 @@ func TestValidateKubeSchedulerConfigurationV1(t *testing.T) {
enableContentProfilingSetWithoutEnableProfiling.EnableProfiling = false
enableContentProfilingSetWithoutEnableProfiling.EnableContentionProfiling = true
metricsBindAddrInvalid := validConfig.DeepCopy()
metricsBindAddrInvalid.MetricsBindAddress = "0.0.0.0:9090"
healthzBindAddrInvalid := validConfig.DeepCopy()
healthzBindAddrInvalid.HealthzBindAddress = "0.0.0.0:9090"
percentageOfNodesToScore101 := validConfig.DeepCopy()
percentageOfNodesToScore101.PercentageOfNodesToScore = ptr.To[int32](101)
@ -238,24 +232,6 @@ func TestValidateKubeSchedulerConfigurationV1(t *testing.T) {
},
},
},
"non-empty-metrics-bind-addr": {
config: metricsBindAddrInvalid,
wantErrs: field.ErrorList{
&field.Error{
Type: field.ErrorTypeInvalid,
Field: "metricsBindAddress",
},
},
},
"non-empty-healthz-bind-addr": {
config: healthzBindAddrInvalid,
wantErrs: field.ErrorList{
&field.Error{
Type: field.ErrorTypeInvalid,
Field: "healthzBindAddress",
},
},
},
"bad-percentage-of-nodes-to-score": {
config: percentageOfNodesToScore101,
wantErrs: field.ErrorList{