Merge pull request #122876 from danwinship/dead-scheduler-config
Remove some dead options in KubeSchedulerConfiguration
This commit is contained in:
@@ -54,10 +54,6 @@ type KubeSchedulerConfiguration struct {
|
|||||||
// ClientConnection specifies the kubeconfig file and client connection
|
// ClientConnection specifies the kubeconfig file and client connection
|
||||||
// settings for the proxy server to use when communicating with the apiserver.
|
// settings for the proxy server to use when communicating with the apiserver.
|
||||||
ClientConnection componentbaseconfig.ClientConnectionConfiguration
|
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
|
// DebuggingConfiguration holds configuration for Debugging related features
|
||||||
// TODO: We might wanna make this a substruct like Debugging componentbaseconfig.DebuggingConfiguration
|
// TODO: We might wanna make this a substruct like Debugging componentbaseconfig.DebuggingConfiguration
|
||||||
|
@@ -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 {
|
if err := v1alpha1.Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil {
|
||||||
return err
|
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 {
|
if err := v1alpha1.Convert_config_DebuggingConfiguration_To_v1alpha1_DebuggingConfiguration(&in.DebuggingConfiguration, &out.DebuggingConfiguration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,7 @@ package validation
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||||
@@ -68,32 +65,6 @@ func ValidateKubeSchedulerConfiguration(cc *config.KubeSchedulerConfiguration) u
|
|||||||
}
|
}
|
||||||
errs = append(errs, validateCommonQueueSort(profilesPath, cc.Profiles)...)
|
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))
|
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))
|
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 {
|
func validatePercentageOfNodesToScore(path *field.Path, percentageOfNodesToScore *int32) error {
|
||||||
if percentageOfNodesToScore != nil {
|
if percentageOfNodesToScore != nil {
|
||||||
if *percentageOfNodesToScore < 0 || *percentageOfNodesToScore > 100 {
|
if *percentageOfNodesToScore < 0 || *percentageOfNodesToScore > 100 {
|
||||||
|
@@ -103,12 +103,6 @@ func TestValidateKubeSchedulerConfigurationV1(t *testing.T) {
|
|||||||
enableContentProfilingSetWithoutEnableProfiling.EnableProfiling = false
|
enableContentProfilingSetWithoutEnableProfiling.EnableProfiling = false
|
||||||
enableContentProfilingSetWithoutEnableProfiling.EnableContentionProfiling = true
|
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 := validConfig.DeepCopy()
|
||||||
percentageOfNodesToScore101.PercentageOfNodesToScore = ptr.To[int32](101)
|
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": {
|
"bad-percentage-of-nodes-to-score": {
|
||||||
config: percentageOfNodesToScore101,
|
config: percentageOfNodesToScore101,
|
||||||
wantErrs: field.ErrorList{
|
wantErrs: field.ErrorList{
|
||||||
|
Reference in New Issue
Block a user