diff --git a/cmd/kube-scheduler/app/BUILD b/cmd/kube-scheduler/app/BUILD index 7d56559212..3e3d92597d 100644 --- a/cmd/kube-scheduler/app/BUILD +++ b/cmd/kube-scheduler/app/BUILD @@ -13,13 +13,13 @@ go_library( "//cmd/kube-scheduler/app/config:go_default_library", "//cmd/kube-scheduler/app/options:go_default_library", "//pkg/api/legacyscheme:go_default_library", - "//pkg/apis/componentconfig:go_default_library", "//pkg/controller:go_default_library", "//pkg/features:go_default_library", "//pkg/scheduler:go_default_library", "//pkg/scheduler/algorithmprovider:go_default_library", "//pkg/scheduler/api:go_default_library", "//pkg/scheduler/api/latest:go_default_library", + "//pkg/scheduler/apis/config:go_default_library", "//pkg/scheduler/factory:go_default_library", "//pkg/scheduler/metrics:go_default_library", "//pkg/util/configz:go_default_library", diff --git a/cmd/kube-scheduler/app/config/BUILD b/cmd/kube-scheduler/app/config/BUILD index 1b499919f7..6545f5ff84 100644 --- a/cmd/kube-scheduler/app/config/BUILD +++ b/cmd/kube-scheduler/app/config/BUILD @@ -6,7 +6,7 @@ go_library( importpath = "k8s.io/kubernetes/cmd/kube-scheduler/app/config", visibility = ["//visibility:public"], deps = [ - "//pkg/apis/componentconfig:go_default_library", + "//pkg/scheduler/apis/config:go_default_library", "//staging/src/k8s.io/apiserver/pkg/server:go_default_library", "//staging/src/k8s.io/client-go/informers:go_default_library", "//staging/src/k8s.io/client-go/informers/core/v1:go_default_library", diff --git a/cmd/kube-scheduler/app/config/config.go b/cmd/kube-scheduler/app/config/config.go index 4f1e674dd3..930759d28c 100644 --- a/cmd/kube-scheduler/app/config/config.go +++ b/cmd/kube-scheduler/app/config/config.go @@ -24,13 +24,13 @@ import ( v1core "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/client-go/tools/leaderelection" "k8s.io/client-go/tools/record" - "k8s.io/kubernetes/pkg/apis/componentconfig" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" ) // Config has all the context to run a Scheduler type Config struct { // config is the scheduler server's configuration object. - ComponentConfig componentconfig.KubeSchedulerConfiguration + ComponentConfig kubeschedulerconfig.KubeSchedulerConfiguration InsecureServing *apiserver.DeprecatedInsecureServingInfo // nil will disable serving on an insecure port InsecureMetricsServing *apiserver.DeprecatedInsecureServingInfo // non-nil if metrics should be served independently diff --git a/cmd/kube-scheduler/app/options/BUILD b/cmd/kube-scheduler/app/options/BUILD index 1254568c1c..d4dbea230c 100644 --- a/cmd/kube-scheduler/app/options/BUILD +++ b/cmd/kube-scheduler/app/options/BUILD @@ -13,17 +13,16 @@ go_library( deps = [ "//cmd/kube-scheduler/app/config:go_default_library", "//pkg/api/legacyscheme:go_default_library", - "//pkg/apis/componentconfig:go_default_library", - "//pkg/apis/componentconfig/v1alpha1:go_default_library", "//pkg/client/leaderelectionconfig:go_default_library", + "//pkg/scheduler/apis/config:go_default_library", + "//pkg/scheduler/apis/config/scheme:go_default_library", + "//pkg/scheduler/apis/config/v1alpha1:go_default_library", "//pkg/scheduler/factory:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/json:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library", "//staging/src/k8s.io/apiserver/pkg/server/options:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", @@ -36,6 +35,7 @@ go_library( "//staging/src/k8s.io/client-go/tools/leaderelection:go_default_library", "//staging/src/k8s.io/client-go/tools/leaderelection/resourcelock:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", + "//staging/src/k8s.io/kube-scheduler/config/v1alpha1:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library", ], @@ -64,7 +64,7 @@ go_test( embed = [":go_default_library"], deps = [ "//cmd/kube-scheduler/app/config:go_default_library", - "//pkg/apis/componentconfig:go_default_library", + "//pkg/scheduler/apis/config:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library", diff --git a/cmd/kube-scheduler/app/options/configfile.go b/cmd/kube-scheduler/app/options/configfile.go index 746848263a..7648f76fd4 100644 --- a/cmd/kube-scheduler/app/options/configfile.go +++ b/cmd/kube-scheduler/app/options/configfile.go @@ -18,29 +18,17 @@ package options import ( "errors" - "fmt" "io/ioutil" "os" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/runtime/serializer/json" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/kubernetes/pkg/apis/componentconfig" - componentconfigv1alpha1 "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" + kubeschedulerscheme "k8s.io/kubernetes/pkg/scheduler/apis/config/scheme" + kubeschedulerconfigv1alpha1 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1alpha1" ) -var ( - configScheme = runtime.NewScheme() - configCodecs = serializer.NewCodecFactory(configScheme) -) - -func init() { - utilruntime.Must(componentconfig.AddToScheme(configScheme)) - utilruntime.Must(componentconfigv1alpha1.AddToScheme(configScheme)) -} - -func loadConfigFromFile(file string) (*componentconfig.KubeSchedulerConfiguration, error) { +func loadConfigFromFile(file string) (*kubeschedulerconfig.KubeSchedulerConfiguration, error) { data, err := ioutil.ReadFile(file) if err != nil { return nil, err @@ -49,22 +37,18 @@ func loadConfigFromFile(file string) (*componentconfig.KubeSchedulerConfiguratio return loadConfig(data) } -func loadConfig(data []byte) (*componentconfig.KubeSchedulerConfiguration, error) { - configObj, gvk, err := configCodecs.UniversalDecoder().Decode(data, nil, nil) - if err != nil { +func loadConfig(data []byte) (*kubeschedulerconfig.KubeSchedulerConfiguration, error) { + configObj := &kubeschedulerconfig.KubeSchedulerConfiguration{} + if err := runtime.DecodeInto(kubeschedulerscheme.Codecs.UniversalDecoder(), data, configObj); err != nil { return nil, err } - config, ok := configObj.(*componentconfig.KubeSchedulerConfiguration) - if !ok { - return nil, fmt.Errorf("got unexpected config type: %v", gvk) - } - return config, nil + return configObj, nil } // WriteConfigFile writes the config into the given file name as YAML. -func WriteConfigFile(fileName string, cfg *componentconfig.KubeSchedulerConfiguration) error { +func WriteConfigFile(fileName string, cfg *kubeschedulerconfig.KubeSchedulerConfiguration) error { var encoder runtime.Encoder - mediaTypes := configCodecs.SupportedMediaTypes() + mediaTypes := kubeschedulerscheme.Codecs.SupportedMediaTypes() for _, info := range mediaTypes { if info.MediaType == "application/yaml" { encoder = info.Serializer @@ -74,8 +58,8 @@ func WriteConfigFile(fileName string, cfg *componentconfig.KubeSchedulerConfigur if encoder == nil { return errors.New("unable to locate yaml encoder") } - encoder = json.NewYAMLSerializer(json.DefaultMetaFactory, configScheme, configScheme) - encoder = configCodecs.EncoderForVersion(encoder, componentconfigv1alpha1.SchemeGroupVersion) + encoder = json.NewYAMLSerializer(json.DefaultMetaFactory, kubeschedulerscheme.Scheme, kubeschedulerscheme.Scheme) + encoder = kubeschedulerscheme.Codecs.EncoderForVersion(encoder, kubeschedulerconfigv1alpha1.SchemeGroupVersion) configFile, err := os.Create(fileName) if err != nil { diff --git a/cmd/kube-scheduler/app/options/deprecated.go b/cmd/kube-scheduler/app/options/deprecated.go index 14415793c2..99fbeff6ab 100644 --- a/cmd/kube-scheduler/app/options/deprecated.go +++ b/cmd/kube-scheduler/app/options/deprecated.go @@ -20,7 +20,7 @@ import ( "fmt" "github.com/spf13/pflag" - "k8s.io/kubernetes/pkg/apis/componentconfig" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" "k8s.io/kubernetes/pkg/scheduler/factory" ) @@ -37,7 +37,7 @@ type DeprecatedOptions struct { } // AddFlags adds flags for the deprecated options. -func (o *DeprecatedOptions) AddFlags(fs *pflag.FlagSet, cfg *componentconfig.KubeSchedulerConfiguration) { +func (o *DeprecatedOptions) AddFlags(fs *pflag.FlagSet, cfg *kubeschedulerconfig.KubeSchedulerConfiguration) { if o == nil { return } @@ -46,7 +46,7 @@ func (o *DeprecatedOptions) AddFlags(fs *pflag.FlagSet, cfg *componentconfig.Kub fs.StringVar(&o.AlgorithmProvider, "algorithm-provider", o.AlgorithmProvider, "DEPRECATED: the scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders()) fs.StringVar(&o.PolicyConfigFile, "policy-config-file", o.PolicyConfigFile, "DEPRECATED: file with scheduler policy configuration. This file is used if policy ConfigMap is not provided or --use-legacy-policy-config=true") - usage := fmt.Sprintf("DEPRECATED: name of the ConfigMap object that contains scheduler's policy configuration. It must exist in the system namespace before scheduler initialization if --use-legacy-policy-config=false. The config must be provided as the value of an element in 'Data' map with the key='%v'", componentconfig.SchedulerPolicyConfigMapKey) + usage := fmt.Sprintf("DEPRECATED: name of the ConfigMap object that contains scheduler's policy configuration. It must exist in the system namespace before scheduler initialization if --use-legacy-policy-config=false. The config must be provided as the value of an element in 'Data' map with the key='%v'", kubeschedulerconfig.SchedulerPolicyConfigMapKey) fs.StringVar(&o.PolicyConfigMapName, "policy-configmap", o.PolicyConfigMapName, usage) fs.StringVar(&o.PolicyConfigMapNamespace, "policy-configmap-namespace", o.PolicyConfigMapNamespace, "DEPRECATED: the namespace where policy ConfigMap is located. The kube-system namespace will be used if this is not provided or is empty.") fs.BoolVar(&o.UseLegacyPolicyConfig, "use-legacy-policy-config", o.UseLegacyPolicyConfig, "DEPRECATED: when set to true, scheduler will ignore policy ConfigMap and uses policy config file") @@ -82,31 +82,31 @@ func (o *DeprecatedOptions) Validate() []error { // 1. --use-legacy-policy-config to use a policy file. // 2. --policy-configmap to use a policy config map value. // 3. --algorithm-provider to use a named algorithm provider. -func (o *DeprecatedOptions) ApplyTo(cfg *componentconfig.KubeSchedulerConfiguration) error { +func (o *DeprecatedOptions) ApplyTo(cfg *kubeschedulerconfig.KubeSchedulerConfiguration) error { if o == nil { return nil } switch { case o.UseLegacyPolicyConfig || (len(o.PolicyConfigFile) > 0 && o.PolicyConfigMapName == ""): - cfg.AlgorithmSource = componentconfig.SchedulerAlgorithmSource{ - Policy: &componentconfig.SchedulerPolicySource{ - File: &componentconfig.SchedulerPolicyFileSource{ + cfg.AlgorithmSource = kubeschedulerconfig.SchedulerAlgorithmSource{ + Policy: &kubeschedulerconfig.SchedulerPolicySource{ + File: &kubeschedulerconfig.SchedulerPolicyFileSource{ Path: o.PolicyConfigFile, }, }, } case len(o.PolicyConfigMapName) > 0: - cfg.AlgorithmSource = componentconfig.SchedulerAlgorithmSource{ - Policy: &componentconfig.SchedulerPolicySource{ - ConfigMap: &componentconfig.SchedulerPolicyConfigMapSource{ + cfg.AlgorithmSource = kubeschedulerconfig.SchedulerAlgorithmSource{ + Policy: &kubeschedulerconfig.SchedulerPolicySource{ + ConfigMap: &kubeschedulerconfig.SchedulerPolicyConfigMapSource{ Name: o.PolicyConfigMapName, Namespace: o.PolicyConfigMapNamespace, }, }, } case len(o.AlgorithmProvider) > 0: - cfg.AlgorithmSource = componentconfig.SchedulerAlgorithmSource{ + cfg.AlgorithmSource = kubeschedulerconfig.SchedulerAlgorithmSource{ Provider: &o.AlgorithmProvider, } } diff --git a/cmd/kube-scheduler/app/options/insecure_serving.go b/cmd/kube-scheduler/app/options/insecure_serving.go index b7353789fa..320b9352b8 100644 --- a/cmd/kube-scheduler/app/options/insecure_serving.go +++ b/cmd/kube-scheduler/app/options/insecure_serving.go @@ -25,7 +25,7 @@ import ( apiserveroptions "k8s.io/apiserver/pkg/server/options" schedulerappconfig "k8s.io/kubernetes/cmd/kube-scheduler/app/config" - "k8s.io/kubernetes/pkg/apis/componentconfig" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" ) // CombinedInsecureServingOptions sets up up to two insecure listeners for healthz and metrics. The flags @@ -52,7 +52,7 @@ func (o *CombinedInsecureServingOptions) AddFlags(fs *pflag.FlagSet) { // fs.MarkDeprecated("port", "see --secure-port instead.") } -func (o *CombinedInsecureServingOptions) applyTo(c *schedulerappconfig.Config, componentConfig *componentconfig.KubeSchedulerConfiguration) error { +func (o *CombinedInsecureServingOptions) applyTo(c *schedulerappconfig.Config, componentConfig *kubeschedulerconfig.KubeSchedulerConfiguration) error { if err := updateAddressFromDeprecatedInsecureServingOptions(&componentConfig.HealthzBindAddress, o.Healthz); err != nil { return err } @@ -73,7 +73,7 @@ func (o *CombinedInsecureServingOptions) applyTo(c *schedulerappconfig.Config, c } // ApplyTo applies the insecure serving options to the given scheduler app configuration, and updates the componentConfig. -func (o *CombinedInsecureServingOptions) ApplyTo(c *schedulerappconfig.Config, componentConfig *componentconfig.KubeSchedulerConfiguration) error { +func (o *CombinedInsecureServingOptions) ApplyTo(c *schedulerappconfig.Config, componentConfig *kubeschedulerconfig.KubeSchedulerConfiguration) error { if o == nil { componentConfig.HealthzBindAddress = "" componentConfig.MetricsBindAddress = "" @@ -93,7 +93,7 @@ func (o *CombinedInsecureServingOptions) ApplyTo(c *schedulerappconfig.Config, c } // ApplyToFromLoadedConfig updates the insecure serving options from the component config and then appies it to the given scheduler app configuration. -func (o *CombinedInsecureServingOptions) ApplyToFromLoadedConfig(c *schedulerappconfig.Config, componentConfig *componentconfig.KubeSchedulerConfiguration) error { +func (o *CombinedInsecureServingOptions) ApplyToFromLoadedConfig(c *schedulerappconfig.Config, componentConfig *kubeschedulerconfig.KubeSchedulerConfiguration) error { if o == nil { return nil } diff --git a/cmd/kube-scheduler/app/options/insecure_serving_test.go b/cmd/kube-scheduler/app/options/insecure_serving_test.go index 78f45eecf1..09677b6aa0 100644 --- a/cmd/kube-scheduler/app/options/insecure_serving_test.go +++ b/cmd/kube-scheduler/app/options/insecure_serving_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/util/rand" apiserveroptions "k8s.io/apiserver/pkg/server/options" schedulerappconfig "k8s.io/kubernetes/cmd/kube-scheduler/app/config" - "k8s.io/kubernetes/pkg/apis/componentconfig" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" ) func TestOptions_ApplyTo(t *testing.T) { @@ -41,7 +41,7 @@ func TestOptions_ApplyTo(t *testing.T) { { name: "no config, zero port", options: Options{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HealthzBindAddress: "1.2.3.4:1234", MetricsBindAddress: "1.2.3.4:1234", }, @@ -56,7 +56,7 @@ func TestOptions_ApplyTo(t *testing.T) { { name: "config loaded, non-nil healthz", options: Options{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HealthzBindAddress: "1.2.3.4:1234", MetricsBindAddress: "1.2.3.4:1234", }, @@ -74,7 +74,7 @@ func TestOptions_ApplyTo(t *testing.T) { { name: "config loaded, non-nil metrics", options: Options{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HealthzBindAddress: "1.2.3.4:1234", MetricsBindAddress: "1.2.3.4:1234", }, @@ -92,7 +92,7 @@ func TestOptions_ApplyTo(t *testing.T) { { name: "config loaded, all set, zero BindPort", options: Options{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HealthzBindAddress: "1.2.3.4:1234", MetricsBindAddress: "1.2.3.4:1234", }, @@ -113,7 +113,7 @@ func TestOptions_ApplyTo(t *testing.T) { { name: "config loaded, all set, different addresses", options: Options{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HealthzBindAddress: "1.2.3.4:1234", MetricsBindAddress: "1.2.3.4:1235", }, @@ -136,7 +136,7 @@ func TestOptions_ApplyTo(t *testing.T) { { name: "no config, all set, port passed", options: Options{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HealthzBindAddress: "1.2.3.4:1234", MetricsBindAddress: "1.2.3.4:1234", }, @@ -158,7 +158,7 @@ func TestOptions_ApplyTo(t *testing.T) { { name: "no config, all set, address passed", options: Options{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HealthzBindAddress: "1.2.3.4:1234", MetricsBindAddress: "1.2.3.4:1234", }, @@ -180,7 +180,7 @@ func TestOptions_ApplyTo(t *testing.T) { { name: "no config, all set, zero port passed", options: Options{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HealthzBindAddress: "1.2.3.4:1234", MetricsBindAddress: "1.2.3.4:1234", }, diff --git a/cmd/kube-scheduler/app/options/options.go b/cmd/kube-scheduler/app/options/options.go index 2150dea1aa..15cbe66cee 100644 --- a/cmd/kube-scheduler/app/options/options.go +++ b/cmd/kube-scheduler/app/options/options.go @@ -41,18 +41,19 @@ import ( "k8s.io/client-go/tools/leaderelection" "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/client-go/tools/record" + kubeschedulerconfigv1alpha1 "k8s.io/kube-scheduler/config/v1alpha1" schedulerappconfig "k8s.io/kubernetes/cmd/kube-scheduler/app/config" "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/apis/componentconfig" - componentconfigv1alpha1 "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1" "k8s.io/kubernetes/pkg/client/leaderelectionconfig" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" + kubeschedulerscheme "k8s.io/kubernetes/pkg/scheduler/apis/config/scheme" "k8s.io/kubernetes/pkg/scheduler/factory" ) // Options has all the params needed to run a Scheduler type Options struct { // The default values. These are overridden if ConfigFile is set or by values in InsecureServing. - ComponentConfig componentconfig.KubeSchedulerConfiguration + ComponentConfig kubeschedulerconfig.KubeSchedulerConfiguration SecureServing *apiserveroptions.SecureServingOptions CombinedInsecureServing *CombinedInsecureServingOptions @@ -117,11 +118,11 @@ func splitHostIntPort(s string) (string, int, error) { return host, portInt, err } -func newDefaultComponentConfig() (*componentconfig.KubeSchedulerConfiguration, error) { - cfgv1alpha1 := componentconfigv1alpha1.KubeSchedulerConfiguration{} - configScheme.Default(&cfgv1alpha1) - cfg := componentconfig.KubeSchedulerConfiguration{} - if err := configScheme.Convert(&cfgv1alpha1, &cfg, nil); err != nil { +func newDefaultComponentConfig() (*kubeschedulerconfig.KubeSchedulerConfiguration, error) { + cfgv1alpha1 := kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{} + kubeschedulerscheme.Scheme.Default(&cfgv1alpha1) + cfg := kubeschedulerconfig.KubeSchedulerConfiguration{} + if err := kubeschedulerscheme.Scheme.Convert(&cfgv1alpha1, &cfg, nil); err != nil { return nil, err } return &cfg, nil @@ -232,7 +233,7 @@ func (o *Options) Config() (*schedulerappconfig.Config, error) { // makeLeaderElectionConfig builds a leader election configuration. It will // create a new resource lock associated with the configuration. -func makeLeaderElectionConfig(config componentconfig.KubeSchedulerLeaderElectionConfiguration, client clientset.Interface, recorder record.EventRecorder) (*leaderelection.LeaderElectionConfig, error) { +func makeLeaderElectionConfig(config kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration, client clientset.Interface, recorder record.EventRecorder) (*leaderelection.LeaderElectionConfig, error) { hostname, err := os.Hostname() if err != nil { return nil, fmt.Errorf("unable to get hostname: %v", err) diff --git a/cmd/kube-scheduler/app/options/options_test.go b/cmd/kube-scheduler/app/options/options_test.go index 21300af435..e1b153af3e 100644 --- a/cmd/kube-scheduler/app/options/options_test.go +++ b/cmd/kube-scheduler/app/options/options_test.go @@ -32,7 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/diff" apiserverconfig "k8s.io/apiserver/pkg/apis/config" - "k8s.io/kubernetes/pkg/apis/componentconfig" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" ) func TestSchedulerOptions(t *testing.T) { @@ -70,7 +70,7 @@ func TestSchedulerOptions(t *testing.T) { configFile := filepath.Join(tmpDir, "scheduler.yaml") configKubeconfig := filepath.Join(tmpDir, "config.kubeconfig") if err := ioutil.WriteFile(configFile, []byte(fmt.Sprintf(` -apiVersion: componentconfig/v1alpha1 +apiVersion: kubescheduler.config.k8s.io/v1alpha1 kind: KubeSchedulerConfiguration clientConnection: kubeconfig: "%s" @@ -100,6 +100,17 @@ users: t.Fatal(err) } + oldconfigFile := filepath.Join(tmpDir, "scheduler_old.yaml") + if err := ioutil.WriteFile(oldconfigFile, []byte(fmt.Sprintf(` +apiVersion: componentconfig/v1alpha1 +kind: KubeSchedulerConfiguration +clientConnection: + kubeconfig: "%s" +leaderElection: + leaderElect: true`, configKubeconfig)), os.FileMode(0600)); err != nil { + t.Fatal(err) + } + // flag-specified kubeconfig flagKubeconfig := filepath.Join(tmpDir, "flag.kubeconfig") if err := ioutil.WriteFile(flagKubeconfig, []byte(fmt.Sprintf(` @@ -139,26 +150,26 @@ users: options *Options expectedUsername string expectedError string - expectedConfig componentconfig.KubeSchedulerConfiguration + expectedConfig kubeschedulerconfig.KubeSchedulerConfiguration }{ { name: "config file", options: &Options{ ConfigFile: configFile, - ComponentConfig: func() componentconfig.KubeSchedulerConfiguration { + ComponentConfig: func() kubeschedulerconfig.KubeSchedulerConfiguration { cfg, _ := newDefaultComponentConfig() return *cfg }(), }, expectedUsername: "config", - expectedConfig: componentconfig.KubeSchedulerConfiguration{ + expectedConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ SchedulerName: "default-scheduler", - AlgorithmSource: componentconfig.SchedulerAlgorithmSource{Provider: &defaultSource}, + AlgorithmSource: kubeschedulerconfig.SchedulerAlgorithmSource{Provider: &defaultSource}, HardPodAffinitySymmetricWeight: 1, HealthzBindAddress: "0.0.0.0:10251", MetricsBindAddress: "0.0.0.0:10251", FailureDomains: "kubernetes.io/hostname,failure-domain.beta.kubernetes.io/zone,failure-domain.beta.kubernetes.io/region", - LeaderElection: componentconfig.KubeSchedulerLeaderElectionConfiguration{ + LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{ LeaderElectionConfiguration: apiserverconfig.LeaderElectionConfiguration{ LeaderElect: true, LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, @@ -178,24 +189,29 @@ users: PercentageOfNodesToScore: 50, }, }, + { + name: "config file in componentconfig/v1alpha1", + options: &Options{ConfigFile: oldconfigFile}, + expectedError: "no kind \"KubeSchedulerConfiguration\" is registered for version \"componentconfig/v1alpha1\" in scheme", + }, { name: "kubeconfig flag", options: &Options{ - ComponentConfig: func() componentconfig.KubeSchedulerConfiguration { + ComponentConfig: func() kubeschedulerconfig.KubeSchedulerConfiguration { cfg, _ := newDefaultComponentConfig() cfg.ClientConnection.Kubeconfig = flagKubeconfig return *cfg }(), }, expectedUsername: "flag", - expectedConfig: componentconfig.KubeSchedulerConfiguration{ + expectedConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ SchedulerName: "default-scheduler", - AlgorithmSource: componentconfig.SchedulerAlgorithmSource{Provider: &defaultSource}, + AlgorithmSource: kubeschedulerconfig.SchedulerAlgorithmSource{Provider: &defaultSource}, HardPodAffinitySymmetricWeight: 1, HealthzBindAddress: "", // defaults empty when not running from config file MetricsBindAddress: "", // defaults empty when not running from config file FailureDomains: "kubernetes.io/hostname,failure-domain.beta.kubernetes.io/zone,failure-domain.beta.kubernetes.io/region", - LeaderElection: componentconfig.KubeSchedulerLeaderElectionConfiguration{ + LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{ LeaderElectionConfiguration: apiserverconfig.LeaderElectionConfiguration{ LeaderElect: true, LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, diff --git a/cmd/kube-scheduler/app/server.go b/cmd/kube-scheduler/app/server.go index 6d3e64a821..68d50b7937 100644 --- a/cmd/kube-scheduler/app/server.go +++ b/cmd/kube-scheduler/app/server.go @@ -45,13 +45,13 @@ import ( schedulerserverconfig "k8s.io/kubernetes/cmd/kube-scheduler/app/config" "k8s.io/kubernetes/cmd/kube-scheduler/app/options" "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/apis/componentconfig" "k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/scheduler" "k8s.io/kubernetes/pkg/scheduler/algorithmprovider" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" latestschedulerapi "k8s.io/kubernetes/pkg/scheduler/api/latest" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" "k8s.io/kubernetes/pkg/scheduler/factory" "k8s.io/kubernetes/pkg/scheduler/metrics" "k8s.io/kubernetes/pkg/util/configz" @@ -249,7 +249,7 @@ func installMetricHandler(pathRecorderMux *mux.PathRecorderMux) { } // newMetricsHandler builds a metrics server from the config. -func newMetricsHandler(config *componentconfig.KubeSchedulerConfiguration) http.Handler { +func newMetricsHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration) http.Handler { pathRecorderMux := mux.NewPathRecorderMux("kube-scheduler") installMetricHandler(pathRecorderMux) if config.EnableProfiling { @@ -264,7 +264,7 @@ func newMetricsHandler(config *componentconfig.KubeSchedulerConfiguration) http. // newHealthzServer creates a healthz server from the config, and will also // embed the metrics handler if the healthz and metrics address configurations // are the same. -func newHealthzHandler(config *componentconfig.KubeSchedulerConfiguration, separateMetrics bool) http.Handler { +func newHealthzHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration, separateMetrics bool) http.Handler { pathRecorderMux := mux.NewPathRecorderMux("kube-scheduler") healthz.InstallHandler(pathRecorderMux) if !separateMetrics { @@ -342,9 +342,9 @@ func NewSchedulerConfig(s schedulerserverconfig.CompletedConfig) (*scheduler.Con if err != nil { return nil, fmt.Errorf("couldn't get policy config map %s/%s: %v", policyRef.Namespace, policyRef.Name, err) } - data, found := policyConfigMap.Data[componentconfig.SchedulerPolicyConfigMapKey] + data, found := policyConfigMap.Data[kubeschedulerconfig.SchedulerPolicyConfigMapKey] if !found { - return nil, fmt.Errorf("missing policy config map value at key %q", componentconfig.SchedulerPolicyConfigMapKey) + return nil, fmt.Errorf("missing policy config map value at key %q", kubeschedulerconfig.SchedulerPolicyConfigMapKey) } err = runtime.DecodeInto(latestschedulerapi.Codec, []byte(data), policy) if err != nil { diff --git a/hack/.golint_failures b/hack/.golint_failures index 227530c25c..0345369d29 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -354,6 +354,7 @@ pkg/registry/storage/rest pkg/registry/storage/storageclass pkg/registry/storage/storageclass/storage pkg/routes +pkg/scheduler/apis/config/v1alpha1 pkg/security/apparmor pkg/security/podsecuritypolicy pkg/security/podsecuritypolicy/group diff --git a/pkg/apis/componentconfig/BUILD b/pkg/apis/componentconfig/BUILD index 5203a374b8..1f350d895f 100644 --- a/pkg/apis/componentconfig/BUILD +++ b/pkg/apis/componentconfig/BUILD @@ -18,7 +18,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/apis/componentconfig", deps = [ "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/pkg/apis/componentconfig/register.go b/pkg/apis/componentconfig/register.go index 5e9c8190f0..e42c828203 100644 --- a/pkg/apis/componentconfig/register.go +++ b/pkg/apis/componentconfig/register.go @@ -46,8 +46,7 @@ func Kind(kind string) schema.GroupKind { } func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &KubeSchedulerConfiguration{}, - ) + // TODO: All structs in this package are about to be moved out, + // so nothing should be registered here as this API group is going to be removed soon. return nil } diff --git a/pkg/apis/componentconfig/types.go b/pkg/apis/componentconfig/types.go index 0e6a20585e..0a30cdd148 100644 --- a/pkg/apis/componentconfig/types.go +++ b/pkg/apis/componentconfig/types.go @@ -17,110 +17,10 @@ limitations under the License. package componentconfig import ( - apimachineryconfig "k8s.io/apimachinery/pkg/apis/config" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apiserverconfig "k8s.io/apiserver/pkg/apis/config" ) -// SchedulerPolicyConfigMapKey defines the key of the element in the -// scheduler's policy ConfigMap that contains scheduler's policy config. -const SchedulerPolicyConfigMapKey string = "policy.cfg" - -// SchedulerPolicySource configures a means to obtain a scheduler Policy. One -// source field must be specified, and source fields are mutually exclusive. -type SchedulerPolicySource struct { - // File is a file policy source. - File *SchedulerPolicyFileSource - // ConfigMap is a config map policy source. - ConfigMap *SchedulerPolicyConfigMapSource -} - -// SchedulerPolicyFileSource is a policy serialized to disk and accessed via -// path. -type SchedulerPolicyFileSource struct { - // Path is the location of a serialized policy. - Path string -} - -// SchedulerPolicyConfigMapSource is a policy serialized into a config map value -// under the SchedulerPolicyConfigMapKey key. -type SchedulerPolicyConfigMapSource struct { - // Namespace is the namespace of the policy config map. - Namespace string - // Name is the name of hte policy config map. - Name string -} - -// SchedulerAlgorithmSource is the source of a scheduler algorithm. One source -// field must be specified, and source fields are mutually exclusive. -type SchedulerAlgorithmSource struct { - // Policy is a policy based algorithm source. - Policy *SchedulerPolicySource - // Provider is the name of a scheduling algorithm provider to use. - Provider *string -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type KubeSchedulerConfiguration struct { - metav1.TypeMeta - - // DebuggingConfiguration holds profiling- and debugging-related fields - // TODO: DebuggingConfiguration is inlined because it's been like that earlier. - // We might consider making it a "real" sub-struct. - apiserverconfig.DebuggingConfiguration - - // schedulerName is name of the scheduler, used to select which pods - // will be processed by this scheduler, based on pod's "spec.SchedulerName". - SchedulerName string - // AlgorithmSource specifies the scheduler algorithm source. - AlgorithmSource SchedulerAlgorithmSource - // RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule - // corresponding to every RequiredDuringScheduling affinity rule. - // HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100. - HardPodAffinitySymmetricWeight int32 - - // LeaderElection defines the configuration of leader election client. - LeaderElection KubeSchedulerLeaderElectionConfiguration - - // ClientConnection specifies the kubeconfig file and client connection - // settings for the proxy server to use when communicating with the apiserver. - ClientConnection apimachineryconfig.ClientConnectionConfiguration - // HealthzBindAddress is the IP address and port for the health check server to serve on, - // defaulting to 0.0.0.0:10251 - HealthzBindAddress string - // MetricsBindAddress is the IP address and port for the metrics server to - // serve on, defaulting to 0.0.0.0:10251. - MetricsBindAddress string - - // Indicate the "all topologies" set for empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity. - // DEPRECATED: This is no longer used. - FailureDomains string - - // DisablePreemption disables the pod preemption feature. - DisablePreemption bool - - // PercentageOfNodeToScore is the percentage of all nodes that once found feasible - // for running a pod, the scheduler stops its search for more feasible nodes in - // the cluster. This helps improve scheduler's performance. Scheduler always tries to find - // at least "minFeasibleNodesToFind" feasible nodes no matter what the value of this flag is. - // Example: if the cluster size is 500 nodes and the value of this flag is 30, - // then scheduler stops finding further feasible nodes once it finds 150 feasible ones. - // When the value is 0, default percentage (50%) of the nodes will be scored. - PercentageOfNodesToScore int32 -} - -// KubeSchedulerLeaderElectionConfiguration expands LeaderElectionConfiguration -// to include scheduler specific configuration. -type KubeSchedulerLeaderElectionConfiguration struct { - apiserverconfig.LeaderElectionConfiguration - - // LockObjectNamespace defines the namespace of the lock object - LockObjectNamespace string - // LockObjectName defines the lock object name - LockObjectName string -} - type GroupResource struct { // group is the group portion of the GroupResource. Group string @@ -526,11 +426,3 @@ type PersistentVolumeRecyclerConfiguration struct { // in a multi-node cluster. IncrementTimeoutHostPath int32 } - -const ( - // "kube-system" is the default scheduler lock object namespace - SchedulerDefaultLockObjectNamespace string = "kube-system" - - // "kube-scheduler" is the default scheduler lock object name - SchedulerDefaultLockObjectName = "kube-scheduler" -) diff --git a/pkg/apis/componentconfig/v1alpha1/BUILD b/pkg/apis/componentconfig/v1alpha1/BUILD index 71c192ec91..35dbe9b287 100644 --- a/pkg/apis/componentconfig/v1alpha1/BUILD +++ b/pkg/apis/componentconfig/v1alpha1/BUILD @@ -20,10 +20,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1", deps = [ "//pkg/apis/componentconfig:go_default_library", - "//pkg/apis/core:go_default_library", - "//pkg/kubelet/apis:go_default_library", - "//pkg/master/ports:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", diff --git a/pkg/apis/componentconfig/v1alpha1/defaults.go b/pkg/apis/componentconfig/v1alpha1/defaults.go index 756f66cc24..8edf2c28e1 100644 --- a/pkg/apis/componentconfig/v1alpha1/defaults.go +++ b/pkg/apis/componentconfig/v1alpha1/defaults.go @@ -17,17 +17,11 @@ limitations under the License. package v1alpha1 import ( - "net" - "strconv" "time" - apimachineryconfigv1alpha1 "k8s.io/apimachinery/pkg/apis/config/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kruntime "k8s.io/apimachinery/pkg/runtime" apiserverconfigv1alpha1 "k8s.io/apiserver/pkg/apis/config/v1alpha1" - api "k8s.io/kubernetes/pkg/apis/core" - kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" - "k8s.io/kubernetes/pkg/master/ports" utilpointer "k8s.io/utils/pointer" ) @@ -219,71 +213,3 @@ func SetDefaults_VolumeConfiguration(obj *VolumeConfiguration) { obj.FlexVolumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/" } } - -func SetDefaults_KubeSchedulerConfiguration(obj *KubeSchedulerConfiguration) { - if len(obj.SchedulerName) == 0 { - obj.SchedulerName = api.DefaultSchedulerName - } - - if obj.HardPodAffinitySymmetricWeight == 0 { - obj.HardPodAffinitySymmetricWeight = api.DefaultHardPodAffinitySymmetricWeight - } - - if obj.AlgorithmSource.Policy == nil && - (obj.AlgorithmSource.Provider == nil || len(*obj.AlgorithmSource.Provider) == 0) { - val := SchedulerDefaultProviderName - obj.AlgorithmSource.Provider = &val - } - - if policy := obj.AlgorithmSource.Policy; policy != nil { - if policy.ConfigMap != nil && len(policy.ConfigMap.Namespace) == 0 { - obj.AlgorithmSource.Policy.ConfigMap.Namespace = api.NamespaceSystem - } - } - - if host, port, err := net.SplitHostPort(obj.HealthzBindAddress); err == nil { - if len(host) == 0 { - host = "0.0.0.0" - } - obj.HealthzBindAddress = net.JoinHostPort(host, port) - } else { - obj.HealthzBindAddress = net.JoinHostPort("0.0.0.0", strconv.Itoa(ports.SchedulerPort)) - } - - if host, port, err := net.SplitHostPort(obj.MetricsBindAddress); err == nil { - if len(host) == 0 { - host = "0.0.0.0" - } - obj.MetricsBindAddress = net.JoinHostPort(host, port) - } else { - obj.MetricsBindAddress = net.JoinHostPort("0.0.0.0", strconv.Itoa(ports.SchedulerPort)) - } - - if obj.ClientConnection.QPS == 0.0 { - obj.ClientConnection.QPS = 50.0 - } - - if obj.ClientConnection.Burst == 0 { - obj.ClientConnection.Burst = 100 - } - - if len(obj.LeaderElection.LockObjectNamespace) == 0 { - obj.LeaderElection.LockObjectNamespace = SchedulerDefaultLockObjectNamespace - } - if len(obj.LeaderElection.LockObjectName) == 0 { - obj.LeaderElection.LockObjectName = SchedulerDefaultLockObjectName - } - - if len(obj.FailureDomains) == 0 { - obj.FailureDomains = kubeletapis.DefaultFailureDomains - } - - if obj.PercentageOfNodesToScore == 0 { - // by default, stop finding feasible nodes once the number of feasible nodes is 50% of the cluster. - obj.PercentageOfNodesToScore = 50 - } - - // Use the default ClientConnectionConfiguration and LeaderElectionConfiguration options - apimachineryconfigv1alpha1.RecommendedDefaultClientConnectionConfiguration(&obj.ClientConnection) - apiserverconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection.LeaderElectionConfiguration) -} diff --git a/pkg/apis/componentconfig/v1alpha1/defaults_test.go b/pkg/apis/componentconfig/v1alpha1/defaults_test.go index 77bd8931ea..3e8b897f78 100644 --- a/pkg/apis/componentconfig/v1alpha1/defaults_test.go +++ b/pkg/apis/componentconfig/v1alpha1/defaults_test.go @@ -24,24 +24,6 @@ import ( componentconfig "k8s.io/kubernetes/pkg/apis/componentconfig" ) -func TestSchedulerDefaults(t *testing.T) { - ks1 := &KubeSchedulerConfiguration{} - SetDefaults_KubeSchedulerConfiguration(ks1) - cm, err := componentconfig.ConvertObjToConfigMap("KubeSchedulerConfiguration", ks1) - if err != nil { - t.Errorf("unexpected ConvertObjToConfigMap error %v", err) - } - - ks2 := &KubeSchedulerConfiguration{} - if err = json.Unmarshal([]byte(cm.Data["KubeSchedulerConfiguration"]), ks2); err != nil { - t.Errorf("unexpected error unserializing scheduler config %v", err) - } - - if !reflect.DeepEqual(ks2, ks1) { - t.Errorf("Expected:\n%#v\n\nGot:\n%#v", ks1, ks2) - } -} - func TestControllerDefaultsRoundTrip(t *testing.T) { ks1 := &KubeControllerManagerConfiguration{} SetDefaults_KubeControllerManagerConfiguration(ks1) diff --git a/pkg/apis/componentconfig/v1alpha1/register.go b/pkg/apis/componentconfig/v1alpha1/register.go index 8d670694da..ced4880388 100644 --- a/pkg/apis/componentconfig/v1alpha1/register.go +++ b/pkg/apis/componentconfig/v1alpha1/register.go @@ -41,8 +41,7 @@ func init() { } func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &KubeSchedulerConfiguration{}, - ) + // TODO: All structs in this package are about to be moved out, + // so nothing should be registered here as this API group is going to be removed soon. return nil } diff --git a/pkg/apis/componentconfig/v1alpha1/types.go b/pkg/apis/componentconfig/v1alpha1/types.go index e356b98838..67a8393306 100644 --- a/pkg/apis/componentconfig/v1alpha1/types.go +++ b/pkg/apis/componentconfig/v1alpha1/types.go @@ -17,106 +17,10 @@ limitations under the License. package v1alpha1 import ( - apimachineryconfigv1alpha1 "k8s.io/apimachinery/pkg/apis/config/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apiserverconfigv1alpha1 "k8s.io/apiserver/pkg/apis/config/v1alpha1" ) -// SchedulerPolicySource configures a means to obtain a scheduler Policy. One -// source field must be specified, and source fields are mutually exclusive. -type SchedulerPolicySource struct { - // File is a file policy source. - File *SchedulerPolicyFileSource `json:"file,omitempty"` - // ConfigMap is a config map policy source. - ConfigMap *SchedulerPolicyConfigMapSource `json:"configMap,omitempty"` -} - -// SchedulerPolicyFileSource is a policy serialized to disk and accessed via -// path. -type SchedulerPolicyFileSource struct { - // Path is the location of a serialized policy. - Path string `json:"path"` -} - -// SchedulerPolicyConfigMapSource is a policy serialized into a config map value -// under the SchedulerPolicyConfigMapKey key. -type SchedulerPolicyConfigMapSource struct { - // Namespace is the namespace of the policy config map. - Namespace string `json:"namespace"` - // Name is the name of hte policy config map. - Name string `json:"name"` -} - -// SchedulerAlgorithmSource is the source of a scheduler algorithm. One source -// field must be specified, and source fields are mutually exclusive. -type SchedulerAlgorithmSource struct { - // Policy is a policy based algorithm source. - Policy *SchedulerPolicySource `json:"policy,omitempty"` - // Provider is the name of a scheduling algorithm provider to use. - Provider *string `json:"provider,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type KubeSchedulerConfiguration struct { - metav1.TypeMeta `json:",inline"` - - // DebuggingConfiguration holds profiling- and debugging-related fields - // TODO: DebuggingConfiguration is inlined because it's been like that earlier. - // We might consider making it a "real" sub-struct. - apiserverconfigv1alpha1.DebuggingConfiguration `json:",inline"` - - // SchedulerName is name of the scheduler, used to select which pods - // will be processed by this scheduler, based on pod's "spec.SchedulerName". - SchedulerName string `json:"schedulerName"` - // AlgorithmSource specifies the scheduler algorithm source. - AlgorithmSource SchedulerAlgorithmSource `json:"algorithmSource"` - // RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule - // corresponding to every RequiredDuringScheduling affinity rule. - // HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100. - HardPodAffinitySymmetricWeight int32 `json:"hardPodAffinitySymmetricWeight"` - - // LeaderElection defines the configuration of leader election client. - // TODO: Migrate the kube-scheduler-specific stuff into the generic LeaderElectionConfig? - LeaderElection KubeSchedulerLeaderElectionConfiguration `json:"leaderElection"` - - // ClientConnection specifies the kubeconfig file and client connection - // settings for the proxy server to use when communicating with the apiserver. - ClientConnection apimachineryconfigv1alpha1.ClientConnectionConfiguration `json:"clientConnection"` - // HealthzBindAddress is the IP address and port for the health check server to serve on, - // defaulting to 0.0.0.0:10251 - HealthzBindAddress string `json:"healthzBindAddress"` - // MetricsBindAddress is the IP address and port for the metrics server to - // serve on, defaulting to 0.0.0.0:10251. - MetricsBindAddress string `json:"metricsBindAddress"` - - // Indicate the "all topologies" set for empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity. - FailureDomains string `json:"failureDomains"` - - // DisablePreemption disables the pod preemption feature. - DisablePreemption bool `json:"disablePreemption"` - - // PercentageOfNodeToScore specifies what percentage of all nodes should be scored in each - // scheduling cycle. This helps improve scheduler's performance. Scheduler always tries to find - // at least "minFeasibleNodesToFind" feasible nodes no matter what the value of this flag is. - // When this value is below 100%, the scheduler stops finding feasible nodes for running a pod - // once it finds that percentage of feasible nodes of the whole cluster size. For example, if the - // cluster size is 500 nodes and the value of this flag is 30, then scheduler stops finding - // feasible nodes once it finds 150 feasible nodes. - // When the value is 0, default percentage (50%) of the nodes will be scored. - PercentageOfNodesToScore int32 `json:"percentageOfNodesToScore"` -} - -// KubeSchedulerLeaderElectionConfiguration expands LeaderElectionConfiguration -// to include scheduler specific configuration. -type KubeSchedulerLeaderElectionConfiguration struct { - apiserverconfigv1alpha1.LeaderElectionConfiguration `json:",inline"` - // LockObjectNamespace defines the namespace of the lock object - LockObjectNamespace string `json:"lockObjectNamespace"` - // LockObjectName defines the lock object name - LockObjectName string `json:"lockObjectName"` -} - type PersistentVolumeRecyclerConfiguration struct { // maximumRetry is number of retries the PV recycler will execute on failure to recycle // PV. @@ -523,13 +427,3 @@ type ServiceControllerConfiguration struct { // management, but more CPU (and network) load. ConcurrentServiceSyncs int32 } - -const ( - // "kube-system" is the default scheduler lock object namespace - SchedulerDefaultLockObjectNamespace string = "kube-system" - - // "kube-scheduler" is the default scheduler lock object name - SchedulerDefaultLockObjectName = "kube-scheduler" - - SchedulerDefaultProviderName = "DefaultProvider" -) diff --git a/pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go b/pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go index 9351cdd5e9..f6a42051ba 100644 --- a/pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go @@ -23,7 +23,6 @@ package v1alpha1 import ( unsafe "unsafe" - apisconfigv1alpha1 "k8s.io/apimachinery/pkg/apis/config/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" @@ -188,26 +187,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*KubeSchedulerConfiguration)(nil), (*componentconfig.KubeSchedulerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(a.(*KubeSchedulerConfiguration), b.(*componentconfig.KubeSchedulerConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*componentconfig.KubeSchedulerConfiguration)(nil), (*KubeSchedulerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(a.(*componentconfig.KubeSchedulerConfiguration), b.(*KubeSchedulerConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*KubeSchedulerLeaderElectionConfiguration)(nil), (*componentconfig.KubeSchedulerLeaderElectionConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_componentconfig_KubeSchedulerLeaderElectionConfiguration(a.(*KubeSchedulerLeaderElectionConfiguration), b.(*componentconfig.KubeSchedulerLeaderElectionConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*componentconfig.KubeSchedulerLeaderElectionConfiguration)(nil), (*KubeSchedulerLeaderElectionConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_componentconfig_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(a.(*componentconfig.KubeSchedulerLeaderElectionConfiguration), b.(*KubeSchedulerLeaderElectionConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*NamespaceControllerConfiguration)(nil), (*componentconfig.NamespaceControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_NamespaceControllerConfiguration_To_componentconfig_NamespaceControllerConfiguration(a.(*NamespaceControllerConfiguration), b.(*componentconfig.NamespaceControllerConfiguration), scope) }); err != nil { @@ -308,46 +287,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*SchedulerAlgorithmSource)(nil), (*componentconfig.SchedulerAlgorithmSource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource(a.(*SchedulerAlgorithmSource), b.(*componentconfig.SchedulerAlgorithmSource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*componentconfig.SchedulerAlgorithmSource)(nil), (*SchedulerAlgorithmSource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_componentconfig_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(a.(*componentconfig.SchedulerAlgorithmSource), b.(*SchedulerAlgorithmSource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SchedulerPolicyConfigMapSource)(nil), (*componentconfig.SchedulerPolicyConfigMapSource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_SchedulerPolicyConfigMapSource_To_componentconfig_SchedulerPolicyConfigMapSource(a.(*SchedulerPolicyConfigMapSource), b.(*componentconfig.SchedulerPolicyConfigMapSource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*componentconfig.SchedulerPolicyConfigMapSource)(nil), (*SchedulerPolicyConfigMapSource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_componentconfig_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource(a.(*componentconfig.SchedulerPolicyConfigMapSource), b.(*SchedulerPolicyConfigMapSource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SchedulerPolicyFileSource)(nil), (*componentconfig.SchedulerPolicyFileSource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_SchedulerPolicyFileSource_To_componentconfig_SchedulerPolicyFileSource(a.(*SchedulerPolicyFileSource), b.(*componentconfig.SchedulerPolicyFileSource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*componentconfig.SchedulerPolicyFileSource)(nil), (*SchedulerPolicyFileSource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_componentconfig_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource(a.(*componentconfig.SchedulerPolicyFileSource), b.(*SchedulerPolicyFileSource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SchedulerPolicySource)(nil), (*componentconfig.SchedulerPolicySource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_SchedulerPolicySource_To_componentconfig_SchedulerPolicySource(a.(*SchedulerPolicySource), b.(*componentconfig.SchedulerPolicySource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*componentconfig.SchedulerPolicySource)(nil), (*SchedulerPolicySource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(a.(*componentconfig.SchedulerPolicySource), b.(*SchedulerPolicySource), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ServiceControllerConfiguration)(nil), (*componentconfig.ServiceControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_ServiceControllerConfiguration_To_componentconfig_ServiceControllerConfiguration(a.(*ServiceControllerConfiguration), b.(*componentconfig.ServiceControllerConfiguration), scope) }); err != nil { @@ -917,90 +856,6 @@ func Convert_componentconfig_KubeControllerManagerConfiguration_To_v1alpha1_Kube return autoConvert_componentconfig_KubeControllerManagerConfiguration_To_v1alpha1_KubeControllerManagerConfiguration(in, out, s) } -func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration, out *componentconfig.KubeSchedulerConfiguration, s conversion.Scope) error { - if err := configv1alpha1.Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration(&in.DebuggingConfiguration, &out.DebuggingConfiguration, s); err != nil { - return err - } - out.SchedulerName = in.SchedulerName - if err := Convert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource(&in.AlgorithmSource, &out.AlgorithmSource, s); err != nil { - return err - } - out.HardPodAffinitySymmetricWeight = in.HardPodAffinitySymmetricWeight - if err := Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_componentconfig_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { - return err - } - if err := apisconfigv1alpha1.Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil { - return err - } - out.HealthzBindAddress = in.HealthzBindAddress - out.MetricsBindAddress = in.MetricsBindAddress - out.FailureDomains = in.FailureDomains - out.DisablePreemption = in.DisablePreemption - out.PercentageOfNodesToScore = in.PercentageOfNodesToScore - return nil -} - -// Convert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration is an autogenerated conversion function. -func Convert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration, out *componentconfig.KubeSchedulerConfiguration, s conversion.Scope) error { - return autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in, out, s) -} - -func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *componentconfig.KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, s conversion.Scope) error { - if err := configv1alpha1.Convert_config_DebuggingConfiguration_To_v1alpha1_DebuggingConfiguration(&in.DebuggingConfiguration, &out.DebuggingConfiguration, s); err != nil { - return err - } - out.SchedulerName = in.SchedulerName - if err := Convert_componentconfig_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(&in.AlgorithmSource, &out.AlgorithmSource, s); err != nil { - return err - } - out.HardPodAffinitySymmetricWeight = in.HardPodAffinitySymmetricWeight - if err := Convert_componentconfig_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { - return err - } - if err := apisconfigv1alpha1.Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil { - return err - } - out.HealthzBindAddress = in.HealthzBindAddress - out.MetricsBindAddress = in.MetricsBindAddress - out.FailureDomains = in.FailureDomains - out.DisablePreemption = in.DisablePreemption - out.PercentageOfNodesToScore = in.PercentageOfNodesToScore - return nil -} - -// Convert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration is an autogenerated conversion function. -func Convert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *componentconfig.KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, s conversion.Scope) error { - return autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in, out, s) -} - -func autoConvert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_componentconfig_KubeSchedulerLeaderElectionConfiguration(in *KubeSchedulerLeaderElectionConfiguration, out *componentconfig.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { - if err := configv1alpha1.Convert_v1alpha1_LeaderElectionConfiguration_To_config_LeaderElectionConfiguration(&in.LeaderElectionConfiguration, &out.LeaderElectionConfiguration, s); err != nil { - return err - } - out.LockObjectNamespace = in.LockObjectNamespace - out.LockObjectName = in.LockObjectName - return nil -} - -// Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_componentconfig_KubeSchedulerLeaderElectionConfiguration is an autogenerated conversion function. -func Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_componentconfig_KubeSchedulerLeaderElectionConfiguration(in *KubeSchedulerLeaderElectionConfiguration, out *componentconfig.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { - return autoConvert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_componentconfig_KubeSchedulerLeaderElectionConfiguration(in, out, s) -} - -func autoConvert_componentconfig_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in *componentconfig.KubeSchedulerLeaderElectionConfiguration, out *KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { - if err := configv1alpha1.Convert_config_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElectionConfiguration, &out.LeaderElectionConfiguration, s); err != nil { - return err - } - out.LockObjectNamespace = in.LockObjectNamespace - out.LockObjectName = in.LockObjectName - return nil -} - -// Convert_componentconfig_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration is an autogenerated conversion function. -func Convert_componentconfig_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in *componentconfig.KubeSchedulerLeaderElectionConfiguration, out *KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { - return autoConvert_componentconfig_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in, out, s) -} - func autoConvert_v1alpha1_NamespaceControllerConfiguration_To_componentconfig_NamespaceControllerConfiguration(in *NamespaceControllerConfiguration, out *componentconfig.NamespaceControllerConfiguration, s conversion.Scope) error { out.NamespaceSyncPeriod = in.NamespaceSyncPeriod out.ConcurrentNamespaceSyncs = in.ConcurrentNamespaceSyncs @@ -1247,92 +1102,6 @@ func Convert_componentconfig_SAControllerConfiguration_To_v1alpha1_SAControllerC return autoConvert_componentconfig_SAControllerConfiguration_To_v1alpha1_SAControllerConfiguration(in, out, s) } -func autoConvert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource(in *SchedulerAlgorithmSource, out *componentconfig.SchedulerAlgorithmSource, s conversion.Scope) error { - out.Policy = (*componentconfig.SchedulerPolicySource)(unsafe.Pointer(in.Policy)) - out.Provider = (*string)(unsafe.Pointer(in.Provider)) - return nil -} - -// Convert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource is an autogenerated conversion function. -func Convert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource(in *SchedulerAlgorithmSource, out *componentconfig.SchedulerAlgorithmSource, s conversion.Scope) error { - return autoConvert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource(in, out, s) -} - -func autoConvert_componentconfig_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(in *componentconfig.SchedulerAlgorithmSource, out *SchedulerAlgorithmSource, s conversion.Scope) error { - out.Policy = (*SchedulerPolicySource)(unsafe.Pointer(in.Policy)) - out.Provider = (*string)(unsafe.Pointer(in.Provider)) - return nil -} - -// Convert_componentconfig_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource is an autogenerated conversion function. -func Convert_componentconfig_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(in *componentconfig.SchedulerAlgorithmSource, out *SchedulerAlgorithmSource, s conversion.Scope) error { - return autoConvert_componentconfig_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(in, out, s) -} - -func autoConvert_v1alpha1_SchedulerPolicyConfigMapSource_To_componentconfig_SchedulerPolicyConfigMapSource(in *SchedulerPolicyConfigMapSource, out *componentconfig.SchedulerPolicyConfigMapSource, s conversion.Scope) error { - out.Namespace = in.Namespace - out.Name = in.Name - return nil -} - -// Convert_v1alpha1_SchedulerPolicyConfigMapSource_To_componentconfig_SchedulerPolicyConfigMapSource is an autogenerated conversion function. -func Convert_v1alpha1_SchedulerPolicyConfigMapSource_To_componentconfig_SchedulerPolicyConfigMapSource(in *SchedulerPolicyConfigMapSource, out *componentconfig.SchedulerPolicyConfigMapSource, s conversion.Scope) error { - return autoConvert_v1alpha1_SchedulerPolicyConfigMapSource_To_componentconfig_SchedulerPolicyConfigMapSource(in, out, s) -} - -func autoConvert_componentconfig_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource(in *componentconfig.SchedulerPolicyConfigMapSource, out *SchedulerPolicyConfigMapSource, s conversion.Scope) error { - out.Namespace = in.Namespace - out.Name = in.Name - return nil -} - -// Convert_componentconfig_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource is an autogenerated conversion function. -func Convert_componentconfig_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource(in *componentconfig.SchedulerPolicyConfigMapSource, out *SchedulerPolicyConfigMapSource, s conversion.Scope) error { - return autoConvert_componentconfig_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource(in, out, s) -} - -func autoConvert_v1alpha1_SchedulerPolicyFileSource_To_componentconfig_SchedulerPolicyFileSource(in *SchedulerPolicyFileSource, out *componentconfig.SchedulerPolicyFileSource, s conversion.Scope) error { - out.Path = in.Path - return nil -} - -// Convert_v1alpha1_SchedulerPolicyFileSource_To_componentconfig_SchedulerPolicyFileSource is an autogenerated conversion function. -func Convert_v1alpha1_SchedulerPolicyFileSource_To_componentconfig_SchedulerPolicyFileSource(in *SchedulerPolicyFileSource, out *componentconfig.SchedulerPolicyFileSource, s conversion.Scope) error { - return autoConvert_v1alpha1_SchedulerPolicyFileSource_To_componentconfig_SchedulerPolicyFileSource(in, out, s) -} - -func autoConvert_componentconfig_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource(in *componentconfig.SchedulerPolicyFileSource, out *SchedulerPolicyFileSource, s conversion.Scope) error { - out.Path = in.Path - return nil -} - -// Convert_componentconfig_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource is an autogenerated conversion function. -func Convert_componentconfig_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource(in *componentconfig.SchedulerPolicyFileSource, out *SchedulerPolicyFileSource, s conversion.Scope) error { - return autoConvert_componentconfig_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource(in, out, s) -} - -func autoConvert_v1alpha1_SchedulerPolicySource_To_componentconfig_SchedulerPolicySource(in *SchedulerPolicySource, out *componentconfig.SchedulerPolicySource, s conversion.Scope) error { - out.File = (*componentconfig.SchedulerPolicyFileSource)(unsafe.Pointer(in.File)) - out.ConfigMap = (*componentconfig.SchedulerPolicyConfigMapSource)(unsafe.Pointer(in.ConfigMap)) - return nil -} - -// Convert_v1alpha1_SchedulerPolicySource_To_componentconfig_SchedulerPolicySource is an autogenerated conversion function. -func Convert_v1alpha1_SchedulerPolicySource_To_componentconfig_SchedulerPolicySource(in *SchedulerPolicySource, out *componentconfig.SchedulerPolicySource, s conversion.Scope) error { - return autoConvert_v1alpha1_SchedulerPolicySource_To_componentconfig_SchedulerPolicySource(in, out, s) -} - -func autoConvert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(in *componentconfig.SchedulerPolicySource, out *SchedulerPolicySource, s conversion.Scope) error { - out.File = (*SchedulerPolicyFileSource)(unsafe.Pointer(in.File)) - out.ConfigMap = (*SchedulerPolicyConfigMapSource)(unsafe.Pointer(in.ConfigMap)) - return nil -} - -// Convert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource is an autogenerated conversion function. -func Convert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(in *componentconfig.SchedulerPolicySource, out *SchedulerPolicySource, s conversion.Scope) error { - return autoConvert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(in, out, s) -} - func autoConvert_v1alpha1_ServiceControllerConfiguration_To_componentconfig_ServiceControllerConfiguration(in *ServiceControllerConfiguration, out *componentconfig.ServiceControllerConfiguration, s conversion.Scope) error { out.ConcurrentServiceSyncs = in.ConcurrentServiceSyncs return nil diff --git a/pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go index df80122dfd..b548bdf2e2 100644 --- a/pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go @@ -348,52 +348,6 @@ func (in *KubeControllerManagerConfiguration) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubeSchedulerConfiguration) DeepCopyInto(out *KubeSchedulerConfiguration) { - *out = *in - out.TypeMeta = in.TypeMeta - out.DebuggingConfiguration = in.DebuggingConfiguration - in.AlgorithmSource.DeepCopyInto(&out.AlgorithmSource) - in.LeaderElection.DeepCopyInto(&out.LeaderElection) - out.ClientConnection = in.ClientConnection - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerConfiguration. -func (in *KubeSchedulerConfiguration) DeepCopy() *KubeSchedulerConfiguration { - if in == nil { - return nil - } - out := new(KubeSchedulerConfiguration) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KubeSchedulerConfiguration) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopyInto(out *KubeSchedulerLeaderElectionConfiguration) { - *out = *in - in.LeaderElectionConfiguration.DeepCopyInto(&out.LeaderElectionConfiguration) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerLeaderElectionConfiguration. -func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopy() *KubeSchedulerLeaderElectionConfiguration { - if in == nil { - return nil - } - out := new(KubeSchedulerLeaderElectionConfiguration) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NamespaceControllerConfiguration) DeepCopyInto(out *NamespaceControllerConfiguration) { *out = *in @@ -566,90 +520,6 @@ func (in *SAControllerConfiguration) DeepCopy() *SAControllerConfiguration { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SchedulerAlgorithmSource) DeepCopyInto(out *SchedulerAlgorithmSource) { - *out = *in - if in.Policy != nil { - in, out := &in.Policy, &out.Policy - *out = new(SchedulerPolicySource) - (*in).DeepCopyInto(*out) - } - if in.Provider != nil { - in, out := &in.Provider, &out.Provider - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerAlgorithmSource. -func (in *SchedulerAlgorithmSource) DeepCopy() *SchedulerAlgorithmSource { - if in == nil { - return nil - } - out := new(SchedulerAlgorithmSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SchedulerPolicyConfigMapSource) DeepCopyInto(out *SchedulerPolicyConfigMapSource) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicyConfigMapSource. -func (in *SchedulerPolicyConfigMapSource) DeepCopy() *SchedulerPolicyConfigMapSource { - if in == nil { - return nil - } - out := new(SchedulerPolicyConfigMapSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SchedulerPolicyFileSource) DeepCopyInto(out *SchedulerPolicyFileSource) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicyFileSource. -func (in *SchedulerPolicyFileSource) DeepCopy() *SchedulerPolicyFileSource { - if in == nil { - return nil - } - out := new(SchedulerPolicyFileSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SchedulerPolicySource) DeepCopyInto(out *SchedulerPolicySource) { - *out = *in - if in.File != nil { - in, out := &in.File, &out.File - *out = new(SchedulerPolicyFileSource) - **out = **in - } - if in.ConfigMap != nil { - in, out := &in.ConfigMap, &out.ConfigMap - *out = new(SchedulerPolicyConfigMapSource) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicySource. -func (in *SchedulerPolicySource) DeepCopy() *SchedulerPolicySource { - if in == nil { - return nil - } - out := new(SchedulerPolicySource) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceControllerConfiguration) DeepCopyInto(out *ServiceControllerConfiguration) { *out = *in diff --git a/pkg/apis/componentconfig/v1alpha1/zz_generated.defaults.go b/pkg/apis/componentconfig/v1alpha1/zz_generated.defaults.go index cabddaab76..fa83200e47 100644 --- a/pkg/apis/componentconfig/v1alpha1/zz_generated.defaults.go +++ b/pkg/apis/componentconfig/v1alpha1/zz_generated.defaults.go @@ -34,7 +34,6 @@ func RegisterDefaults(scheme *runtime.Scheme) error { scheme.AddTypeDefaultingFunc(&KubeControllerManagerConfiguration{}, func(obj interface{}) { SetObjectDefaults_KubeControllerManagerConfiguration(obj.(*KubeControllerManagerConfiguration)) }) - scheme.AddTypeDefaultingFunc(&KubeSchedulerConfiguration{}, func(obj interface{}) { SetObjectDefaults_KubeSchedulerConfiguration(obj.(*KubeSchedulerConfiguration)) }) return nil } @@ -51,7 +50,3 @@ func SetObjectDefaults_KubeControllerManagerConfiguration(in *KubeControllerMana SetDefaults_VolumeConfiguration(&in.PersistentVolumeBinderController.VolumeConfiguration) SetDefaults_PersistentVolumeRecyclerConfiguration(&in.PersistentVolumeBinderController.VolumeConfiguration.PersistentVolumeRecyclerConfiguration) } - -func SetObjectDefaults_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration) { - SetDefaults_KubeSchedulerConfiguration(in) -} diff --git a/pkg/apis/componentconfig/zz_generated.deepcopy.go b/pkg/apis/componentconfig/zz_generated.deepcopy.go index 46f35c4e1d..9fdb0a2f08 100644 --- a/pkg/apis/componentconfig/zz_generated.deepcopy.go +++ b/pkg/apis/componentconfig/zz_generated.deepcopy.go @@ -375,52 +375,6 @@ func (in *KubeControllerManagerConfiguration) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubeSchedulerConfiguration) DeepCopyInto(out *KubeSchedulerConfiguration) { - *out = *in - out.TypeMeta = in.TypeMeta - out.DebuggingConfiguration = in.DebuggingConfiguration - in.AlgorithmSource.DeepCopyInto(&out.AlgorithmSource) - out.LeaderElection = in.LeaderElection - out.ClientConnection = in.ClientConnection - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerConfiguration. -func (in *KubeSchedulerConfiguration) DeepCopy() *KubeSchedulerConfiguration { - if in == nil { - return nil - } - out := new(KubeSchedulerConfiguration) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KubeSchedulerConfiguration) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopyInto(out *KubeSchedulerLeaderElectionConfiguration) { - *out = *in - out.LeaderElectionConfiguration = in.LeaderElectionConfiguration - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerLeaderElectionConfiguration. -func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopy() *KubeSchedulerLeaderElectionConfiguration { - if in == nil { - return nil - } - out := new(KubeSchedulerLeaderElectionConfiguration) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NamespaceControllerConfiguration) DeepCopyInto(out *NamespaceControllerConfiguration) { *out = *in @@ -609,90 +563,6 @@ func (in *SAControllerConfiguration) DeepCopy() *SAControllerConfiguration { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SchedulerAlgorithmSource) DeepCopyInto(out *SchedulerAlgorithmSource) { - *out = *in - if in.Policy != nil { - in, out := &in.Policy, &out.Policy - *out = new(SchedulerPolicySource) - (*in).DeepCopyInto(*out) - } - if in.Provider != nil { - in, out := &in.Provider, &out.Provider - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerAlgorithmSource. -func (in *SchedulerAlgorithmSource) DeepCopy() *SchedulerAlgorithmSource { - if in == nil { - return nil - } - out := new(SchedulerAlgorithmSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SchedulerPolicyConfigMapSource) DeepCopyInto(out *SchedulerPolicyConfigMapSource) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicyConfigMapSource. -func (in *SchedulerPolicyConfigMapSource) DeepCopy() *SchedulerPolicyConfigMapSource { - if in == nil { - return nil - } - out := new(SchedulerPolicyConfigMapSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SchedulerPolicyFileSource) DeepCopyInto(out *SchedulerPolicyFileSource) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicyFileSource. -func (in *SchedulerPolicyFileSource) DeepCopy() *SchedulerPolicyFileSource { - if in == nil { - return nil - } - out := new(SchedulerPolicyFileSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SchedulerPolicySource) DeepCopyInto(out *SchedulerPolicySource) { - *out = *in - if in.File != nil { - in, out := &in.File, &out.File - *out = new(SchedulerPolicyFileSource) - **out = **in - } - if in.ConfigMap != nil { - in, out := &in.ConfigMap, &out.ConfigMap - *out = new(SchedulerPolicyConfigMapSource) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicySource. -func (in *SchedulerPolicySource) DeepCopy() *SchedulerPolicySource { - if in == nil { - return nil - } - out := new(SchedulerPolicySource) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceControllerConfiguration) DeepCopyInto(out *ServiceControllerConfiguration) { *out = *in diff --git a/pkg/scheduler/BUILD b/pkg/scheduler/BUILD index f6f12525b2..db13be0d1a 100644 --- a/pkg/scheduler/BUILD +++ b/pkg/scheduler/BUILD @@ -77,6 +77,7 @@ filegroup( "//pkg/scheduler/algorithm:all-srcs", "//pkg/scheduler/algorithmprovider:all-srcs", "//pkg/scheduler/api:all-srcs", + "//pkg/scheduler/apis/config:all-srcs", "//pkg/scheduler/cache:all-srcs", "//pkg/scheduler/core:all-srcs", "//pkg/scheduler/factory:all-srcs", diff --git a/pkg/scheduler/apis/config/BUILD b/pkg/scheduler/apis/config/BUILD new file mode 100644 index 0000000000..cfeee9de9d --- /dev/null +++ b/pkg/scheduler/apis/config/BUILD @@ -0,0 +1,38 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "register.go", + "types.go", + "zz_generated.deepcopy.go", + ], + importpath = "k8s.io/kubernetes/pkg/scheduler/apis/config", + visibility = ["//visibility:public"], + deps = [ + "//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//staging/src/k8s.io/apiserver/pkg/apis/config:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [ + ":package-srcs", + "//pkg/scheduler/apis/config/scheme:all-srcs", + "//pkg/scheduler/apis/config/v1alpha1:all-srcs", + ], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/scheduler/apis/config/OWNERS b/pkg/scheduler/apis/config/OWNERS new file mode 100755 index 0000000000..1efb6b4a64 --- /dev/null +++ b/pkg/scheduler/apis/config/OWNERS @@ -0,0 +1,11 @@ +approvers: +- api-approvers +- sig-scheduling-maintainers +- sttts +- luxas +reviewers: +- sig-scheduling +- api-reviewers +- dixudx +- luxas +- sttts diff --git a/pkg/scheduler/apis/config/doc.go b/pkg/scheduler/apis/config/doc.go new file mode 100644 index 0000000000..3f8e379d13 --- /dev/null +++ b/pkg/scheduler/apis/config/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package + +package config // import "k8s.io/kubernetes/pkg/scheduler/apis/config" diff --git a/pkg/scheduler/apis/config/register.go b/pkg/scheduler/apis/config/register.go new file mode 100644 index 0000000000..b697315e2f --- /dev/null +++ b/pkg/scheduler/apis/config/register.go @@ -0,0 +1,43 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // SchemeBuilder the schema builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme handler to add items to the schema + AddToScheme = SchemeBuilder.AddToScheme +) + +// GroupName is the group name use in this package +const GroupName = "kubescheduler.config.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &KubeSchedulerConfiguration{}, + ) + return nil +} diff --git a/pkg/scheduler/apis/config/scheme/BUILD b/pkg/scheduler/apis/config/scheme/BUILD new file mode 100644 index 0000000000..77664506c0 --- /dev/null +++ b/pkg/scheduler/apis/config/scheme/BUILD @@ -0,0 +1,29 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["scheme.go"], + importpath = "k8s.io/kubernetes/pkg/scheduler/apis/config/scheme", + visibility = ["//visibility:public"], + deps = [ + "//pkg/scheduler/apis/config:go_default_library", + "//pkg/scheduler/apis/config/v1alpha1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/scheduler/apis/config/scheme/scheme.go b/pkg/scheduler/apis/config/scheme/scheme.go new file mode 100644 index 0000000000..69aac55d38 --- /dev/null +++ b/pkg/scheduler/apis/config/scheme/scheme.go @@ -0,0 +1,44 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package scheme + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" + kubeschedulerconfigv1alpha1 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1alpha1" +) + +var ( + // Scheme is the runtime.Scheme to which all kubescheduler api types are registered. + Scheme = runtime.NewScheme() + + // Codecs provides access to encoding and decoding for the scheme. + Codecs = serializer.NewCodecFactory(Scheme) +) + +func init() { + AddToScheme(Scheme) +} + +// AddToScheme builds the kubescheduler scheme using all known versions of the kubescheduler api. +func AddToScheme(scheme *runtime.Scheme) { + utilruntime.Must(kubeschedulerconfig.AddToScheme(Scheme)) + utilruntime.Must(kubeschedulerconfigv1alpha1.AddToScheme(Scheme)) + utilruntime.Must(scheme.SetVersionPriority(kubeschedulerconfigv1alpha1.SchemeGroupVersion)) +} diff --git a/pkg/scheduler/apis/config/types.go b/pkg/scheduler/apis/config/types.go new file mode 100644 index 0000000000..6d9f4c5b40 --- /dev/null +++ b/pkg/scheduler/apis/config/types.go @@ -0,0 +1,132 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import ( + apimachineryconfig "k8s.io/apimachinery/pkg/apis/config" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + apiserverconfig "k8s.io/apiserver/pkg/apis/config" +) + +const ( + // SchedulerDefaultLockObjectNamespace defines default scheduler lock object namespace ("kube-system") + SchedulerDefaultLockObjectNamespace string = metav1.NamespaceSystem + + // SchedulerDefaultLockObjectName defines default scheduler lock object name ("kube-scheduler") + SchedulerDefaultLockObjectName = "kube-scheduler" + + // SchedulerPolicyConfigMapKey defines the key of the element in the + // scheduler's policy ConfigMap that contains scheduler's policy config. + SchedulerPolicyConfigMapKey = "policy.cfg" + + // SchedulerDefaultProviderName defines the default provider names + SchedulerDefaultProviderName = "DefaultProvider" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// KubeSchedulerConfiguration configures a scheduler +type KubeSchedulerConfiguration struct { + metav1.TypeMeta + + // SchedulerName is name of the scheduler, used to select which pods + // will be processed by this scheduler, based on pod's "spec.SchedulerName". + SchedulerName string + // AlgorithmSource specifies the scheduler algorithm source. + AlgorithmSource SchedulerAlgorithmSource + // RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule + // corresponding to every RequiredDuringScheduling affinity rule. + // HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100. + HardPodAffinitySymmetricWeight int32 + + // LeaderElection defines the configuration of leader election client. + LeaderElection KubeSchedulerLeaderElectionConfiguration + + // ClientConnection specifies the kubeconfig file and client connection + // settings for the proxy server to use when communicating with the apiserver. + ClientConnection apimachineryconfig.ClientConnectionConfiguration + // HealthzBindAddress is the IP address and port for the health check server to serve on, + // defaulting to 0.0.0.0:10251 + HealthzBindAddress string + // MetricsBindAddress is the IP address and port for the metrics server to + // serve on, defaulting to 0.0.0.0:10251. + MetricsBindAddress string + + // DebuggingConfiguration holds configuration for Debugging related features + // TODO: We might wanna make this a substruct like Debugging apiserverconfig.DebuggingConfiguration + apiserverconfig.DebuggingConfiguration + + // DisablePreemption disables the pod preemption feature. + DisablePreemption bool + + // PercentageOfNodeToScore is the percentage of all nodes that once found feasible + // for running a pod, the scheduler stops its search for more feasible nodes in + // the cluster. This helps improve scheduler's performance. Scheduler always tries to find + // at least "minFeasibleNodesToFind" feasible nodes no matter what the value of this flag is. + // Example: if the cluster size is 500 nodes and the value of this flag is 30, + // then scheduler stops finding further feasible nodes once it finds 150 feasible ones. + // When the value is 0, default percentage (50%) of the nodes will be scored. + PercentageOfNodesToScore int32 + + // DEPRECATED. + // Indicate the "all topologies" set for empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity. + FailureDomains string +} + +// SchedulerAlgorithmSource is the source of a scheduler algorithm. One source +// field must be specified, and source fields are mutually exclusive. +type SchedulerAlgorithmSource struct { + // Policy is a policy based algorithm source. + Policy *SchedulerPolicySource + // Provider is the name of a scheduling algorithm provider to use. + Provider *string +} + +// SchedulerPolicySource configures a means to obtain a scheduler Policy. One +// source field must be specified, and source fields are mutually exclusive. +type SchedulerPolicySource struct { + // File is a file policy source. + File *SchedulerPolicyFileSource + // ConfigMap is a config map policy source. + ConfigMap *SchedulerPolicyConfigMapSource +} + +// SchedulerPolicyFileSource is a policy serialized to disk and accessed via +// path. +type SchedulerPolicyFileSource struct { + // Path is the location of a serialized policy. + Path string +} + +// SchedulerPolicyConfigMapSource is a policy serialized into a config map value +// under the SchedulerPolicyConfigMapKey key. +type SchedulerPolicyConfigMapSource struct { + // Namespace is the namespace of the policy config map. + Namespace string + // Name is the name of hte policy config map. + Name string +} + +// KubeSchedulerLeaderElectionConfiguration expands LeaderElectionConfiguration +// to include scheduler specific configuration. +type KubeSchedulerLeaderElectionConfiguration struct { + apiserverconfig.LeaderElectionConfiguration + // LockObjectNamespace defines the namespace of the lock object + LockObjectNamespace string + // LockObjectName defines the lock object name + LockObjectName string +} diff --git a/pkg/scheduler/apis/config/v1alpha1/BUILD b/pkg/scheduler/apis/config/v1alpha1/BUILD new file mode 100644 index 0000000000..7bf49bb794 --- /dev/null +++ b/pkg/scheduler/apis/config/v1alpha1/BUILD @@ -0,0 +1,53 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "go_default_library", + srcs = [ + "defaults.go", + "doc.go", + "register.go", + "zz_generated.conversion.go", + "zz_generated.deepcopy.go", + "zz_generated.defaults.go", + ], + importpath = "k8s.io/kubernetes/pkg/scheduler/apis/config/v1alpha1", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/core:go_default_library", + "//pkg/kubelet/apis:go_default_library", + "//pkg/master/ports:go_default_library", + "//pkg/scheduler/apis/config:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//staging/src/k8s.io/apiserver/pkg/apis/config/v1alpha1:go_default_library", + "//staging/src/k8s.io/kube-scheduler/config/v1alpha1:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = ["defaults_test.go"], + embed = [":go_default_library"], + deps = [ + "//staging/src/k8s.io/api/core/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//staging/src/k8s.io/kube-scheduler/config/v1alpha1:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/scheduler/apis/config/v1alpha1/defaults.go b/pkg/scheduler/apis/config/v1alpha1/defaults.go new file mode 100644 index 0000000000..b63a2a1704 --- /dev/null +++ b/pkg/scheduler/apis/config/v1alpha1/defaults.go @@ -0,0 +1,105 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "net" + "strconv" + + "k8s.io/apimachinery/pkg/runtime" + apiserverconfigv1alpha1 "k8s.io/apiserver/pkg/apis/config/v1alpha1" + kubescedulerconfigv1alpha1 "k8s.io/kube-scheduler/config/v1alpha1" + // this package shouldn't really depend on other k8s.io/kubernetes code + api "k8s.io/kubernetes/pkg/apis/core" + kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" + "k8s.io/kubernetes/pkg/master/ports" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_KubeSchedulerConfiguration sets additional defaults +func SetDefaults_KubeSchedulerConfiguration(obj *kubescedulerconfigv1alpha1.KubeSchedulerConfiguration) { + if len(obj.SchedulerName) == 0 { + obj.SchedulerName = api.DefaultSchedulerName + } + + if obj.HardPodAffinitySymmetricWeight == 0 { + obj.HardPodAffinitySymmetricWeight = api.DefaultHardPodAffinitySymmetricWeight + } + + if obj.AlgorithmSource.Policy == nil && + (obj.AlgorithmSource.Provider == nil || len(*obj.AlgorithmSource.Provider) == 0) { + val := kubescedulerconfigv1alpha1.SchedulerDefaultProviderName + obj.AlgorithmSource.Provider = &val + } + + if policy := obj.AlgorithmSource.Policy; policy != nil { + if policy.ConfigMap != nil && len(policy.ConfigMap.Namespace) == 0 { + obj.AlgorithmSource.Policy.ConfigMap.Namespace = api.NamespaceSystem + } + } + + if host, port, err := net.SplitHostPort(obj.HealthzBindAddress); err == nil { + if len(host) == 0 { + host = "0.0.0.0" + } + obj.HealthzBindAddress = net.JoinHostPort(host, port) + } else { + obj.HealthzBindAddress = net.JoinHostPort("0.0.0.0", strconv.Itoa(ports.SchedulerPort)) + } + + if host, port, err := net.SplitHostPort(obj.MetricsBindAddress); err == nil { + if len(host) == 0 { + host = "0.0.0.0" + } + obj.MetricsBindAddress = net.JoinHostPort(host, port) + } else { + obj.MetricsBindAddress = net.JoinHostPort("0.0.0.0", strconv.Itoa(ports.SchedulerPort)) + } + + if len(obj.LeaderElection.LockObjectNamespace) == 0 { + obj.LeaderElection.LockObjectNamespace = kubescedulerconfigv1alpha1.SchedulerDefaultLockObjectNamespace + } + if len(obj.LeaderElection.LockObjectName) == 0 { + obj.LeaderElection.LockObjectName = kubescedulerconfigv1alpha1.SchedulerDefaultLockObjectName + } + + if obj.PercentageOfNodesToScore == 0 { + // by default, stop finding feasible nodes once the number of feasible nodes is 50% of the cluster. + obj.PercentageOfNodesToScore = 50 + } + + if len(obj.FailureDomains) == 0 { + obj.FailureDomains = kubeletapis.DefaultFailureDomains + } + + if len(obj.ClientConnection.ContentType) == 0 { + obj.ClientConnection.ContentType = "application/vnd.kubernetes.protobuf" + } + // Scheduler has an opinion about QPS/Burst, setting specific defaults for itself, instead of generic settings. + if obj.ClientConnection.QPS == 0.0 { + obj.ClientConnection.QPS = 50.0 + } + if obj.ClientConnection.Burst == 0 { + obj.ClientConnection.Burst = 100 + } + + // Use the default LeaderElectionConfiguration options + apiserverconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection.LeaderElectionConfiguration) +} diff --git a/pkg/scheduler/apis/config/v1alpha1/defaults_test.go b/pkg/scheduler/apis/config/v1alpha1/defaults_test.go new file mode 100644 index 0000000000..9e55f464f3 --- /dev/null +++ b/pkg/scheduler/apis/config/v1alpha1/defaults_test.go @@ -0,0 +1,64 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "encoding/json" + "reflect" + "testing" + + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + kubeschedulerconfigv1alpha1 "k8s.io/kube-scheduler/config/v1alpha1" +) + +func TestSchedulerDefaults(t *testing.T) { + ks1 := &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{} + SetDefaults_KubeSchedulerConfiguration(ks1) + cm, err := convertObjToConfigMap("KubeSchedulerConfiguration", ks1) + if err != nil { + t.Errorf("unexpected ConvertObjToConfigMap error %v", err) + } + + ks2 := &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{} + if err = json.Unmarshal([]byte(cm.Data["KubeSchedulerConfiguration"]), ks2); err != nil { + t.Errorf("unexpected error unserializing scheduler config %v", err) + } + + if !reflect.DeepEqual(ks2, ks1) { + t.Errorf("Expected:\n%#v\n\nGot:\n%#v", ks1, ks2) + } +} + +// ConvertObjToConfigMap converts an object to a ConfigMap. +// This is specifically meant for ComponentConfigs. +func convertObjToConfigMap(name string, obj runtime.Object) (*v1.ConfigMap, error) { + eJSONBytes, err := json.Marshal(obj) + if err != nil { + return nil, err + } + cm := &v1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Data: map[string]string{ + name: string(eJSONBytes[:]), + }, + } + return cm, nil +} diff --git a/pkg/scheduler/apis/config/v1alpha1/doc.go b/pkg/scheduler/apis/config/v1alpha1/doc.go new file mode 100644 index 0000000000..6fe59990c4 --- /dev/null +++ b/pkg/scheduler/apis/config/v1alpha1/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=k8s.io/kubernetes/pkg/scheduler/apis/config +// +k8s:conversion-gen-external-types=k8s.io/kube-scheduler/config/v1alpha1 +// +k8s:defaulter-gen=TypeMeta +// +k8s:defaulter-gen-input=../../../../../vendor/k8s.io/kube-scheduler/config/v1alpha1 + +package v1alpha1 // import "k8s.io/kubernetes/pkg/scheduler/apis/config/v1alpha1" diff --git a/pkg/scheduler/apis/config/v1alpha1/register.go b/pkg/scheduler/apis/config/v1alpha1/register.go new file mode 100644 index 0000000000..406d4fb60d --- /dev/null +++ b/pkg/scheduler/apis/config/v1alpha1/register.go @@ -0,0 +1,40 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + kubeschedulerconfigv1alpha1 "k8s.io/kube-scheduler/config/v1alpha1" +) + +// GroupName is the group name use in this package +const GroupName = "kubescheduler.config.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +var ( + localSchemeBuilder = &kubeschedulerconfigv1alpha1.SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addDefaultingFuncs) +} diff --git a/pkg/scheduler/apis/config/v1alpha1/zz_generated.conversion.go b/pkg/scheduler/apis/config/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000000..3c7b420d94 --- /dev/null +++ b/pkg/scheduler/apis/config/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,272 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + configv1alpha1 "k8s.io/apimachinery/pkg/apis/config/v1alpha1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apisconfigv1alpha1 "k8s.io/apiserver/pkg/apis/config/v1alpha1" + v1alpha1 "k8s.io/kube-scheduler/config/v1alpha1" + config "k8s.io/kubernetes/pkg/scheduler/apis/config" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*v1alpha1.KubeSchedulerConfiguration)(nil), (*config.KubeSchedulerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(a.(*v1alpha1.KubeSchedulerConfiguration), b.(*config.KubeSchedulerConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.KubeSchedulerConfiguration)(nil), (*v1alpha1.KubeSchedulerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(a.(*config.KubeSchedulerConfiguration), b.(*v1alpha1.KubeSchedulerConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha1.KubeSchedulerLeaderElectionConfiguration)(nil), (*config.KubeSchedulerLeaderElectionConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(a.(*v1alpha1.KubeSchedulerLeaderElectionConfiguration), b.(*config.KubeSchedulerLeaderElectionConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.KubeSchedulerLeaderElectionConfiguration)(nil), (*v1alpha1.KubeSchedulerLeaderElectionConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(a.(*config.KubeSchedulerLeaderElectionConfiguration), b.(*v1alpha1.KubeSchedulerLeaderElectionConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha1.SchedulerAlgorithmSource)(nil), (*config.SchedulerAlgorithmSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SchedulerAlgorithmSource_To_config_SchedulerAlgorithmSource(a.(*v1alpha1.SchedulerAlgorithmSource), b.(*config.SchedulerAlgorithmSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.SchedulerAlgorithmSource)(nil), (*v1alpha1.SchedulerAlgorithmSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(a.(*config.SchedulerAlgorithmSource), b.(*v1alpha1.SchedulerAlgorithmSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha1.SchedulerPolicyConfigMapSource)(nil), (*config.SchedulerPolicyConfigMapSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SchedulerPolicyConfigMapSource_To_config_SchedulerPolicyConfigMapSource(a.(*v1alpha1.SchedulerPolicyConfigMapSource), b.(*config.SchedulerPolicyConfigMapSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.SchedulerPolicyConfigMapSource)(nil), (*v1alpha1.SchedulerPolicyConfigMapSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource(a.(*config.SchedulerPolicyConfigMapSource), b.(*v1alpha1.SchedulerPolicyConfigMapSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha1.SchedulerPolicyFileSource)(nil), (*config.SchedulerPolicyFileSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SchedulerPolicyFileSource_To_config_SchedulerPolicyFileSource(a.(*v1alpha1.SchedulerPolicyFileSource), b.(*config.SchedulerPolicyFileSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.SchedulerPolicyFileSource)(nil), (*v1alpha1.SchedulerPolicyFileSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource(a.(*config.SchedulerPolicyFileSource), b.(*v1alpha1.SchedulerPolicyFileSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha1.SchedulerPolicySource)(nil), (*config.SchedulerPolicySource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SchedulerPolicySource_To_config_SchedulerPolicySource(a.(*v1alpha1.SchedulerPolicySource), b.(*config.SchedulerPolicySource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.SchedulerPolicySource)(nil), (*v1alpha1.SchedulerPolicySource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(a.(*config.SchedulerPolicySource), b.(*v1alpha1.SchedulerPolicySource), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in *v1alpha1.KubeSchedulerConfiguration, out *config.KubeSchedulerConfiguration, s conversion.Scope) error { + out.SchedulerName = in.SchedulerName + if err := Convert_v1alpha1_SchedulerAlgorithmSource_To_config_SchedulerAlgorithmSource(&in.AlgorithmSource, &out.AlgorithmSource, s); err != nil { + return err + } + out.HardPodAffinitySymmetricWeight = in.HardPodAffinitySymmetricWeight + if err := Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { + return err + } + if err := configv1alpha1.Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil { + return err + } + out.HealthzBindAddress = in.HealthzBindAddress + out.MetricsBindAddress = in.MetricsBindAddress + if err := apisconfigv1alpha1.Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration(&in.DebuggingConfiguration, &out.DebuggingConfiguration, s); err != nil { + return err + } + out.DisablePreemption = in.DisablePreemption + out.PercentageOfNodesToScore = in.PercentageOfNodesToScore + out.FailureDomains = in.FailureDomains + return nil +} + +// Convert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in *v1alpha1.KubeSchedulerConfiguration, out *config.KubeSchedulerConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in, out, s) +} + +func autoConvert_config_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *config.KubeSchedulerConfiguration, out *v1alpha1.KubeSchedulerConfiguration, s conversion.Scope) error { + out.SchedulerName = in.SchedulerName + if err := Convert_config_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(&in.AlgorithmSource, &out.AlgorithmSource, s); err != nil { + return err + } + out.HardPodAffinitySymmetricWeight = in.HardPodAffinitySymmetricWeight + if err := Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { + return err + } + if err := configv1alpha1.Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil { + return err + } + out.HealthzBindAddress = in.HealthzBindAddress + out.MetricsBindAddress = in.MetricsBindAddress + if err := apisconfigv1alpha1.Convert_config_DebuggingConfiguration_To_v1alpha1_DebuggingConfiguration(&in.DebuggingConfiguration, &out.DebuggingConfiguration, s); err != nil { + return err + } + out.DisablePreemption = in.DisablePreemption + out.PercentageOfNodesToScore = in.PercentageOfNodesToScore + out.FailureDomains = in.FailureDomains + return nil +} + +// Convert_config_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration is an autogenerated conversion function. +func Convert_config_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *config.KubeSchedulerConfiguration, out *v1alpha1.KubeSchedulerConfiguration, s conversion.Scope) error { + return autoConvert_config_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in *v1alpha1.KubeSchedulerLeaderElectionConfiguration, out *config.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { + if err := apisconfigv1alpha1.Convert_v1alpha1_LeaderElectionConfiguration_To_config_LeaderElectionConfiguration(&in.LeaderElectionConfiguration, &out.LeaderElectionConfiguration, s); err != nil { + return err + } + out.LockObjectNamespace = in.LockObjectNamespace + out.LockObjectName = in.LockObjectName + return nil +} + +// Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in *v1alpha1.KubeSchedulerLeaderElectionConfiguration, out *config.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in, out, s) +} + +func autoConvert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in *config.KubeSchedulerLeaderElectionConfiguration, out *v1alpha1.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { + if err := apisconfigv1alpha1.Convert_config_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElectionConfiguration, &out.LeaderElectionConfiguration, s); err != nil { + return err + } + out.LockObjectNamespace = in.LockObjectNamespace + out.LockObjectName = in.LockObjectName + return nil +} + +// Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration is an autogenerated conversion function. +func Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in *config.KubeSchedulerLeaderElectionConfiguration, out *v1alpha1.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { + return autoConvert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_SchedulerAlgorithmSource_To_config_SchedulerAlgorithmSource(in *v1alpha1.SchedulerAlgorithmSource, out *config.SchedulerAlgorithmSource, s conversion.Scope) error { + out.Policy = (*config.SchedulerPolicySource)(unsafe.Pointer(in.Policy)) + out.Provider = (*string)(unsafe.Pointer(in.Provider)) + return nil +} + +// Convert_v1alpha1_SchedulerAlgorithmSource_To_config_SchedulerAlgorithmSource is an autogenerated conversion function. +func Convert_v1alpha1_SchedulerAlgorithmSource_To_config_SchedulerAlgorithmSource(in *v1alpha1.SchedulerAlgorithmSource, out *config.SchedulerAlgorithmSource, s conversion.Scope) error { + return autoConvert_v1alpha1_SchedulerAlgorithmSource_To_config_SchedulerAlgorithmSource(in, out, s) +} + +func autoConvert_config_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(in *config.SchedulerAlgorithmSource, out *v1alpha1.SchedulerAlgorithmSource, s conversion.Scope) error { + out.Policy = (*v1alpha1.SchedulerPolicySource)(unsafe.Pointer(in.Policy)) + out.Provider = (*string)(unsafe.Pointer(in.Provider)) + return nil +} + +// Convert_config_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource is an autogenerated conversion function. +func Convert_config_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(in *config.SchedulerAlgorithmSource, out *v1alpha1.SchedulerAlgorithmSource, s conversion.Scope) error { + return autoConvert_config_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(in, out, s) +} + +func autoConvert_v1alpha1_SchedulerPolicyConfigMapSource_To_config_SchedulerPolicyConfigMapSource(in *v1alpha1.SchedulerPolicyConfigMapSource, out *config.SchedulerPolicyConfigMapSource, s conversion.Scope) error { + out.Namespace = in.Namespace + out.Name = in.Name + return nil +} + +// Convert_v1alpha1_SchedulerPolicyConfigMapSource_To_config_SchedulerPolicyConfigMapSource is an autogenerated conversion function. +func Convert_v1alpha1_SchedulerPolicyConfigMapSource_To_config_SchedulerPolicyConfigMapSource(in *v1alpha1.SchedulerPolicyConfigMapSource, out *config.SchedulerPolicyConfigMapSource, s conversion.Scope) error { + return autoConvert_v1alpha1_SchedulerPolicyConfigMapSource_To_config_SchedulerPolicyConfigMapSource(in, out, s) +} + +func autoConvert_config_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource(in *config.SchedulerPolicyConfigMapSource, out *v1alpha1.SchedulerPolicyConfigMapSource, s conversion.Scope) error { + out.Namespace = in.Namespace + out.Name = in.Name + return nil +} + +// Convert_config_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource is an autogenerated conversion function. +func Convert_config_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource(in *config.SchedulerPolicyConfigMapSource, out *v1alpha1.SchedulerPolicyConfigMapSource, s conversion.Scope) error { + return autoConvert_config_SchedulerPolicyConfigMapSource_To_v1alpha1_SchedulerPolicyConfigMapSource(in, out, s) +} + +func autoConvert_v1alpha1_SchedulerPolicyFileSource_To_config_SchedulerPolicyFileSource(in *v1alpha1.SchedulerPolicyFileSource, out *config.SchedulerPolicyFileSource, s conversion.Scope) error { + out.Path = in.Path + return nil +} + +// Convert_v1alpha1_SchedulerPolicyFileSource_To_config_SchedulerPolicyFileSource is an autogenerated conversion function. +func Convert_v1alpha1_SchedulerPolicyFileSource_To_config_SchedulerPolicyFileSource(in *v1alpha1.SchedulerPolicyFileSource, out *config.SchedulerPolicyFileSource, s conversion.Scope) error { + return autoConvert_v1alpha1_SchedulerPolicyFileSource_To_config_SchedulerPolicyFileSource(in, out, s) +} + +func autoConvert_config_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource(in *config.SchedulerPolicyFileSource, out *v1alpha1.SchedulerPolicyFileSource, s conversion.Scope) error { + out.Path = in.Path + return nil +} + +// Convert_config_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource is an autogenerated conversion function. +func Convert_config_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource(in *config.SchedulerPolicyFileSource, out *v1alpha1.SchedulerPolicyFileSource, s conversion.Scope) error { + return autoConvert_config_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource(in, out, s) +} + +func autoConvert_v1alpha1_SchedulerPolicySource_To_config_SchedulerPolicySource(in *v1alpha1.SchedulerPolicySource, out *config.SchedulerPolicySource, s conversion.Scope) error { + out.File = (*config.SchedulerPolicyFileSource)(unsafe.Pointer(in.File)) + out.ConfigMap = (*config.SchedulerPolicyConfigMapSource)(unsafe.Pointer(in.ConfigMap)) + return nil +} + +// Convert_v1alpha1_SchedulerPolicySource_To_config_SchedulerPolicySource is an autogenerated conversion function. +func Convert_v1alpha1_SchedulerPolicySource_To_config_SchedulerPolicySource(in *v1alpha1.SchedulerPolicySource, out *config.SchedulerPolicySource, s conversion.Scope) error { + return autoConvert_v1alpha1_SchedulerPolicySource_To_config_SchedulerPolicySource(in, out, s) +} + +func autoConvert_config_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(in *config.SchedulerPolicySource, out *v1alpha1.SchedulerPolicySource, s conversion.Scope) error { + out.File = (*v1alpha1.SchedulerPolicyFileSource)(unsafe.Pointer(in.File)) + out.ConfigMap = (*v1alpha1.SchedulerPolicyConfigMapSource)(unsafe.Pointer(in.ConfigMap)) + return nil +} + +// Convert_config_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource is an autogenerated conversion function. +func Convert_config_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(in *config.SchedulerPolicySource, out *v1alpha1.SchedulerPolicySource, s conversion.Scope) error { + return autoConvert_config_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(in, out, s) +} diff --git a/pkg/scheduler/apis/config/v1alpha1/zz_generated.deepcopy.go b/pkg/scheduler/apis/config/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..0ec19467c4 --- /dev/null +++ b/pkg/scheduler/apis/config/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,21 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 diff --git a/pkg/scheduler/apis/config/v1alpha1/zz_generated.defaults.go b/pkg/scheduler/apis/config/v1alpha1/zz_generated.defaults.go new file mode 100644 index 0000000000..60e98cb8ad --- /dev/null +++ b/pkg/scheduler/apis/config/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,40 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + v1alpha1 "k8s.io/kube-scheduler/config/v1alpha1" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&v1alpha1.KubeSchedulerConfiguration{}, func(obj interface{}) { + SetObjectDefaults_KubeSchedulerConfiguration(obj.(*v1alpha1.KubeSchedulerConfiguration)) + }) + return nil +} + +func SetObjectDefaults_KubeSchedulerConfiguration(in *v1alpha1.KubeSchedulerConfiguration) { + SetDefaults_KubeSchedulerConfiguration(in) +} diff --git a/pkg/scheduler/apis/config/zz_generated.deepcopy.go b/pkg/scheduler/apis/config/zz_generated.deepcopy.go new file mode 100644 index 0000000000..5877096235 --- /dev/null +++ b/pkg/scheduler/apis/config/zz_generated.deepcopy.go @@ -0,0 +1,155 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package config + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeSchedulerConfiguration) DeepCopyInto(out *KubeSchedulerConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.AlgorithmSource.DeepCopyInto(&out.AlgorithmSource) + out.LeaderElection = in.LeaderElection + out.ClientConnection = in.ClientConnection + out.DebuggingConfiguration = in.DebuggingConfiguration + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerConfiguration. +func (in *KubeSchedulerConfiguration) DeepCopy() *KubeSchedulerConfiguration { + if in == nil { + return nil + } + out := new(KubeSchedulerConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeSchedulerConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopyInto(out *KubeSchedulerLeaderElectionConfiguration) { + *out = *in + out.LeaderElectionConfiguration = in.LeaderElectionConfiguration + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerLeaderElectionConfiguration. +func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopy() *KubeSchedulerLeaderElectionConfiguration { + if in == nil { + return nil + } + out := new(KubeSchedulerLeaderElectionConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulerAlgorithmSource) DeepCopyInto(out *SchedulerAlgorithmSource) { + *out = *in + if in.Policy != nil { + in, out := &in.Policy, &out.Policy + *out = new(SchedulerPolicySource) + (*in).DeepCopyInto(*out) + } + if in.Provider != nil { + in, out := &in.Provider, &out.Provider + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerAlgorithmSource. +func (in *SchedulerAlgorithmSource) DeepCopy() *SchedulerAlgorithmSource { + if in == nil { + return nil + } + out := new(SchedulerAlgorithmSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulerPolicyConfigMapSource) DeepCopyInto(out *SchedulerPolicyConfigMapSource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicyConfigMapSource. +func (in *SchedulerPolicyConfigMapSource) DeepCopy() *SchedulerPolicyConfigMapSource { + if in == nil { + return nil + } + out := new(SchedulerPolicyConfigMapSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulerPolicyFileSource) DeepCopyInto(out *SchedulerPolicyFileSource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicyFileSource. +func (in *SchedulerPolicyFileSource) DeepCopy() *SchedulerPolicyFileSource { + if in == nil { + return nil + } + out := new(SchedulerPolicyFileSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulerPolicySource) DeepCopyInto(out *SchedulerPolicySource) { + *out = *in + if in.File != nil { + in, out := &in.File, &out.File + *out = new(SchedulerPolicyFileSource) + **out = **in + } + if in.ConfigMap != nil { + in, out := &in.ConfigMap, &out.ConfigMap + *out = new(SchedulerPolicyConfigMapSource) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicySource. +func (in *SchedulerPolicySource) DeepCopy() *SchedulerPolicySource { + if in == nil { + return nil + } + out := new(SchedulerPolicySource) + in.DeepCopyInto(out) + return out +} diff --git a/staging/src/BUILD b/staging/src/BUILD index a57c071a26..2122eaf6ff 100644 --- a/staging/src/BUILD +++ b/staging/src/BUILD @@ -201,6 +201,7 @@ filegroup( "//staging/src/k8s.io/code-generator/pkg/util:all-srcs", "//staging/src/k8s.io/code-generator/third_party/forked/golang/reflect:all-srcs", "//staging/src/k8s.io/kube-aggregator:all-srcs", + "//staging/src/k8s.io/kube-scheduler/config/v1alpha1:all-srcs", "//staging/src/k8s.io/metrics/pkg/apis/custom_metrics:all-srcs", "//staging/src/k8s.io/metrics/pkg/apis/external_metrics:all-srcs", "//staging/src/k8s.io/metrics/pkg/apis/metrics:all-srcs", diff --git a/staging/src/k8s.io/kube-scheduler/.github/PULL_REQUEST_TEMPLATE.md b/staging/src/k8s.io/kube-scheduler/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..e559c074bb --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,2 @@ +Sorry, we do not accept changes directly against this repository. Please see +CONTRIBUTING.md for information on where and how to contribute instead. diff --git a/staging/src/k8s.io/kube-scheduler/CONTRIBUTING.md b/staging/src/k8s.io/kube-scheduler/CONTRIBUTING.md new file mode 100644 index 0000000000..68294346fd --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/CONTRIBUTING.md @@ -0,0 +1,7 @@ +# Contributing guidelines + +Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes. + +This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/kube-scheduler](https://git.k8s.io/kubernetes/staging/src/k8s.io/kube-scheduler) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot). + +Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/staging.md) for more information diff --git a/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json b/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json new file mode 100644 index 0000000000..4237b68ffb --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json @@ -0,0 +1,166 @@ +{ + "ImportPath": "k8s.io/kube-scheduler", + "GoVersion": "go1.10", + "GodepVersion": "v80", + "Packages": [ + "./..." + ], + "Deps": [ + { + "ImportPath": "github.com/gogo/protobuf/proto", + "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" + }, + { + "ImportPath": "github.com/gogo/protobuf/sortkeys", + "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" + }, + { + "ImportPath": "github.com/golang/glog", + "Rev": "44145f04b68cf362d9c4df2182967c2275eaefed" + }, + { + "ImportPath": "github.com/google/gofuzz", + "Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c" + }, + { + "ImportPath": "golang.org/x/net/http2", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/http2/hpack", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/idna", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/lex/httplex", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/text/secure/bidirule", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/transform", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/unicode/bidi", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/unicode/norm", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "gopkg.in/inf.v0", + "Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/api/resource", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/apis/config", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/apis/config/v1alpha1", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/conversion", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/fields", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/labels", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/runtime", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/selection", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/types", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/errors", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/intstr", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/json", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/naming", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/net", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/runtime", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/sets", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/validation", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/watch", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apiserver/pkg/apis/config", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/apiserver/pkg/apis/config/v1alpha1", + "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + { + "ImportPath": "k8s.io/utils/pointer", + "Rev": "66066c83e385e385ccc3c964b44fd7dcd413d0ed" + } + ] +} diff --git a/staging/src/k8s.io/kube-scheduler/LICENSE b/staging/src/k8s.io/kube-scheduler/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/staging/src/k8s.io/kube-scheduler/OWNERS b/staging/src/k8s.io/kube-scheduler/OWNERS new file mode 100755 index 0000000000..1efb6b4a64 --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/OWNERS @@ -0,0 +1,11 @@ +approvers: +- api-approvers +- sig-scheduling-maintainers +- sttts +- luxas +reviewers: +- sig-scheduling +- api-reviewers +- dixudx +- luxas +- sttts diff --git a/staging/src/k8s.io/kube-scheduler/README.md b/staging/src/k8s.io/kube-scheduler/README.md new file mode 100644 index 0000000000..d4e7f64c1f --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/README.md @@ -0,0 +1,16 @@ +# kube-scheduler +## Coming Soon! + +Implements https://github.com/luxas/community/blob/master/keps/sig-cluster-lifecycle/0014-20180707-componentconfig-api-types-to-staging.md#kube-scheduler-changes + +It provides +* Provide a versioned API for configuring kube-scheduler. + +## Compatibility + +HEAD of this repo will match HEAD of k8s.io/apiserver, k8s.io/apimachinery, and k8s.io/client-go. + +## Where does it come from? + +`kube-scheduler` is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/kube-scheduler. +Code changes are made in that location, merged into `k8s.io/kubernetes` and later synced here. diff --git a/staging/src/k8s.io/kube-scheduler/SECURITY_CONTACTS b/staging/src/k8s.io/kube-scheduler/SECURITY_CONTACTS new file mode 100644 index 0000000000..0648a8ebff --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/SECURITY_CONTACTS @@ -0,0 +1,17 @@ +# Defined below are the security contacts for this repo. +# +# They are the contact point for the Product Security Team to reach out +# to for triaging and handling of incoming issues. +# +# The below names agree to abide by the +# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy) +# and will be removed and replaced if they violate that agreement. +# +# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE +# INSTRUCTIONS AT https://kubernetes.io/security/ + +cjcullen +jessfraz +liggitt +philips +tallclair diff --git a/staging/src/k8s.io/kube-scheduler/code-of-conduct.md b/staging/src/k8s.io/kube-scheduler/code-of-conduct.md new file mode 100644 index 0000000000..0d15c00cf3 --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/code-of-conduct.md @@ -0,0 +1,3 @@ +# Kubernetes Community Code of Conduct + +Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) diff --git a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/BUILD b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/BUILD new file mode 100644 index 0000000000..8c86fbeb87 --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/BUILD @@ -0,0 +1,35 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "register.go", + "types.go", + "zz_generated.deepcopy.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/kube-scheduler/config/v1alpha1", + importpath = "k8s.io/kube-scheduler/config/v1alpha1", + visibility = ["//visibility:public"], + deps = [ + "//staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//staging/src/k8s.io/apiserver/pkg/apis/config/v1alpha1:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/doc.go b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/doc.go new file mode 100644 index 0000000000..4b4164d888 --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package + +package v1alpha1 // import "k8s.io/kube-scheduler/config/v1alpha1" diff --git a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/register.go b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/register.go new file mode 100644 index 0000000000..47e8db909b --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/register.go @@ -0,0 +1,51 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "kubescheduler.config.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +var ( + // SchemeBuilder the schema builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + // AddToScheme handler to add items to the schema + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &KubeSchedulerConfiguration{}, + ) + return nil +} diff --git a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/types.go b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/types.go new file mode 100644 index 0000000000..0c17498938 --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/types.go @@ -0,0 +1,128 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + apimachineryconfigv1alpha1 "k8s.io/apimachinery/pkg/apis/config/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + apiserverconfigv1alpha1 "k8s.io/apiserver/pkg/apis/config/v1alpha1" +) + +const ( + // SchedulerDefaultLockObjectNamespace defines default scheduler lock object namespace ("kube-system") + SchedulerDefaultLockObjectNamespace string = metav1.NamespaceSystem + + // SchedulerDefaultLockObjectName defines default scheduler lock object name ("kube-scheduler") + SchedulerDefaultLockObjectName = "kube-scheduler" + + // SchedulerDefaultProviderName defines the default provider names + SchedulerDefaultProviderName = "DefaultProvider" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// KubeSchedulerConfiguration configures a scheduler +type KubeSchedulerConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // SchedulerName is name of the scheduler, used to select which pods + // will be processed by this scheduler, based on pod's "spec.SchedulerName". + SchedulerName string `json:"schedulerName"` + // AlgorithmSource specifies the scheduler algorithm source. + AlgorithmSource SchedulerAlgorithmSource `json:"algorithmSource"` + // RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule + // corresponding to every RequiredDuringScheduling affinity rule. + // HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100. + HardPodAffinitySymmetricWeight int32 `json:"hardPodAffinitySymmetricWeight"` + + // LeaderElection defines the configuration of leader election client. + LeaderElection KubeSchedulerLeaderElectionConfiguration `json:"leaderElection"` + + // ClientConnection specifies the kubeconfig file and client connection + // settings for the proxy server to use when communicating with the apiserver. + ClientConnection apimachineryconfigv1alpha1.ClientConnectionConfiguration `json:"clientConnection"` + // HealthzBindAddress is the IP address and port for the health check server to serve on, + // defaulting to 0.0.0.0:10251 + HealthzBindAddress string `json:"healthzBindAddress"` + // MetricsBindAddress is the IP address and port for the metrics server to + // serve on, defaulting to 0.0.0.0:10251. + MetricsBindAddress string `json:"metricsBindAddress"` + + // DebuggingConfiguration holds configuration for Debugging related features + // TODO: We might wanna make this a substruct like Debugging apiserverconfig.DebuggingConfiguration + apiserverconfigv1alpha1.DebuggingConfiguration `json:",inline"` + + // DisablePreemption disables the pod preemption feature. + DisablePreemption bool `json:"disablePreemption"` + + // PercentageOfNodeToScore is the percentage of all nodes that once found feasible + // for running a pod, the scheduler stops its search for more feasible nodes in + // the cluster. This helps improve scheduler's performance. Scheduler always tries to find + // at least "minFeasibleNodesToFind" feasible nodes no matter what the value of this flag is. + // Example: if the cluster size is 500 nodes and the value of this flag is 30, + // then scheduler stops finding further feasible nodes once it finds 150 feasible ones. + // When the value is 0, default percentage (50%) of the nodes will be scored. + PercentageOfNodesToScore int32 `json:"percentageOfNodesToScore"` + + // DEPRECATED. + // Indicate the "all topologies" set for empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity. + FailureDomains string `json:"failureDomains"` +} + +// SchedulerAlgorithmSource is the source of a scheduler algorithm. One source +// field must be specified, and source fields are mutually exclusive. +type SchedulerAlgorithmSource struct { + // Policy is a policy based algorithm source. + Policy *SchedulerPolicySource `json:"policy,omitempty"` + // Provider is the name of a scheduling algorithm provider to use. + Provider *string `json:"provider,omitempty"` +} + +// SchedulerPolicySource configures a means to obtain a scheduler Policy. One +// source field must be specified, and source fields are mutually exclusive. +type SchedulerPolicySource struct { + // File is a file policy source. + File *SchedulerPolicyFileSource `json:"file,omitempty"` + // ConfigMap is a config map policy source. + ConfigMap *SchedulerPolicyConfigMapSource `json:"configMap,omitempty"` +} + +// SchedulerPolicyFileSource is a policy serialized to disk and accessed via +// path. +type SchedulerPolicyFileSource struct { + // Path is the location of a serialized policy. + Path string `json:"path"` +} + +// SchedulerPolicyConfigMapSource is a policy serialized into a config map value +// under the SchedulerPolicyConfigMapKey key. +type SchedulerPolicyConfigMapSource struct { + // Namespace is the namespace of the policy config map. + Namespace string `json:"namespace"` + // Name is the name of hte policy config map. + Name string `json:"name"` +} + +// KubeSchedulerLeaderElectionConfiguration expands LeaderElectionConfiguration +// to include scheduler specific configuration. +type KubeSchedulerLeaderElectionConfiguration struct { + apiserverconfigv1alpha1.LeaderElectionConfiguration `json:",inline"` + // LockObjectNamespace defines the namespace of the lock object + LockObjectNamespace string `json:"lockObjectNamespace"` + // LockObjectName defines the lock object name + LockObjectName string `json:"lockObjectName"` +} diff --git a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/zz_generated.deepcopy.go b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..2e1bf252df --- /dev/null +++ b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,155 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeSchedulerConfiguration) DeepCopyInto(out *KubeSchedulerConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.AlgorithmSource.DeepCopyInto(&out.AlgorithmSource) + in.LeaderElection.DeepCopyInto(&out.LeaderElection) + out.ClientConnection = in.ClientConnection + out.DebuggingConfiguration = in.DebuggingConfiguration + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerConfiguration. +func (in *KubeSchedulerConfiguration) DeepCopy() *KubeSchedulerConfiguration { + if in == nil { + return nil + } + out := new(KubeSchedulerConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeSchedulerConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopyInto(out *KubeSchedulerLeaderElectionConfiguration) { + *out = *in + in.LeaderElectionConfiguration.DeepCopyInto(&out.LeaderElectionConfiguration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeSchedulerLeaderElectionConfiguration. +func (in *KubeSchedulerLeaderElectionConfiguration) DeepCopy() *KubeSchedulerLeaderElectionConfiguration { + if in == nil { + return nil + } + out := new(KubeSchedulerLeaderElectionConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulerAlgorithmSource) DeepCopyInto(out *SchedulerAlgorithmSource) { + *out = *in + if in.Policy != nil { + in, out := &in.Policy, &out.Policy + *out = new(SchedulerPolicySource) + (*in).DeepCopyInto(*out) + } + if in.Provider != nil { + in, out := &in.Provider, &out.Provider + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerAlgorithmSource. +func (in *SchedulerAlgorithmSource) DeepCopy() *SchedulerAlgorithmSource { + if in == nil { + return nil + } + out := new(SchedulerAlgorithmSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulerPolicyConfigMapSource) DeepCopyInto(out *SchedulerPolicyConfigMapSource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicyConfigMapSource. +func (in *SchedulerPolicyConfigMapSource) DeepCopy() *SchedulerPolicyConfigMapSource { + if in == nil { + return nil + } + out := new(SchedulerPolicyConfigMapSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulerPolicyFileSource) DeepCopyInto(out *SchedulerPolicyFileSource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicyFileSource. +func (in *SchedulerPolicyFileSource) DeepCopy() *SchedulerPolicyFileSource { + if in == nil { + return nil + } + out := new(SchedulerPolicyFileSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulerPolicySource) DeepCopyInto(out *SchedulerPolicySource) { + *out = *in + if in.File != nil { + in, out := &in.File, &out.File + *out = new(SchedulerPolicyFileSource) + **out = **in + } + if in.ConfigMap != nil { + in, out := &in.ConfigMap, &out.ConfigMap + *out = new(SchedulerPolicyConfigMapSource) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulerPolicySource. +func (in *SchedulerPolicySource) DeepCopy() *SchedulerPolicySource { + if in == nil { + return nil + } + out := new(SchedulerPolicySource) + in.DeepCopyInto(out) + return out +} diff --git a/test/integration/scheduler/BUILD b/test/integration/scheduler/BUILD index bcc0f35c80..ba2c51e2b3 100644 --- a/test/integration/scheduler/BUILD +++ b/test/integration/scheduler/BUILD @@ -25,7 +25,6 @@ go_test( "//cmd/kube-scheduler/app:go_default_library", "//cmd/kube-scheduler/app/config:go_default_library", "//pkg/api/legacyscheme:go_default_library", - "//pkg/apis/componentconfig:go_default_library", "//pkg/client/clientset_generated/internalclientset:go_default_library", "//pkg/client/informers/informers_generated/internalversion:go_default_library", "//pkg/controller/nodelifecycle:go_default_library", @@ -37,6 +36,7 @@ go_test( "//pkg/scheduler/algorithm:go_default_library", "//pkg/scheduler/algorithmprovider:go_default_library", "//pkg/scheduler/api:go_default_library", + "//pkg/scheduler/apis/config:go_default_library", "//pkg/scheduler/cache:go_default_library", "//pkg/scheduler/factory:go_default_library", "//pkg/volume:go_default_library", diff --git a/test/integration/scheduler/scheduler_test.go b/test/integration/scheduler/scheduler_test.go index 14b065bdf6..2af1054e62 100644 --- a/test/integration/scheduler/scheduler_test.go +++ b/test/integration/scheduler/scheduler_test.go @@ -45,11 +45,11 @@ import ( schedulerapp "k8s.io/kubernetes/cmd/kube-scheduler/app" schedulerappconfig "k8s.io/kubernetes/cmd/kube-scheduler/app/config" "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/apis/componentconfig" "k8s.io/kubernetes/pkg/scheduler" "k8s.io/kubernetes/pkg/scheduler/algorithm" _ "k8s.io/kubernetes/pkg/scheduler/algorithmprovider" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" + kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" schedulercache "k8s.io/kubernetes/pkg/scheduler/cache" "k8s.io/kubernetes/pkg/scheduler/factory" "k8s.io/kubernetes/test/integration/framework" @@ -173,7 +173,7 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) { configPolicyName := fmt.Sprintf("scheduler-custom-policy-config-%d", i) policyConfigMap := v1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceSystem, Name: configPolicyName}, - Data: map[string]string{componentconfig.SchedulerPolicyConfigMapKey: test.policy}, + Data: map[string]string{kubeschedulerconfig.SchedulerPolicyConfigMapKey: test.policy}, } policyConfigMap.APIVersion = "v1" @@ -183,12 +183,12 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) { eventBroadcaster.StartRecordingToSink(&clientv1core.EventSinkImpl{Interface: clientSet.CoreV1().Events("")}) ss := &schedulerappconfig.Config{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ HardPodAffinitySymmetricWeight: v1.DefaultHardPodAffinitySymmetricWeight, SchedulerName: v1.DefaultSchedulerName, - AlgorithmSource: componentconfig.SchedulerAlgorithmSource{ - Policy: &componentconfig.SchedulerPolicySource{ - ConfigMap: &componentconfig.SchedulerPolicyConfigMapSource{ + AlgorithmSource: kubeschedulerconfig.SchedulerAlgorithmSource{ + Policy: &kubeschedulerconfig.SchedulerPolicySource{ + ConfigMap: &kubeschedulerconfig.SchedulerPolicyConfigMapSource{ Namespace: policyConfigMap.Namespace, Name: policyConfigMap.Name, }, @@ -244,11 +244,11 @@ func TestSchedulerCreationFromNonExistentConfigMap(t *testing.T) { eventBroadcaster.StartRecordingToSink(&clientv1core.EventSinkImpl{Interface: clientSet.CoreV1().Events("")}) ss := &schedulerappconfig.Config{ - ComponentConfig: componentconfig.KubeSchedulerConfiguration{ + ComponentConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ SchedulerName: v1.DefaultSchedulerName, - AlgorithmSource: componentconfig.SchedulerAlgorithmSource{ - Policy: &componentconfig.SchedulerPolicySource{ - ConfigMap: &componentconfig.SchedulerPolicyConfigMapSource{ + AlgorithmSource: kubeschedulerconfig.SchedulerAlgorithmSource{ + Policy: &kubeschedulerconfig.SchedulerPolicySource{ + ConfigMap: &kubeschedulerconfig.SchedulerPolicyConfigMapSource{ Namespace: "non-existent-config", Name: "non-existent-config", }, diff --git a/vendor/k8s.io/kube-scheduler b/vendor/k8s.io/kube-scheduler new file mode 120000 index 0000000000..9379030463 --- /dev/null +++ b/vendor/k8s.io/kube-scheduler @@ -0,0 +1 @@ +../../staging/src/k8s.io/kube-scheduler/ \ No newline at end of file