From 1865a104a90f08f7b86eabd1aea143415cb73f56 Mon Sep 17 00:00:00 2001 From: gavinfish Date: Fri, 20 Mar 2020 17:22:00 +0800 Subject: [PATCH] Remove kubescheduler.config.k8s.io/v1alpha1 --- build/kazel_generated.bzl | 2 - cmd/kube-scheduler/app/options/BUILD | 2 - cmd/kube-scheduler/app/options/configfile.go | 25 +- .../app/options/options_test.go | 244 ------- cmd/kube-scheduler/app/server_test.go | 23 - hack/.golint_failures | 1 - pkg/scheduler/apis/config/BUILD | 1 - pkg/scheduler/apis/config/scheme/BUILD | 1 - pkg/scheduler/apis/config/scheme/scheme.go | 4 +- pkg/scheduler/apis/config/v1alpha1/BUILD | 63 -- .../apis/config/v1alpha1/conversion.go | 146 ---- .../apis/config/v1alpha1/conversion_test.go | 526 --------------- .../apis/config/v1alpha1/defaults.go | 166 ----- .../apis/config/v1alpha1/defaults_test.go | 207 ------ pkg/scheduler/apis/config/v1alpha1/doc.go | 24 - .../apis/config/v1alpha1/register.go | 43 -- .../v1alpha1/zz_generated.conversion.go | 624 ------------------ .../config/v1alpha1/zz_generated.deepcopy.go | 21 - .../config/v1alpha1/zz_generated.defaults.go | 40 -- staging/src/k8s.io/kube-scheduler/BUILD | 1 - .../kube-scheduler/config/v1alpha1/BUILD | 34 - .../kube-scheduler/config/v1alpha1/doc.go | 21 - .../config/v1alpha1/register.go | 43 -- .../kube-scheduler/config/v1alpha1/types.go | 228 ------- .../config/v1alpha1/zz_generated.deepcopy.go | 351 ---------- vendor/modules.txt | 1 - 26 files changed, 2 insertions(+), 2840 deletions(-) delete mode 100644 pkg/scheduler/apis/config/v1alpha1/BUILD delete mode 100644 pkg/scheduler/apis/config/v1alpha1/conversion.go delete mode 100644 pkg/scheduler/apis/config/v1alpha1/conversion_test.go delete mode 100644 pkg/scheduler/apis/config/v1alpha1/defaults.go delete mode 100644 pkg/scheduler/apis/config/v1alpha1/defaults_test.go delete mode 100644 pkg/scheduler/apis/config/v1alpha1/doc.go delete mode 100644 pkg/scheduler/apis/config/v1alpha1/register.go delete mode 100644 pkg/scheduler/apis/config/v1alpha1/zz_generated.conversion.go delete mode 100644 pkg/scheduler/apis/config/v1alpha1/zz_generated.deepcopy.go delete mode 100644 pkg/scheduler/apis/config/v1alpha1/zz_generated.defaults.go delete mode 100644 staging/src/k8s.io/kube-scheduler/config/v1alpha1/BUILD delete mode 100644 staging/src/k8s.io/kube-scheduler/config/v1alpha1/doc.go delete mode 100644 staging/src/k8s.io/kube-scheduler/config/v1alpha1/register.go delete mode 100644 staging/src/k8s.io/kube-scheduler/config/v1alpha1/types.go delete mode 100644 staging/src/k8s.io/kube-scheduler/config/v1alpha1/zz_generated.deepcopy.go diff --git a/build/kazel_generated.bzl b/build/kazel_generated.bzl index 21127ee68b7..ad366e567b5 100644 --- a/build/kazel_generated.bzl +++ b/build/kazel_generated.bzl @@ -99,7 +99,6 @@ tags_values_pkgs = {"openapi-gen": { "staging/src/k8s.io/kube-controller-manager/config/v1alpha1", "staging/src/k8s.io/kube-proxy/config/v1alpha1", "staging/src/k8s.io/kube-scheduler/config/v1", - "staging/src/k8s.io/kube-scheduler/config/v1alpha1", "staging/src/k8s.io/kube-scheduler/config/v1alpha2", "staging/src/k8s.io/kubelet/config/v1beta1", "staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1", @@ -186,7 +185,6 @@ tags_pkgs_values = {"openapi-gen": { "staging/src/k8s.io/kube-controller-manager/config/v1alpha1": ["true"], "staging/src/k8s.io/kube-proxy/config/v1alpha1": ["true"], "staging/src/k8s.io/kube-scheduler/config/v1": ["true"], - "staging/src/k8s.io/kube-scheduler/config/v1alpha1": ["true"], "staging/src/k8s.io/kube-scheduler/config/v1alpha2": ["true"], "staging/src/k8s.io/kubelet/config/v1beta1": ["true"], "staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1": ["true"], diff --git a/cmd/kube-scheduler/app/options/BUILD b/cmd/kube-scheduler/app/options/BUILD index efd0a6bee74..4af98d13eae 100644 --- a/cmd/kube-scheduler/app/options/BUILD +++ b/cmd/kube-scheduler/app/options/BUILD @@ -18,7 +18,6 @@ go_library( "//pkg/scheduler/algorithmprovider: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/apis/config/v1alpha2:go_default_library", "//pkg/scheduler/apis/config/validation:go_default_library", "//pkg/scheduler/framework/plugins:go_default_library", @@ -40,7 +39,6 @@ go_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/component-base/cli/flag:go_default_library", - "//staging/src/k8s.io/component-base/codec:go_default_library", "//staging/src/k8s.io/component-base/config:go_default_library", "//staging/src/k8s.io/component-base/config/v1alpha1:go_default_library", "//staging/src/k8s.io/component-base/metrics:go_default_library", diff --git a/cmd/kube-scheduler/app/options/configfile.go b/cmd/kube-scheduler/app/options/configfile.go index 5b6479d7a42..10883cd882e 100644 --- a/cmd/kube-scheduler/app/options/configfile.go +++ b/cmd/kube-scheduler/app/options/configfile.go @@ -21,13 +21,9 @@ import ( "io/ioutil" "os" - "k8s.io/klog" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/component-base/codec" 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" kubeschedulerconfigv1alpha2 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1alpha2" ) @@ -44,26 +40,7 @@ func loadConfig(data []byte) (*kubeschedulerconfig.KubeSchedulerConfiguration, e // The UniversalDecoder runs defaulting and returns the internal type by default. obj, gvk, err := kubeschedulerscheme.Codecs.UniversalDecoder().Decode(data, nil, nil) if err != nil { - // Try strict decoding first. If that fails decode with a lenient - // decoder, which has only v1alpha1 registered, and log a warning. - // The lenient path is to be dropped when support for v1alpha1 is dropped. - if !runtime.IsStrictDecodingError(err) { - return nil, err - } - - var lenientErr error - _, lenientCodecs, lenientErr := codec.NewLenientSchemeAndCodecs( - kubeschedulerconfig.AddToScheme, - kubeschedulerconfigv1alpha1.AddToScheme, - ) - if lenientErr != nil { - return nil, lenientErr - } - obj, gvk, lenientErr = lenientCodecs.UniversalDecoder().Decode(data, nil, nil) - if lenientErr != nil { - return nil, err - } - klog.Warningf("using lenient decoding as strict decoding failed: %v", err) + return nil, err } if cfgObj, ok := obj.(*kubeschedulerconfig.KubeSchedulerConfiguration); ok { return cfgObj, nil diff --git a/cmd/kube-scheduler/app/options/options_test.go b/cmd/kube-scheduler/app/options/options_test.go index 497bc425010..304d4c0c946 100644 --- a/cmd/kube-scheduler/app/options/options_test.go +++ b/cmd/kube-scheduler/app/options/options_test.go @@ -134,31 +134,6 @@ leaderElection: t.Fatal(err) } - v1alpha1Config := filepath.Join(tmpDir, "kubeconfig_v1alpha1.yaml") - if err := ioutil.WriteFile(v1alpha1Config, []byte(fmt.Sprintf(` -apiVersion: kubescheduler.config.k8s.io/v1alpha1 -kind: KubeSchedulerConfiguration -schedulerName: "my-old-scheduler" -clientConnection: - kubeconfig: "%s" -leaderElection: - leaderElect: true -hardPodAffinitySymmetricWeight: 3`, configKubeconfig)), os.FileMode(0600)); err != nil { - t.Fatal(err) - } - - unknownFieldConfigLenient := filepath.Join(tmpDir, "scheduler_invalid_unknown_field_lenient.yaml") - if err := ioutil.WriteFile(unknownFieldConfigLenient, []byte(fmt.Sprintf(` -apiVersion: kubescheduler.config.k8s.io/v1alpha1 -kind: KubeSchedulerConfiguration -clientConnection: - kubeconfig: "%s" -leaderElection: - leaderElect: true -foo: bar`, configKubeconfig)), os.FileMode(0600)); err != nil { - t.Fatal(err) - } - unknownFieldConfig := filepath.Join(tmpDir, "scheduler_invalid_unknown_field.yaml") if err := ioutil.WriteFile(unknownFieldConfig, []byte(fmt.Sprintf(` apiVersion: kubescheduler.config.k8s.io/v1alpha2 @@ -171,18 +146,6 @@ foo: bar`, configKubeconfig)), os.FileMode(0600)); err != nil { t.Fatal(err) } - duplicateFieldConfigLenient := filepath.Join(tmpDir, "scheduler_invalid_duplicate_fields_lenient.yaml") - if err := ioutil.WriteFile(duplicateFieldConfigLenient, []byte(fmt.Sprintf(` -apiVersion: kubescheduler.config.k8s.io/v1alpha1 -kind: KubeSchedulerConfiguration -clientConnection: - kubeconfig: "%s" -leaderElection: - leaderElect: true - leaderElect: false`, configKubeconfig)), os.FileMode(0600)); err != nil { - t.Fatal(err) - } - duplicateFieldConfig := filepath.Join(tmpDir, "scheduler_invalid_duplicate_fields.yaml") if err := ioutil.WriteFile(duplicateFieldConfig, []byte(fmt.Sprintf(` apiVersion: kubescheduler.config.k8s.io/v1alpha2 @@ -269,24 +232,6 @@ profiles: t.Fatal(err) } - // v1alpha1 postfilter plugin config - postfilterPluginConfigFile := filepath.Join(tmpDir, "v1alpha1_postfilter_plugin.yaml") - if err := ioutil.WriteFile(postfilterPluginConfigFile, []byte(fmt.Sprintf(` -apiVersion: kubescheduler.config.k8s.io/v1alpha1 -kind: KubeSchedulerConfiguration -clientConnection: - kubeconfig: "%s" -plugins: - postFilter: - enabled: - - name: foo - - name: bar - disabled: - - name: baz -`, configKubeconfig)), os.FileMode(0600)); err != nil { - t.Fatal(err) - } - // Insulate this test from picking up in-cluster config when run inside a pod // We can't assume we have permissions to write to /var/run/secrets/... from a unit test to mock in-cluster config for testing originalHost := os.Getenv("KUBERNETES_SERVICE_HOST") @@ -670,65 +615,6 @@ plugins: }, }, }, - { - name: "v1alpha1 postfilter plugin config", - options: &Options{ - ConfigFile: postfilterPluginConfigFile, - }, - expectedUsername: "config", - expectedConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ - AlgorithmSource: kubeschedulerconfig.SchedulerAlgorithmSource{Provider: &defaultSource}, - HealthzBindAddress: "0.0.0.0:10251", - MetricsBindAddress: "0.0.0.0:10251", - DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ - EnableProfiling: true, - EnableContentionProfiling: true, - }, - LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: true, - LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, - RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, - RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, - ResourceLock: "endpointsleases", - ResourceNamespace: "kube-system", - ResourceName: "kube-scheduler", - }, - }, - ClientConnection: componentbaseconfig.ClientConnectionConfiguration{ - Kubeconfig: configKubeconfig, - QPS: 50, - Burst: 100, - ContentType: "application/vnd.kubernetes.protobuf", - }, - PercentageOfNodesToScore: defaultPercentageOfNodesToScore, - BindTimeoutSeconds: defaultBindTimeoutSeconds, - PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds, - PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds, - Profiles: []kubeschedulerconfig.KubeSchedulerProfile{ - { - SchedulerName: "default-scheduler", - Plugins: &kubeschedulerconfig.Plugins{ - PreScore: &kubeschedulerconfig.PluginSet{ - Enabled: []kubeschedulerconfig.Plugin{ - { - Name: "foo", - }, - { - Name: "bar", - }, - }, - Disabled: []kubeschedulerconfig.Plugin{ - { - Name: "baz", - }, - }, - }, - }, - }, - }, - }, - }, { name: "no config", options: &Options{}, @@ -835,96 +721,6 @@ plugins: }, }, }, - { - name: "v1alpha1 config with SchedulerName and HardPodAffinitySymmetricWeight", - options: &Options{ - ConfigFile: v1alpha1Config, - }, - expectedUsername: "config", - expectedConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ - AlgorithmSource: kubeschedulerconfig.SchedulerAlgorithmSource{Provider: &defaultSource}, - HealthzBindAddress: "0.0.0.0:10251", - MetricsBindAddress: "0.0.0.0:10251", - DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ - EnableProfiling: true, - EnableContentionProfiling: true, - }, - LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: true, - LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, - RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, - RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, - ResourceLock: "endpointsleases", - ResourceNamespace: "kube-system", - ResourceName: "kube-scheduler", - }, - }, - ClientConnection: componentbaseconfig.ClientConnectionConfiguration{ - Kubeconfig: configKubeconfig, - QPS: 50, - Burst: 100, - ContentType: "application/vnd.kubernetes.protobuf", - }, - PercentageOfNodesToScore: defaultPercentageOfNodesToScore, - BindTimeoutSeconds: defaultBindTimeoutSeconds, - PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds, - PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds, - Profiles: []kubeschedulerconfig.KubeSchedulerProfile{ - { - SchedulerName: "my-old-scheduler", - PluginConfig: []kubeschedulerconfig.PluginConfig{ - { - Name: "InterPodAffinity", - Args: runtime.Unknown{ - Raw: []byte(`{"hardPodAffinityWeight":3}`), - }, - }, - }, - }, - }, - }, - }, - { - name: "unknown field lenient (v1alpha1)", - options: &Options{ - ConfigFile: unknownFieldConfigLenient, - }, - expectedUsername: "config", - expectedConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ - AlgorithmSource: kubeschedulerconfig.SchedulerAlgorithmSource{Provider: &defaultSource}, - HealthzBindAddress: "0.0.0.0:10251", - MetricsBindAddress: "0.0.0.0:10251", - DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ - EnableProfiling: true, - EnableContentionProfiling: true, - }, - LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: true, - LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, - RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, - RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, - ResourceLock: "endpointsleases", - ResourceNamespace: "kube-system", - ResourceName: "kube-scheduler", - }, - }, - ClientConnection: componentbaseconfig.ClientConnectionConfiguration{ - Kubeconfig: configKubeconfig, - QPS: 50, - Burst: 100, - ContentType: "application/vnd.kubernetes.protobuf", - }, - PercentageOfNodesToScore: defaultPercentageOfNodesToScore, - BindTimeoutSeconds: defaultBindTimeoutSeconds, - PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds, - PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds, - Profiles: []kubeschedulerconfig.KubeSchedulerProfile{ - {SchedulerName: "default-scheduler"}, - }, - }, - }, { name: "unknown field", options: &Options{ @@ -933,46 +729,6 @@ plugins: expectedError: "found unknown field: foo", checkErrFn: runtime.IsStrictDecodingError, }, - { - name: "duplicate fields lenient (v1alpha1)", - options: &Options{ - ConfigFile: duplicateFieldConfigLenient, - }, - expectedUsername: "config", - expectedConfig: kubeschedulerconfig.KubeSchedulerConfiguration{ - AlgorithmSource: kubeschedulerconfig.SchedulerAlgorithmSource{Provider: &defaultSource}, - HealthzBindAddress: "0.0.0.0:10251", - MetricsBindAddress: "0.0.0.0:10251", - DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ - EnableProfiling: true, - EnableContentionProfiling: true, - }, - LeaderElection: kubeschedulerconfig.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: false, - LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, - RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, - RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, - ResourceLock: "endpointsleases", - ResourceNamespace: "kube-system", - ResourceName: "kube-scheduler", - }, - }, - ClientConnection: componentbaseconfig.ClientConnectionConfiguration{ - Kubeconfig: configKubeconfig, - QPS: 50, - Burst: 100, - ContentType: "application/vnd.kubernetes.protobuf", - }, - PercentageOfNodesToScore: defaultPercentageOfNodesToScore, - BindTimeoutSeconds: defaultBindTimeoutSeconds, - PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds, - PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds, - Profiles: []kubeschedulerconfig.KubeSchedulerProfile{ - {SchedulerName: "default-scheduler"}, - }, - }, - }, { name: "duplicate fields", options: &Options{ diff --git a/cmd/kube-scheduler/app/server_test.go b/cmd/kube-scheduler/app/server_test.go index e6035cc3b7e..21630673443 100644 --- a/cmd/kube-scheduler/app/server_test.go +++ b/cmd/kube-scheduler/app/server_test.go @@ -70,19 +70,6 @@ users: t.Fatal(err) } - v1alpha1Config := filepath.Join(tmpDir, "kubeconfig_v1alpha1.yaml") - if err := ioutil.WriteFile(v1alpha1Config, []byte(fmt.Sprintf(` -apiVersion: kubescheduler.config.k8s.io/v1alpha1 -kind: KubeSchedulerConfiguration -schedulerName: "my-old-scheduler" -clientConnection: - kubeconfig: "%s" -leaderElection: - leaderElect: true -hardPodAffinitySymmetricWeight: 3`, configKubeconfig)), os.FileMode(0600)); err != nil { - t.Fatal(err) - } - // plugin config pluginConfigFile := filepath.Join(tmpDir, "plugin.yaml") if err := ioutil.WriteFile(pluginConfigFile, []byte(fmt.Sprintf(` @@ -208,16 +195,6 @@ profiles: "default-scheduler": defaultPlugins, }, }, - { - name: "v1alpha1 config with SchedulerName and HardPodAffinitySymmetricWeight", - flags: []string{ - "--config", v1alpha1Config, - "--kubeconfig", configKubeconfig, - }, - wantPlugins: map[string]map[string][]kubeschedulerconfig.Plugin{ - "my-old-scheduler": defaultPlugins, - }, - }, { name: "plugin config with single profile", flags: []string{ diff --git a/hack/.golint_failures b/hack/.golint_failures index 59e2d9d19f3..4645652195e 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -184,7 +184,6 @@ pkg/registry/scheduling/rest pkg/registry/settings/rest pkg/registry/storage/rest pkg/registry/storage/storageclass -pkg/scheduler/apis/config/v1alpha1 pkg/scheduler/apis/config/v1alpha2 pkg/security/podsecuritypolicy pkg/security/podsecuritypolicy/group diff --git a/pkg/scheduler/apis/config/BUILD b/pkg/scheduler/apis/config/BUILD index 2c3fec71bae..cc454ed08dc 100644 --- a/pkg/scheduler/apis/config/BUILD +++ b/pkg/scheduler/apis/config/BUILD @@ -34,7 +34,6 @@ filegroup( "//pkg/scheduler/apis/config/scheme:all-srcs", "//pkg/scheduler/apis/config/testing:all-srcs", "//pkg/scheduler/apis/config/v1:all-srcs", - "//pkg/scheduler/apis/config/v1alpha1:all-srcs", "//pkg/scheduler/apis/config/v1alpha2:all-srcs", "//pkg/scheduler/apis/config/validation:all-srcs", ], diff --git a/pkg/scheduler/apis/config/scheme/BUILD b/pkg/scheduler/apis/config/scheme/BUILD index ce8253fb41f..810ad383699 100644 --- a/pkg/scheduler/apis/config/scheme/BUILD +++ b/pkg/scheduler/apis/config/scheme/BUILD @@ -8,7 +8,6 @@ go_library( deps = [ "//pkg/scheduler/apis/config:go_default_library", "//pkg/scheduler/apis/config/v1:go_default_library", - "//pkg/scheduler/apis/config/v1alpha1:go_default_library", "//pkg/scheduler/apis/config/v1alpha2:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library", diff --git a/pkg/scheduler/apis/config/scheme/scheme.go b/pkg/scheduler/apis/config/scheme/scheme.go index de5810801d3..6e257672648 100644 --- a/pkg/scheduler/apis/config/scheme/scheme.go +++ b/pkg/scheduler/apis/config/scheme/scheme.go @@ -22,7 +22,6 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" kubeschedulerconfigv1 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1" - kubeschedulerconfigv1alpha1 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1alpha1" kubeschedulerconfigv1alpha2 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1alpha2" ) @@ -42,7 +41,6 @@ func init() { func AddToScheme(scheme *runtime.Scheme) { utilruntime.Must(kubeschedulerconfig.AddToScheme(scheme)) utilruntime.Must(kubeschedulerconfigv1.AddToScheme(scheme)) - utilruntime.Must(kubeschedulerconfigv1alpha1.AddToScheme(scheme)) utilruntime.Must(kubeschedulerconfigv1alpha2.AddToScheme(scheme)) - utilruntime.Must(scheme.SetVersionPriority(kubeschedulerconfigv1alpha2.SchemeGroupVersion, kubeschedulerconfigv1alpha1.SchemeGroupVersion)) + utilruntime.Must(scheme.SetVersionPriority(kubeschedulerconfigv1alpha2.SchemeGroupVersion)) } diff --git a/pkg/scheduler/apis/config/v1alpha1/BUILD b/pkg/scheduler/apis/config/v1alpha1/BUILD deleted file mode 100644 index cc1874253c7..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/BUILD +++ /dev/null @@ -1,63 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "go_default_library", - srcs = [ - "conversion.go", - "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/master/ports:go_default_library", - "//pkg/scheduler/apis/config:go_default_library", - "//pkg/scheduler/framework/plugins:go_default_library", - "//pkg/scheduler/framework/plugins/interpodaffinity: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", - "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", - "//staging/src/k8s.io/component-base/config/v1alpha1:go_default_library", - "//staging/src/k8s.io/kube-scheduler/config/v1alpha1:go_default_library", - ], -) - -go_test( - name = "go_default_test", - srcs = [ - "conversion_test.go", - "defaults_test.go", - ], - embed = [":go_default_library"], - deps = [ - "//pkg/scheduler/apis/config: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", - "//staging/src/k8s.io/component-base/config:go_default_library", - "//staging/src/k8s.io/component-base/config/v1alpha1:go_default_library", - "//staging/src/k8s.io/kube-scheduler/config/v1alpha1:go_default_library", - "//vendor/github.com/google/go-cmp/cmp:go_default_library", - "//vendor/k8s.io/utils/pointer: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/conversion.go b/pkg/scheduler/apis/config/v1alpha1/conversion.go deleted file mode 100644 index 55ae5ed7ba2..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/conversion.go +++ /dev/null @@ -1,146 +0,0 @@ -/* -Copyright 2019 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 ( - "fmt" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/conversion" - "k8s.io/kube-scheduler/config/v1alpha1" - "k8s.io/kubernetes/pkg/scheduler/apis/config" - "k8s.io/kubernetes/pkg/scheduler/framework/plugins" - "k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity" -) - -// Convert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration converts to the internal. -func Convert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in *v1alpha1.KubeSchedulerConfiguration, out *config.KubeSchedulerConfiguration, s conversion.Scope) error { - if err := autoConvert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in, out, s); err != nil { - return err - } - var profile config.KubeSchedulerProfile - if err := metav1.Convert_Pointer_string_To_string(&in.SchedulerName, &profile.SchedulerName, s); err != nil { - return err - } - if in.Plugins != nil { - profile.Plugins = &config.Plugins{} - if err := Convert_v1alpha1_Plugins_To_config_Plugins(in.Plugins, profile.Plugins, s); err != nil { - return err - } - } else { - profile.Plugins = nil - } - if in.PluginConfig != nil { - profile.PluginConfig = make([]config.PluginConfig, len(in.PluginConfig)) - for i := range in.PluginConfig { - if err := Convert_v1alpha1_PluginConfig_To_config_PluginConfig(&in.PluginConfig[i], &profile.PluginConfig[i], s); err != nil { - return err - } - } - } - if in.HardPodAffinitySymmetricWeight != nil { - args := interpodaffinity.Args{HardPodAffinityWeight: in.HardPodAffinitySymmetricWeight} - plCfg := plugins.NewPluginConfig(interpodaffinity.Name, args) - profile.PluginConfig = append(profile.PluginConfig, plCfg) - } - out.Profiles = []config.KubeSchedulerProfile{profile} - return nil -} - -func Convert_config_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *config.KubeSchedulerConfiguration, out *v1alpha1.KubeSchedulerConfiguration, s conversion.Scope) error { - // Conversion from internal to v1alpha1 is not relevant for kube-scheduler. - return autoConvert_config_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in, out, s) -} - -// Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration handles deprecated parameters for leader election. -func Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in *v1alpha1.KubeSchedulerLeaderElectionConfiguration, out *config.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { - if err := autoConvert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in, out, s); err != nil { - return err - } - if len(in.ResourceNamespace) > 0 && len(in.LockObjectNamespace) == 0 { - out.ResourceNamespace = in.ResourceNamespace - } else if len(in.ResourceNamespace) == 0 && len(in.LockObjectNamespace) > 0 { - out.ResourceNamespace = in.LockObjectNamespace - } else if len(in.ResourceNamespace) > 0 && len(in.LockObjectNamespace) > 0 { - if in.ResourceNamespace == in.LockObjectNamespace { - out.ResourceNamespace = in.ResourceNamespace - } else { - return fmt.Errorf("ResourceNamespace and LockObjectNamespace are both set and do not match, ResourceNamespace: %s, LockObjectNamespace: %s", in.ResourceNamespace, in.LockObjectNamespace) - } - } - - if len(in.ResourceName) > 0 && len(in.LockObjectName) == 0 { - out.ResourceName = in.ResourceName - } else if len(in.ResourceName) == 0 && len(in.LockObjectName) > 0 { - out.ResourceName = in.LockObjectName - } else if len(in.ResourceName) > 0 && len(in.LockObjectName) > 0 { - if in.ResourceName == in.LockObjectName { - out.ResourceName = in.ResourceName - } else { - return fmt.Errorf("ResourceName and LockObjectName are both set and do not match, ResourceName: %s, LockObjectName: %s", in.ResourceName, in.LockObjectName) - } - } - return nil -} - -// Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration handles deprecated parameters for leader election. -func Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in *config.KubeSchedulerLeaderElectionConfiguration, out *v1alpha1.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { - if err := autoConvert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in, out, s); err != nil { - return err - } - out.ResourceNamespace = in.ResourceNamespace - out.LockObjectNamespace = in.ResourceNamespace - out.ResourceName = in.ResourceName - out.LockObjectName = in.ResourceName - return nil -} - -func Convert_v1alpha1_Plugins_To_config_Plugins(in *v1alpha1.Plugins, out *config.Plugins, s conversion.Scope) error { - if err := autoConvert_v1alpha1_Plugins_To_config_Plugins(in, out, s); err != nil { - return err - } - - if in.PostFilter != nil { - postFilter, preScore := &in.PostFilter, &out.PreScore - *preScore = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*postFilter, *preScore, s); err != nil { - return err - } - } else { - out.PreScore = nil - } - - return nil -} - -func Convert_config_Plugins_To_v1alpha1_Plugins(in *config.Plugins, out *v1alpha1.Plugins, s conversion.Scope) error { - if err := autoConvert_config_Plugins_To_v1alpha1_Plugins(in, out, s); err != nil { - return err - } - - if in.PreScore != nil { - preScore, postFilter := &in.PreScore, &out.PostFilter - *postFilter = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*preScore, *postFilter, s); err != nil { - return err - } - } else { - out.PostFilter = nil - } - - return nil -} diff --git a/pkg/scheduler/apis/config/v1alpha1/conversion_test.go b/pkg/scheduler/apis/config/v1alpha1/conversion_test.go deleted file mode 100644 index 15c4c49eacd..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/conversion_test.go +++ /dev/null @@ -1,526 +0,0 @@ -/* -Copyright 2019 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 ( - "testing" - - "github.com/google/go-cmp/cmp" - - "k8s.io/apimachinery/pkg/conversion" - "k8s.io/apimachinery/pkg/runtime" - componentbaseconfig "k8s.io/component-base/config" - componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1" - "k8s.io/kube-scheduler/config/v1alpha1" - "k8s.io/kubernetes/pkg/scheduler/apis/config" - "k8s.io/utils/pointer" -) - -func TestConvertKubeSchedulerConfiguration(t *testing.T) { - cases := []struct { - name string - cfg v1alpha1.KubeSchedulerConfiguration - want config.KubeSchedulerConfiguration - }{ - { - name: "scheduler name", - cfg: v1alpha1.KubeSchedulerConfiguration{ - SchedulerName: pointer.StringPtr("custom-name"), - }, - want: config.KubeSchedulerConfiguration{ - Profiles: []config.KubeSchedulerProfile{ - {SchedulerName: "custom-name"}, - }, - }, - }, - { - name: "plugins and plugin config", - cfg: v1alpha1.KubeSchedulerConfiguration{ - Plugins: &v1alpha1.Plugins{ - QueueSort: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "FooPlugin"}, - }, - }, - }, - PluginConfig: []v1alpha1.PluginConfig{ - {Name: "FooPlugin"}, - }, - }, - want: config.KubeSchedulerConfiguration{ - Profiles: []config.KubeSchedulerProfile{ - { - Plugins: &config.Plugins{ - QueueSort: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "FooPlugin"}, - }, - }, - }, - PluginConfig: []config.PluginConfig{ - {Name: "FooPlugin"}, - }, - }, - }, - }, - }, - { - name: "custom hard pod affinity weight", - cfg: v1alpha1.KubeSchedulerConfiguration{ - HardPodAffinitySymmetricWeight: pointer.Int32Ptr(3), - }, - want: config.KubeSchedulerConfiguration{ - Profiles: []config.KubeSchedulerProfile{ - { - PluginConfig: []config.PluginConfig{ - { - Name: "InterPodAffinity", - Args: runtime.Unknown{ - Raw: []byte(`{"hardPodAffinityWeight":3}`), - }, - }, - }, - }, - }, - }, - }, - { - name: "custom hard pod affinity weight and existing PluginConfig", - cfg: v1alpha1.KubeSchedulerConfiguration{ - HardPodAffinitySymmetricWeight: pointer.Int32Ptr(3), - PluginConfig: []v1alpha1.PluginConfig{ - { - Name: "InterPodAffinity", - Args: runtime.Unknown{ - Raw: []byte(`{"hardPodAffinityWeight":5}`), - }, - }, - }, - }, - want: config.KubeSchedulerConfiguration{ - Profiles: []config.KubeSchedulerProfile{ - { - PluginConfig: []config.PluginConfig{ - { - Name: "InterPodAffinity", - Args: runtime.Unknown{ - Raw: []byte(`{"hardPodAffinityWeight":5}`), - }, - }, - { - Name: "InterPodAffinity", - Args: runtime.Unknown{ - Raw: []byte(`{"hardPodAffinityWeight":3}`), - }, - }, - }, - }, - }, - }, - }, - } - scheme := getScheme(t) - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - var out config.KubeSchedulerConfiguration - err := scheme.Convert(&tc.cfg, &out, nil) - if err != nil { - t.Fatal(err) - } - if diff := cmp.Diff(tc.want, out); diff != "" { - t.Errorf("unexpected conversion (-want, +got):\n%s", diff) - } - }) - } -} - -func TestV1alpha1ToConfigKubeSchedulerLeaderElectionConfiguration(t *testing.T) { - configuration := &v1alpha1.KubeSchedulerLeaderElectionConfiguration{ - LockObjectName: "name", - LockObjectNamespace: "namespace", - LeaderElectionConfiguration: componentbaseconfigv1alpha1.LeaderElectionConfiguration{ - ResourceName: "name", - ResourceNamespace: "namespace", - }, - } - emptyLockObjectNameConfig := configuration.DeepCopy() - emptyLockObjectNameConfig.LockObjectName = "" - - emptyLockObjectNamespaceConfig := configuration.DeepCopy() - emptyLockObjectNamespaceConfig.LockObjectNamespace = "" - - emptyResourceNameConfig := configuration.DeepCopy() - emptyResourceNameConfig.ResourceName = "" - - emptyResourceNamespaceConfig := configuration.DeepCopy() - emptyResourceNamespaceConfig.ResourceNamespace = "" - - differentNameConfig := configuration.DeepCopy() - differentNameConfig.LockObjectName = "name1" - - differentNamespaceConfig := configuration.DeepCopy() - differentNamespaceConfig.LockObjectNamespace = "namespace1" - - emptyconfig := &v1alpha1.KubeSchedulerLeaderElectionConfiguration{} - - scenarios := map[string]struct { - expectedResourceNamespace string - expectedResourceName string - expectedToFailed bool - config *v1alpha1.KubeSchedulerLeaderElectionConfiguration - }{ - "both-set-same-name-and-namespace": { - expectedResourceNamespace: "namespace", - expectedResourceName: "name", - expectedToFailed: false, - config: configuration, - }, - "not-set-lock-object-name": { - expectedResourceNamespace: "namespace", - expectedResourceName: "name", - expectedToFailed: false, - config: emptyLockObjectNameConfig, - }, - "not-set-lock-object-namespace": { - expectedResourceNamespace: "namespace", - expectedResourceName: "name", - expectedToFailed: false, - config: emptyLockObjectNamespaceConfig, - }, - "not-set-resource-name": { - expectedResourceNamespace: "namespace", - expectedResourceName: "name", - expectedToFailed: false, - config: emptyResourceNameConfig, - }, - "not-set-resource-namespace": { - expectedResourceNamespace: "namespace", - expectedResourceName: "name", - expectedToFailed: false, - config: emptyResourceNamespaceConfig, - }, - "set-different-name": { - expectedResourceNamespace: "", - expectedResourceName: "", - expectedToFailed: true, - config: differentNameConfig, - }, - "set-different-namespace": { - expectedResourceNamespace: "", - expectedResourceName: "", - expectedToFailed: true, - config: differentNamespaceConfig, - }, - "set-empty-name-and-namespace": { - expectedResourceNamespace: "", - expectedResourceName: "", - expectedToFailed: false, - config: emptyconfig, - }, - } - for name, scenario := range scenarios { - out := &config.KubeSchedulerLeaderElectionConfiguration{} - s := conversion.Scope(nil) - err := Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(scenario.config, out, s) - if err == nil && scenario.expectedToFailed { - t.Errorf("Unexpected success for scenario: %s", name) - } - if err == nil && !scenario.expectedToFailed { - if out.ResourceName != scenario.expectedResourceName { - t.Errorf("Unexpected success for scenario: %s, out.ResourceName: %s, expectedResourceName: %s", name, out.ResourceName, scenario.expectedResourceName) - } - if out.ResourceNamespace != scenario.expectedResourceNamespace { - t.Errorf("Unexpected success for scenario: %s, out.ResourceNamespace: %s, expectedResourceNamespace: %s", name, out.ResourceNamespace, scenario.expectedResourceNamespace) - } - } - if err != nil && !scenario.expectedToFailed { - t.Errorf("Unexpected failure for scenario: %s - %+v", name, err) - } - } -} - -func TestConfigToV1alpha1KubeSchedulerLeaderElectionConfiguration(t *testing.T) { - configuration := &config.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - ResourceName: "name", - ResourceNamespace: "namespace", - }, - } - emptyconfig := &config.KubeSchedulerLeaderElectionConfiguration{} - - scenarios := map[string]struct { - expectedResourceNamespace string - expectedResourceName string - expectedLockObjectNamespace string - expectedLockObjectName string - expectedToFailed bool - config *config.KubeSchedulerLeaderElectionConfiguration - }{ - "both-set-name-and-namespace": { - expectedResourceNamespace: "namespace", - expectedResourceName: "name", - expectedLockObjectNamespace: "namespace", - expectedLockObjectName: "name", - expectedToFailed: false, - config: configuration, - }, - "set-empty-name-and-namespace": { - expectedResourceNamespace: "", - expectedResourceName: "", - expectedLockObjectNamespace: "", - expectedLockObjectName: "", - expectedToFailed: false, - config: emptyconfig, - }, - } - for name, scenario := range scenarios { - out := &v1alpha1.KubeSchedulerLeaderElectionConfiguration{} - s := conversion.Scope(nil) - err := Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(scenario.config, out, s) - if err == nil && scenario.expectedToFailed { - t.Errorf("Unexpected success for scenario: %s", name) - } - if err == nil && !scenario.expectedToFailed { - if out.ResourceName != scenario.expectedResourceName { - t.Errorf("Unexpected success for scenario: %s, out.ResourceName: %s, expectedResourceName: %s", name, out.ResourceName, scenario.expectedResourceName) - } - if out.LockObjectName != scenario.expectedLockObjectName { - t.Errorf("Unexpected success for scenario: %s, out.LockObjectName: %s, expectedLockObjectName: %s", name, out.LockObjectName, scenario.expectedLockObjectName) - } - if out.ResourceNamespace != scenario.expectedResourceNamespace { - t.Errorf("Unexpected success for scenario: %s, out.ResourceNamespace: %s, expectedResourceNamespace: %s", name, out.ResourceNamespace, scenario.expectedResourceNamespace) - } - if out.LockObjectNamespace != scenario.expectedLockObjectNamespace { - t.Errorf("Unexpected success for scenario: %s, out.LockObjectNamespace: %s, expectedLockObjectNamespace: %s", name, out.LockObjectNamespace, scenario.expectedLockObjectNamespace) - } - } - if err != nil && !scenario.expectedToFailed { - t.Errorf("Unexpected failure for scenario: %s - %+v", name, err) - } - } -} - -func TestConvertBetweenV1Alpha1PluginsAndConfigPlugins(t *testing.T) { - // weight is assigned to score plugins - weight := int32(10) - // DummyWeight is a placeholder for the v1alpha1.plugins' weight will be filled with zero when - // convert back from config. - dummyWeight := int32(42) - v1alpha1Plugins := v1alpha1.Plugins{ - QueueSort: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "queuesort-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-queuesort-plugin", Weight: &dummyWeight}, - }, - }, - PreFilter: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "prefilter-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-prefilter-plugin", Weight: &dummyWeight}, - }, - }, - Filter: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "filter-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-filter-plugin", Weight: &dummyWeight}, - }, - }, - PostFilter: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "postfilter-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-postfilter-plugin", Weight: &dummyWeight}, - }, - }, - Score: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "score-plugin", Weight: &weight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-score-plugin", Weight: &weight}, - }, - }, - Reserve: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "reserve-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-reserve-plugin", Weight: &dummyWeight}, - }, - }, - Permit: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "permit-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-permit-plugin", Weight: &dummyWeight}, - }, - }, - PreBind: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "prebind-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-prebind-plugin", Weight: &dummyWeight}, - }, - }, - Bind: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "bind-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-bind-plugin", Weight: &dummyWeight}, - }, - }, - PostBind: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "postbind-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-postbind-plugin", Weight: &dummyWeight}, - }, - }, - Unreserve: &v1alpha1.PluginSet{ - Enabled: []v1alpha1.Plugin{ - {Name: "unreserve-plugin", Weight: &dummyWeight}, - }, - Disabled: []v1alpha1.Plugin{ - {Name: "disabled-unreserve-plugin", Weight: &dummyWeight}, - }, - }, - } - configPlugins := config.Plugins{ - QueueSort: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "queuesort-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-queuesort-plugin", Weight: dummyWeight}, - }, - }, - PreFilter: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "prefilter-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-prefilter-plugin", Weight: dummyWeight}, - }, - }, - Filter: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "filter-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-filter-plugin", Weight: dummyWeight}, - }, - }, - PreScore: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "postfilter-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-postfilter-plugin", Weight: dummyWeight}, - }, - }, - Score: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "score-plugin", Weight: weight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-score-plugin", Weight: weight}, - }, - }, - Reserve: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "reserve-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-reserve-plugin", Weight: dummyWeight}, - }, - }, - Permit: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "permit-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-permit-plugin", Weight: dummyWeight}, - }, - }, - PreBind: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "prebind-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-prebind-plugin", Weight: dummyWeight}, - }, - }, - Bind: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "bind-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-bind-plugin", Weight: dummyWeight}, - }, - }, - PostBind: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "postbind-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-postbind-plugin", Weight: dummyWeight}, - }, - }, - Unreserve: &config.PluginSet{ - Enabled: []config.Plugin{ - {Name: "unreserve-plugin", Weight: dummyWeight}, - }, - Disabled: []config.Plugin{ - {Name: "disabled-unreserve-plugin", Weight: dummyWeight}, - }, - }, - } - convertedConfigPlugins := config.Plugins{} - convertedV1Alpha1Plugins := v1alpha1.Plugins{} - scheme := getScheme(t) - if err := scheme.Convert(&v1alpha1Plugins, &convertedConfigPlugins, nil); err != nil { - t.Fatal(err) - } - if err := scheme.Convert(&configPlugins, &convertedV1Alpha1Plugins, nil); err != nil { - t.Fatal(err) - } - if diff := cmp.Diff(configPlugins, convertedConfigPlugins); diff != "" { - t.Errorf("unexpected plugins diff (-want, +got): %s", diff) - } - if diff := cmp.Diff(v1alpha1Plugins, convertedV1Alpha1Plugins); diff != "" { - t.Errorf("unexpected plugins diff (-want, +got): %s", diff) - } -} - -func getScheme(t *testing.T) *runtime.Scheme { - scheme := runtime.NewScheme() - if err := AddToScheme(scheme); err != nil { - t.Fatal(err) - } - return scheme -} diff --git a/pkg/scheduler/apis/config/v1alpha1/defaults.go b/pkg/scheduler/apis/config/v1alpha1/defaults.go deleted file mode 100644 index b298e8d9ac8..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/defaults.go +++ /dev/null @@ -1,166 +0,0 @@ -/* -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" - componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1" - kubeschedulerconfigv1alpha1 "k8s.io/kube-scheduler/config/v1alpha1" - "k8s.io/kubernetes/pkg/scheduler/apis/config" - - // this package shouldn't really depend on other k8s.io/kubernetes code - api "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/master/ports" -) - -func addDefaultingFuncs(scheme *runtime.Scheme) error { - return RegisterDefaults(scheme) -} - -// SetDefaults_KubeSchedulerConfiguration sets additional defaults -func SetDefaults_KubeSchedulerConfiguration(obj *kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration) { - if obj.SchedulerName == nil { - val := api.DefaultSchedulerName - obj.SchedulerName = &val - } - - if obj.AlgorithmSource.Policy == nil && - (obj.AlgorithmSource.Provider == nil || len(*obj.AlgorithmSource.Provider) == 0) { - val := kubeschedulerconfigv1alpha1.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 - } - } - - // For Healthz and Metrics bind addresses, we want to check: - // 1. If the value is nil, default to 0.0.0.0 and default scheduler port - // 2. If there is a value set, attempt to split it. If it's just a port (ie, ":1234"), default to 0.0.0.0 with that port - // 3. If splitting the value fails, check if the value is even a valid IP. If so, use that with the default port. - // Otherwise use the default bind address - defaultBindAddress := net.JoinHostPort("0.0.0.0", strconv.Itoa(ports.InsecureSchedulerPort)) - if obj.HealthzBindAddress == nil { - obj.HealthzBindAddress = &defaultBindAddress - } else { - if host, port, err := net.SplitHostPort(*obj.HealthzBindAddress); err == nil { - if len(host) == 0 { - host = "0.0.0.0" - } - hostPort := net.JoinHostPort(host, port) - obj.HealthzBindAddress = &hostPort - } else { - // Something went wrong splitting the host/port, could just be a missing port so check if the - // existing value is a valid IP address. If so, use that with the default scheduler port - if host := net.ParseIP(*obj.HealthzBindAddress); host != nil { - hostPort := net.JoinHostPort(*obj.HealthzBindAddress, strconv.Itoa(ports.InsecureSchedulerPort)) - obj.HealthzBindAddress = &hostPort - } else { - // TODO: in v1beta1 we should let this error instead of stomping with a default value - obj.HealthzBindAddress = &defaultBindAddress - } - } - } - - if obj.MetricsBindAddress == nil { - obj.MetricsBindAddress = &defaultBindAddress - } else { - if host, port, err := net.SplitHostPort(*obj.MetricsBindAddress); err == nil { - if len(host) == 0 { - host = "0.0.0.0" - } - hostPort := net.JoinHostPort(host, port) - obj.MetricsBindAddress = &hostPort - } else { - // Something went wrong splitting the host/port, could just be a missing port so check if the - // existing value is a valid IP address. If so, use that with the default scheduler port - if host := net.ParseIP(*obj.MetricsBindAddress); host != nil { - hostPort := net.JoinHostPort(*obj.MetricsBindAddress, strconv.Itoa(ports.InsecureSchedulerPort)) - obj.MetricsBindAddress = &hostPort - } else { - // TODO: in v1beta1 we should let this error instead of stomping with a default value - obj.MetricsBindAddress = &defaultBindAddress - } - } - } - - if obj.DisablePreemption == nil { - disablePreemption := false - obj.DisablePreemption = &disablePreemption - } - - if obj.PercentageOfNodesToScore == nil { - percentageOfNodesToScore := int32(config.DefaultPercentageOfNodesToScore) - obj.PercentageOfNodesToScore = &percentageOfNodesToScore - } - - if len(obj.LeaderElection.ResourceLock) == 0 { - obj.LeaderElection.ResourceLock = "endpointsleases" - } - if len(obj.LeaderElection.LockObjectNamespace) == 0 && len(obj.LeaderElection.ResourceNamespace) == 0 { - obj.LeaderElection.LockObjectNamespace = kubeschedulerconfigv1alpha1.SchedulerDefaultLockObjectNamespace - } - if len(obj.LeaderElection.LockObjectName) == 0 && len(obj.LeaderElection.ResourceName) == 0 { - obj.LeaderElection.LockObjectName = kubeschedulerconfigv1alpha1.SchedulerDefaultLockObjectName - } - - 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 - componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection.LeaderElectionConfiguration) - - if obj.BindTimeoutSeconds == nil { - val := int64(600) - obj.BindTimeoutSeconds = &val - } - - if obj.PodInitialBackoffSeconds == nil { - val := int64(1) - obj.PodInitialBackoffSeconds = &val - } - - if obj.PodMaxBackoffSeconds == nil { - val := int64(10) - obj.PodMaxBackoffSeconds = &val - } - - // Enable profiling by default in the scheduler - if obj.EnableProfiling == nil { - enableProfiling := true - obj.EnableProfiling = &enableProfiling - } - - // Enable contention profiling by default if profiling is enabled - if *obj.EnableProfiling && obj.EnableContentionProfiling == nil { - enableContentionProfiling := true - obj.EnableContentionProfiling = &enableContentionProfiling - } -} diff --git a/pkg/scheduler/apis/config/v1alpha1/defaults_test.go b/pkg/scheduler/apis/config/v1alpha1/defaults_test.go deleted file mode 100644 index bf8c00e3eff..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/defaults_test.go +++ /dev/null @@ -1,207 +0,0 @@ -/* -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 ( - "testing" - "time" - - "github.com/google/go-cmp/cmp" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - componentbaseconfig "k8s.io/component-base/config/v1alpha1" - kubeschedulerconfigv1alpha1 "k8s.io/kube-scheduler/config/v1alpha1" - "k8s.io/utils/pointer" -) - -func TestSchedulerDefaults(t *testing.T) { - enable := true - tests := []struct { - name string - config *kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration - expected *kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration - }{ - { - name: "empty config", - config: &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{}, - expected: &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{ - SchedulerName: pointer.StringPtr("default-scheduler"), - AlgorithmSource: kubeschedulerconfigv1alpha1.SchedulerAlgorithmSource{Provider: pointer.StringPtr("DefaultProvider")}, - HealthzBindAddress: pointer.StringPtr("0.0.0.0:10251"), - MetricsBindAddress: pointer.StringPtr("0.0.0.0:10251"), - DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ - EnableProfiling: &enable, - EnableContentionProfiling: &enable, - }, - LeaderElection: kubeschedulerconfigv1alpha1.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: pointer.BoolPtr(true), - LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, - RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, - RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, - ResourceLock: "endpointsleases", - ResourceNamespace: "", - ResourceName: "", - }, - LockObjectName: "kube-scheduler", - LockObjectNamespace: "kube-system", - }, - ClientConnection: componentbaseconfig.ClientConnectionConfiguration{ - QPS: 50, - Burst: 100, - ContentType: "application/vnd.kubernetes.protobuf", - }, - DisablePreemption: pointer.BoolPtr(false), - PercentageOfNodesToScore: pointer.Int32Ptr(0), - BindTimeoutSeconds: pointer.Int64Ptr(600), - PodInitialBackoffSeconds: pointer.Int64Ptr(1), - PodMaxBackoffSeconds: pointer.Int64Ptr(10), - Plugins: nil, - }, - }, - { - name: "custom hard pod affinity", - config: &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{ - HardPodAffinitySymmetricWeight: pointer.Int32Ptr(42), - }, - expected: &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{ - SchedulerName: pointer.StringPtr("default-scheduler"), - AlgorithmSource: kubeschedulerconfigv1alpha1.SchedulerAlgorithmSource{Provider: pointer.StringPtr("DefaultProvider")}, - HardPodAffinitySymmetricWeight: pointer.Int32Ptr(42), - HealthzBindAddress: pointer.StringPtr("0.0.0.0:10251"), - MetricsBindAddress: pointer.StringPtr("0.0.0.0:10251"), - DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ - EnableProfiling: &enable, - EnableContentionProfiling: &enable, - }, - LeaderElection: kubeschedulerconfigv1alpha1.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: pointer.BoolPtr(true), - LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, - RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, - RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, - ResourceLock: "endpointsleases", - ResourceNamespace: "", - ResourceName: "", - }, - LockObjectName: "kube-scheduler", - LockObjectNamespace: "kube-system", - }, - ClientConnection: componentbaseconfig.ClientConnectionConfiguration{ - QPS: 50, - Burst: 100, - ContentType: "application/vnd.kubernetes.protobuf", - }, - DisablePreemption: pointer.BoolPtr(false), - PercentageOfNodesToScore: pointer.Int32Ptr(0), - BindTimeoutSeconds: pointer.Int64Ptr(600), - PodInitialBackoffSeconds: pointer.Int64Ptr(1), - PodMaxBackoffSeconds: pointer.Int64Ptr(10), - Plugins: nil, - }, - }, - { - name: "metrics and healthz address with no port", - config: &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{ - MetricsBindAddress: pointer.StringPtr("1.2.3.4"), - HealthzBindAddress: pointer.StringPtr("1.2.3.4"), - }, - expected: &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{ - SchedulerName: pointer.StringPtr("default-scheduler"), - AlgorithmSource: kubeschedulerconfigv1alpha1.SchedulerAlgorithmSource{Provider: pointer.StringPtr("DefaultProvider")}, - HealthzBindAddress: pointer.StringPtr("1.2.3.4:10251"), - MetricsBindAddress: pointer.StringPtr("1.2.3.4:10251"), - DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ - EnableProfiling: &enable, - EnableContentionProfiling: &enable, - }, - LeaderElection: kubeschedulerconfigv1alpha1.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: pointer.BoolPtr(true), - LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, - RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, - RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, - ResourceLock: "endpointsleases", - ResourceNamespace: "", - ResourceName: "", - }, - LockObjectName: "kube-scheduler", - LockObjectNamespace: "kube-system", - }, - ClientConnection: componentbaseconfig.ClientConnectionConfiguration{ - QPS: 50, - Burst: 100, - ContentType: "application/vnd.kubernetes.protobuf", - }, - DisablePreemption: pointer.BoolPtr(false), - PercentageOfNodesToScore: pointer.Int32Ptr(0), - BindTimeoutSeconds: pointer.Int64Ptr(600), - PodInitialBackoffSeconds: pointer.Int64Ptr(1), - PodMaxBackoffSeconds: pointer.Int64Ptr(10), - Plugins: nil, - }, - }, - { - name: "metrics and healthz port with no address", - config: &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{ - MetricsBindAddress: pointer.StringPtr(":12345"), - HealthzBindAddress: pointer.StringPtr(":12345"), - }, - expected: &kubeschedulerconfigv1alpha1.KubeSchedulerConfiguration{ - SchedulerName: pointer.StringPtr("default-scheduler"), - AlgorithmSource: kubeschedulerconfigv1alpha1.SchedulerAlgorithmSource{Provider: pointer.StringPtr("DefaultProvider")}, - HealthzBindAddress: pointer.StringPtr("0.0.0.0:12345"), - MetricsBindAddress: pointer.StringPtr("0.0.0.0:12345"), - DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ - EnableProfiling: &enable, - EnableContentionProfiling: &enable, - }, - LeaderElection: kubeschedulerconfigv1alpha1.KubeSchedulerLeaderElectionConfiguration{ - LeaderElectionConfiguration: componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: pointer.BoolPtr(true), - LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, - RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, - RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, - ResourceLock: "endpointsleases", - ResourceNamespace: "", - ResourceName: "", - }, - LockObjectName: "kube-scheduler", - LockObjectNamespace: "kube-system", - }, - ClientConnection: componentbaseconfig.ClientConnectionConfiguration{ - QPS: 50, - Burst: 100, - ContentType: "application/vnd.kubernetes.protobuf", - }, - DisablePreemption: pointer.BoolPtr(false), - PercentageOfNodesToScore: pointer.Int32Ptr(0), - BindTimeoutSeconds: pointer.Int64Ptr(600), - PodInitialBackoffSeconds: pointer.Int64Ptr(1), - PodMaxBackoffSeconds: pointer.Int64Ptr(10), - Plugins: nil, - }, - }, - } - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - SetDefaults_KubeSchedulerConfiguration(tc.config) - if diff := cmp.Diff(tc.expected, tc.config); diff != "" { - t.Errorf("wrong defaults set (-want, +got):\n%s", diff) - } - }) - } -} diff --git a/pkg/scheduler/apis/config/v1alpha1/doc.go b/pkg/scheduler/apis/config/v1alpha1/doc.go deleted file mode 100644 index 44518561fdd..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -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 -// +groupName=kubescheduler.config.k8s.io - -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 deleted file mode 100644 index 0e9db36a6b2..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/register.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -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 used 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 extends the SchemeBuilder instance with the external types. In this package, - // defaulting and conversion init funcs are registered as well. - localSchemeBuilder = &kubeschedulerconfigv1alpha1.SchemeBuilder - // AddToScheme is a global function that registers this API group & version to a scheme - 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 deleted file mode 100644 index 1bd3b1a3efb..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/zz_generated.conversion.go +++ /dev/null @@ -1,624 +0,0 @@ -// +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" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - componentbaseconfigv1alpha1 "k8s.io/component-base/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.Plugin)(nil), (*config.Plugin)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_Plugin_To_config_Plugin(a.(*v1alpha1.Plugin), b.(*config.Plugin), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*config.Plugin)(nil), (*v1alpha1.Plugin)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_config_Plugin_To_v1alpha1_Plugin(a.(*config.Plugin), b.(*v1alpha1.Plugin), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha1.PluginConfig)(nil), (*config.PluginConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PluginConfig_To_config_PluginConfig(a.(*v1alpha1.PluginConfig), b.(*config.PluginConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*config.PluginConfig)(nil), (*v1alpha1.PluginConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_config_PluginConfig_To_v1alpha1_PluginConfig(a.(*config.PluginConfig), b.(*v1alpha1.PluginConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha1.PluginSet)(nil), (*config.PluginSet)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PluginSet_To_config_PluginSet(a.(*v1alpha1.PluginSet), b.(*config.PluginSet), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*config.PluginSet)(nil), (*v1alpha1.PluginSet)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_config_PluginSet_To_v1alpha1_PluginSet(a.(*config.PluginSet), b.(*v1alpha1.PluginSet), 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 - } - if err := s.AddConversionFunc((*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.AddConversionFunc((*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.AddConversionFunc((*config.Plugins)(nil), (*v1alpha1.Plugins)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_config_Plugins_To_v1alpha1_Plugins(a.(*config.Plugins), b.(*v1alpha1.Plugins), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*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.AddConversionFunc((*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.AddConversionFunc((*v1alpha1.Plugins)(nil), (*config.Plugins)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_Plugins_To_config_Plugins(a.(*v1alpha1.Plugins), b.(*config.Plugins), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConfiguration(in *v1alpha1.KubeSchedulerConfiguration, out *config.KubeSchedulerConfiguration, s conversion.Scope) error { - // WARNING: in.SchedulerName requires manual conversion: does not exist in peer-type - if err := Convert_v1alpha1_SchedulerAlgorithmSource_To_config_SchedulerAlgorithmSource(&in.AlgorithmSource, &out.AlgorithmSource, s); err != nil { - return err - } - // WARNING: in.HardPodAffinitySymmetricWeight requires manual conversion: does not exist in peer-type - if err := Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { - return err - } - if err := componentbaseconfigv1alpha1.Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil { - return err - } - if err := v1.Convert_Pointer_string_To_string(&in.HealthzBindAddress, &out.HealthzBindAddress, s); err != nil { - return err - } - if err := v1.Convert_Pointer_string_To_string(&in.MetricsBindAddress, &out.MetricsBindAddress, s); err != nil { - return err - } - if err := componentbaseconfigv1alpha1.Convert_v1alpha1_DebuggingConfiguration_To_config_DebuggingConfiguration(&in.DebuggingConfiguration, &out.DebuggingConfiguration, s); err != nil { - return err - } - if err := v1.Convert_Pointer_bool_To_bool(&in.DisablePreemption, &out.DisablePreemption, s); err != nil { - return err - } - if err := v1.Convert_Pointer_int32_To_int32(&in.PercentageOfNodesToScore, &out.PercentageOfNodesToScore, s); err != nil { - return err - } - if err := v1.Convert_Pointer_int64_To_int64(&in.BindTimeoutSeconds, &out.BindTimeoutSeconds, s); err != nil { - return err - } - if err := v1.Convert_Pointer_int64_To_int64(&in.PodInitialBackoffSeconds, &out.PodInitialBackoffSeconds, s); err != nil { - return err - } - if err := v1.Convert_Pointer_int64_To_int64(&in.PodMaxBackoffSeconds, &out.PodMaxBackoffSeconds, s); err != nil { - return err - } - // WARNING: in.Plugins requires manual conversion: does not exist in peer-type - // WARNING: in.PluginConfig requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_config_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *config.KubeSchedulerConfiguration, out *v1alpha1.KubeSchedulerConfiguration, s conversion.Scope) error { - if err := Convert_config_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource(&in.AlgorithmSource, &out.AlgorithmSource, s); err != nil { - return err - } - if err := Convert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { - return err - } - if err := componentbaseconfigv1alpha1.Convert_config_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil { - return err - } - if err := v1.Convert_string_To_Pointer_string(&in.HealthzBindAddress, &out.HealthzBindAddress, s); err != nil { - return err - } - if err := v1.Convert_string_To_Pointer_string(&in.MetricsBindAddress, &out.MetricsBindAddress, s); err != nil { - return err - } - if err := componentbaseconfigv1alpha1.Convert_config_DebuggingConfiguration_To_v1alpha1_DebuggingConfiguration(&in.DebuggingConfiguration, &out.DebuggingConfiguration, s); err != nil { - return err - } - if err := v1.Convert_bool_To_Pointer_bool(&in.DisablePreemption, &out.DisablePreemption, s); err != nil { - return err - } - if err := v1.Convert_int32_To_Pointer_int32(&in.PercentageOfNodesToScore, &out.PercentageOfNodesToScore, s); err != nil { - return err - } - if err := v1.Convert_int64_To_Pointer_int64(&in.BindTimeoutSeconds, &out.BindTimeoutSeconds, s); err != nil { - return err - } - if err := v1.Convert_int64_To_Pointer_int64(&in.PodInitialBackoffSeconds, &out.PodInitialBackoffSeconds, s); err != nil { - return err - } - if err := v1.Convert_int64_To_Pointer_int64(&in.PodMaxBackoffSeconds, &out.PodMaxBackoffSeconds, s); err != nil { - return err - } - // WARNING: in.Profiles requires manual conversion: does not exist in peer-type - // WARNING: in.Extenders requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(in *v1alpha1.KubeSchedulerLeaderElectionConfiguration, out *config.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { - if err := componentbaseconfigv1alpha1.Convert_v1alpha1_LeaderElectionConfiguration_To_config_LeaderElectionConfiguration(&in.LeaderElectionConfiguration, &out.LeaderElectionConfiguration, s); err != nil { - return err - } - // WARNING: in.LockObjectNamespace requires manual conversion: does not exist in peer-type - // WARNING: in.LockObjectName requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_config_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration(in *config.KubeSchedulerLeaderElectionConfiguration, out *v1alpha1.KubeSchedulerLeaderElectionConfiguration, s conversion.Scope) error { - if err := componentbaseconfigv1alpha1.Convert_config_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElectionConfiguration, &out.LeaderElectionConfiguration, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha1_Plugin_To_config_Plugin(in *v1alpha1.Plugin, out *config.Plugin, s conversion.Scope) error { - out.Name = in.Name - if err := v1.Convert_Pointer_int32_To_int32(&in.Weight, &out.Weight, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_Plugin_To_config_Plugin is an autogenerated conversion function. -func Convert_v1alpha1_Plugin_To_config_Plugin(in *v1alpha1.Plugin, out *config.Plugin, s conversion.Scope) error { - return autoConvert_v1alpha1_Plugin_To_config_Plugin(in, out, s) -} - -func autoConvert_config_Plugin_To_v1alpha1_Plugin(in *config.Plugin, out *v1alpha1.Plugin, s conversion.Scope) error { - out.Name = in.Name - if err := v1.Convert_int32_To_Pointer_int32(&in.Weight, &out.Weight, s); err != nil { - return err - } - return nil -} - -// Convert_config_Plugin_To_v1alpha1_Plugin is an autogenerated conversion function. -func Convert_config_Plugin_To_v1alpha1_Plugin(in *config.Plugin, out *v1alpha1.Plugin, s conversion.Scope) error { - return autoConvert_config_Plugin_To_v1alpha1_Plugin(in, out, s) -} - -func autoConvert_v1alpha1_PluginConfig_To_config_PluginConfig(in *v1alpha1.PluginConfig, out *config.PluginConfig, s conversion.Scope) error { - out.Name = in.Name - out.Args = in.Args - return nil -} - -// Convert_v1alpha1_PluginConfig_To_config_PluginConfig is an autogenerated conversion function. -func Convert_v1alpha1_PluginConfig_To_config_PluginConfig(in *v1alpha1.PluginConfig, out *config.PluginConfig, s conversion.Scope) error { - return autoConvert_v1alpha1_PluginConfig_To_config_PluginConfig(in, out, s) -} - -func autoConvert_config_PluginConfig_To_v1alpha1_PluginConfig(in *config.PluginConfig, out *v1alpha1.PluginConfig, s conversion.Scope) error { - out.Name = in.Name - out.Args = in.Args - return nil -} - -// Convert_config_PluginConfig_To_v1alpha1_PluginConfig is an autogenerated conversion function. -func Convert_config_PluginConfig_To_v1alpha1_PluginConfig(in *config.PluginConfig, out *v1alpha1.PluginConfig, s conversion.Scope) error { - return autoConvert_config_PluginConfig_To_v1alpha1_PluginConfig(in, out, s) -} - -func autoConvert_v1alpha1_PluginSet_To_config_PluginSet(in *v1alpha1.PluginSet, out *config.PluginSet, s conversion.Scope) error { - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - *out = make([]config.Plugin, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_Plugin_To_config_Plugin(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Enabled = nil - } - if in.Disabled != nil { - in, out := &in.Disabled, &out.Disabled - *out = make([]config.Plugin, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_Plugin_To_config_Plugin(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Disabled = nil - } - return nil -} - -// Convert_v1alpha1_PluginSet_To_config_PluginSet is an autogenerated conversion function. -func Convert_v1alpha1_PluginSet_To_config_PluginSet(in *v1alpha1.PluginSet, out *config.PluginSet, s conversion.Scope) error { - return autoConvert_v1alpha1_PluginSet_To_config_PluginSet(in, out, s) -} - -func autoConvert_config_PluginSet_To_v1alpha1_PluginSet(in *config.PluginSet, out *v1alpha1.PluginSet, s conversion.Scope) error { - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - *out = make([]v1alpha1.Plugin, len(*in)) - for i := range *in { - if err := Convert_config_Plugin_To_v1alpha1_Plugin(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Enabled = nil - } - if in.Disabled != nil { - in, out := &in.Disabled, &out.Disabled - *out = make([]v1alpha1.Plugin, len(*in)) - for i := range *in { - if err := Convert_config_Plugin_To_v1alpha1_Plugin(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Disabled = nil - } - return nil -} - -// Convert_config_PluginSet_To_v1alpha1_PluginSet is an autogenerated conversion function. -func Convert_config_PluginSet_To_v1alpha1_PluginSet(in *config.PluginSet, out *v1alpha1.PluginSet, s conversion.Scope) error { - return autoConvert_config_PluginSet_To_v1alpha1_PluginSet(in, out, s) -} - -func autoConvert_v1alpha1_Plugins_To_config_Plugins(in *v1alpha1.Plugins, out *config.Plugins, s conversion.Scope) error { - if in.QueueSort != nil { - in, out := &in.QueueSort, &out.QueueSort - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.QueueSort = nil - } - if in.PreFilter != nil { - in, out := &in.PreFilter, &out.PreFilter - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.PreFilter = nil - } - if in.Filter != nil { - in, out := &in.Filter, &out.Filter - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Filter = nil - } - // WARNING: in.PostFilter requires manual conversion: does not exist in peer-type - if in.Score != nil { - in, out := &in.Score, &out.Score - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Score = nil - } - if in.Reserve != nil { - in, out := &in.Reserve, &out.Reserve - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Reserve = nil - } - if in.Permit != nil { - in, out := &in.Permit, &out.Permit - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Permit = nil - } - if in.PreBind != nil { - in, out := &in.PreBind, &out.PreBind - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.PreBind = nil - } - if in.Bind != nil { - in, out := &in.Bind, &out.Bind - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Bind = nil - } - if in.PostBind != nil { - in, out := &in.PostBind, &out.PostBind - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.PostBind = nil - } - if in.Unreserve != nil { - in, out := &in.Unreserve, &out.Unreserve - *out = new(config.PluginSet) - if err := Convert_v1alpha1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Unreserve = nil - } - return nil -} - -func autoConvert_config_Plugins_To_v1alpha1_Plugins(in *config.Plugins, out *v1alpha1.Plugins, s conversion.Scope) error { - if in.QueueSort != nil { - in, out := &in.QueueSort, &out.QueueSort - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.QueueSort = nil - } - if in.PreFilter != nil { - in, out := &in.PreFilter, &out.PreFilter - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.PreFilter = nil - } - if in.Filter != nil { - in, out := &in.Filter, &out.Filter - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Filter = nil - } - // WARNING: in.PreScore requires manual conversion: does not exist in peer-type - if in.Score != nil { - in, out := &in.Score, &out.Score - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Score = nil - } - if in.Reserve != nil { - in, out := &in.Reserve, &out.Reserve - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Reserve = nil - } - if in.Permit != nil { - in, out := &in.Permit, &out.Permit - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Permit = nil - } - if in.PreBind != nil { - in, out := &in.PreBind, &out.PreBind - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.PreBind = nil - } - if in.Bind != nil { - in, out := &in.Bind, &out.Bind - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Bind = nil - } - if in.PostBind != nil { - in, out := &in.PostBind, &out.PostBind - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.PostBind = nil - } - if in.Unreserve != nil { - in, out := &in.Unreserve, &out.Unreserve - *out = new(v1alpha1.PluginSet) - if err := Convert_config_PluginSet_To_v1alpha1_PluginSet(*in, *out, s); err != nil { - return err - } - } else { - out.Unreserve = nil - } - return nil -} - -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 deleted file mode 100644 index 0ec19467c40..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,21 +0,0 @@ -// +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 deleted file mode 100644 index 60e98cb8ad0..00000000000 --- a/pkg/scheduler/apis/config/v1alpha1/zz_generated.defaults.go +++ /dev/null @@ -1,40 +0,0 @@ -// +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/staging/src/k8s.io/kube-scheduler/BUILD b/staging/src/k8s.io/kube-scheduler/BUILD index 60f5cf5da45..cccb269b9bc 100644 --- a/staging/src/k8s.io/kube-scheduler/BUILD +++ b/staging/src/k8s.io/kube-scheduler/BUILD @@ -10,7 +10,6 @@ filegroup( srcs = [ ":package-srcs", "//staging/src/k8s.io/kube-scheduler/config/v1:all-srcs", - "//staging/src/k8s.io/kube-scheduler/config/v1alpha1:all-srcs", "//staging/src/k8s.io/kube-scheduler/config/v1alpha2:all-srcs", "//staging/src/k8s.io/kube-scheduler/extender/v1:all-srcs", ], diff --git a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/BUILD b/staging/src/k8s.io/kube-scheduler/config/v1alpha1/BUILD deleted file mode 100644 index d9ca51ea527..00000000000 --- a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/BUILD +++ /dev/null @@ -1,34 +0,0 @@ -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/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/component-base/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 deleted file mode 100644 index 73c9b6734e8..00000000000 --- a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -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:openapi-gen=true -// +groupName=kubescheduler.config.k8s.io - -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 deleted file mode 100644 index c42f8412fc2..00000000000 --- a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/register.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -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 used 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 is the scheme builder with scheme init functions to run for this API package - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // AddToScheme is a global function that registers this API group & version to a scheme - AddToScheme = SchemeBuilder.AddToScheme -) - -// addKnownTypes registers 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 deleted file mode 100644 index 9701792aa7a..00000000000 --- a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/types.go +++ /dev/null @@ -1,228 +0,0 @@ -/* -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 ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - componentbaseconfigv1alpha1 "k8s.io/component-base/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,omitempty"` - // 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,omitempty"` - - // 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 componentbaseconfigv1alpha1.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,omitempty"` - // 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,omitempty"` - - // DebuggingConfiguration holds configuration for Debugging related features - // TODO: We might wanna make this a substruct like Debugging componentbaseconfigv1alpha1.DebuggingConfiguration - componentbaseconfigv1alpha1.DebuggingConfiguration `json:",inline"` - - // DisablePreemption disables the pod preemption feature. - DisablePreemption *bool `json:"disablePreemption,omitempty"` - - // 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 (5%--50% based on the size of the cluster) of the - // nodes will be scored. - PercentageOfNodesToScore *int32 `json:"percentageOfNodesToScore,omitempty"` - - // Duration to wait for a binding operation to complete before timing out - // Value must be non-negative integer. The value zero indicates no waiting. - // If this value is nil, the default value will be used. - BindTimeoutSeconds *int64 `json:"bindTimeoutSeconds"` - - // PodInitialBackoffSeconds is the initial backoff for unschedulable pods. - // If specified, it must be greater than 0. If this value is null, the default value (1s) - // will be used. - PodInitialBackoffSeconds *int64 `json:"podInitialBackoffSeconds"` - - // PodMaxBackoffSeconds is the max backoff for unschedulable pods. - // If specified, it must be greater than podInitialBackoffSeconds. If this value is null, - // the default value (10s) will be used. - PodMaxBackoffSeconds *int64 `json:"podMaxBackoffSeconds"` - - // Plugins specify the set of plugins that should be enabled or disabled. Enabled plugins are the - // ones that should be enabled in addition to the default plugins. Disabled plugins are any of the - // default plugins that should be disabled. - // When no enabled or disabled plugin is specified for an extension point, default plugins for - // that extension point will be used if there is any. - Plugins *Plugins `json:"plugins,omitempty"` - - // PluginConfig is an optional set of custom plugin arguments for each plugin. - // Omitting config args for a plugin is equivalent to using the default config for that plugin. - // +listType=map - // +listMapKey=name - PluginConfig []PluginConfig `json:"pluginConfig,omitempty"` -} - -// 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 { - componentbaseconfigv1alpha1.LeaderElectionConfiguration `json:",inline"` - // LockObjectNamespace defines the namespace of the lock object - // DEPRECATED: will be removed in favor of resourceNamespace - LockObjectNamespace string `json:"lockObjectNamespace"` - // LockObjectName defines the lock object name - // DEPRECATED: will be removed in favor of resourceName - LockObjectName string `json:"lockObjectName"` -} - -// Plugins include multiple extension points. When specified, the list of plugins for -// a particular extension point are the only ones enabled. If an extension point is -// omitted from the config, then the default set of plugins is used for that extension point. -// Enabled plugins are called in the order specified here, after default plugins. If they need to -// be invoked before default plugins, default plugins must be disabled and re-enabled here in desired order. -type Plugins struct { - // QueueSort is a list of plugins that should be invoked when sorting pods in the scheduling queue. - QueueSort *PluginSet `json:"queueSort,omitempty"` - - // PreFilter is a list of plugins that should be invoked at "PreFilter" extension point of the scheduling framework. - PreFilter *PluginSet `json:"preFilter,omitempty"` - - // Filter is a list of plugins that should be invoked when filtering out nodes that cannot run the Pod. - Filter *PluginSet `json:"filter,omitempty"` - - // PostFilter is a list of plugins that are invoked after filtering out infeasible nodes. - PostFilter *PluginSet `json:"postFilter,omitempty"` - - // Score is a list of plugins that should be invoked when ranking nodes that have passed the filtering phase. - Score *PluginSet `json:"score,omitempty"` - - // Reserve is a list of plugins invoked when reserving a node to run the pod. - Reserve *PluginSet `json:"reserve,omitempty"` - - // Permit is a list of plugins that control binding of a Pod. These plugins can prevent or delay binding of a Pod. - Permit *PluginSet `json:"permit,omitempty"` - - // PreBind is a list of plugins that should be invoked before a pod is bound. - PreBind *PluginSet `json:"preBind,omitempty"` - - // Bind is a list of plugins that should be invoked at "Bind" extension point of the scheduling framework. - // The scheduler call these plugins in order. Scheduler skips the rest of these plugins as soon as one returns success. - Bind *PluginSet `json:"bind,omitempty"` - - // PostBind is a list of plugins that should be invoked after a pod is successfully bound. - PostBind *PluginSet `json:"postBind,omitempty"` - - // Unreserve is a list of plugins invoked when a pod that was previously reserved is rejected in a later phase. - Unreserve *PluginSet `json:"unreserve,omitempty"` -} - -// PluginSet specifies enabled and disabled plugins for an extension point. -// If an array is empty, missing, or nil, default plugins at that extension point will be used. -type PluginSet struct { - // Enabled specifies plugins that should be enabled in addition to default plugins. - // These are called after default plugins and in the same order specified here. - // +listType=atomic - Enabled []Plugin `json:"enabled,omitempty"` - // Disabled specifies default plugins that should be disabled. - // When all default plugins need to be disabled, an array containing only one "*" should be provided. - // +listType=map - // +listMapKey=name - Disabled []Plugin `json:"disabled,omitempty"` -} - -// Plugin specifies a plugin name and its weight when applicable. Weight is used only for Score plugins. -type Plugin struct { - // Name defines the name of plugin - Name string `json:"name"` - // Weight defines the weight of plugin, only used for Score plugins. - Weight *int32 `json:"weight,omitempty"` -} - -// PluginConfig specifies arguments that should be passed to a plugin at the time of initialization. -// A plugin that is invoked at multiple extension points is initialized once. Args can have arbitrary structure. -// It is up to the plugin to process these Args. -type PluginConfig struct { - // Name defines the name of plugin being configured - Name string `json:"name"` - // Args defines the arguments passed to the plugins at the time of initialization. Args can have arbitrary structure. - Args runtime.Unknown `json:"args,omitempty"` -} 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 deleted file mode 100644 index f81f35e5802..00000000000 --- a/staging/src/k8s.io/kube-scheduler/config/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,351 +0,0 @@ -// +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 - if in.SchedulerName != nil { - in, out := &in.SchedulerName, &out.SchedulerName - *out = new(string) - **out = **in - } - in.AlgorithmSource.DeepCopyInto(&out.AlgorithmSource) - if in.HardPodAffinitySymmetricWeight != nil { - in, out := &in.HardPodAffinitySymmetricWeight, &out.HardPodAffinitySymmetricWeight - *out = new(int32) - **out = **in - } - in.LeaderElection.DeepCopyInto(&out.LeaderElection) - out.ClientConnection = in.ClientConnection - if in.HealthzBindAddress != nil { - in, out := &in.HealthzBindAddress, &out.HealthzBindAddress - *out = new(string) - **out = **in - } - if in.MetricsBindAddress != nil { - in, out := &in.MetricsBindAddress, &out.MetricsBindAddress - *out = new(string) - **out = **in - } - in.DebuggingConfiguration.DeepCopyInto(&out.DebuggingConfiguration) - if in.DisablePreemption != nil { - in, out := &in.DisablePreemption, &out.DisablePreemption - *out = new(bool) - **out = **in - } - if in.PercentageOfNodesToScore != nil { - in, out := &in.PercentageOfNodesToScore, &out.PercentageOfNodesToScore - *out = new(int32) - **out = **in - } - if in.BindTimeoutSeconds != nil { - in, out := &in.BindTimeoutSeconds, &out.BindTimeoutSeconds - *out = new(int64) - **out = **in - } - if in.PodInitialBackoffSeconds != nil { - in, out := &in.PodInitialBackoffSeconds, &out.PodInitialBackoffSeconds - *out = new(int64) - **out = **in - } - if in.PodMaxBackoffSeconds != nil { - in, out := &in.PodMaxBackoffSeconds, &out.PodMaxBackoffSeconds - *out = new(int64) - **out = **in - } - if in.Plugins != nil { - in, out := &in.Plugins, &out.Plugins - *out = new(Plugins) - (*in).DeepCopyInto(*out) - } - if in.PluginConfig != nil { - in, out := &in.PluginConfig, &out.PluginConfig - *out = make([]PluginConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - 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 *Plugin) DeepCopyInto(out *Plugin) { - *out = *in - if in.Weight != nil { - in, out := &in.Weight, &out.Weight - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Plugin. -func (in *Plugin) DeepCopy() *Plugin { - if in == nil { - return nil - } - out := new(Plugin) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PluginConfig) DeepCopyInto(out *PluginConfig) { - *out = *in - in.Args.DeepCopyInto(&out.Args) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PluginConfig. -func (in *PluginConfig) DeepCopy() *PluginConfig { - if in == nil { - return nil - } - out := new(PluginConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PluginSet) DeepCopyInto(out *PluginSet) { - *out = *in - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - *out = make([]Plugin, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Disabled != nil { - in, out := &in.Disabled, &out.Disabled - *out = make([]Plugin, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PluginSet. -func (in *PluginSet) DeepCopy() *PluginSet { - if in == nil { - return nil - } - out := new(PluginSet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Plugins) DeepCopyInto(out *Plugins) { - *out = *in - if in.QueueSort != nil { - in, out := &in.QueueSort, &out.QueueSort - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.PreFilter != nil { - in, out := &in.PreFilter, &out.PreFilter - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.Filter != nil { - in, out := &in.Filter, &out.Filter - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.PostFilter != nil { - in, out := &in.PostFilter, &out.PostFilter - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.Score != nil { - in, out := &in.Score, &out.Score - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.Reserve != nil { - in, out := &in.Reserve, &out.Reserve - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.Permit != nil { - in, out := &in.Permit, &out.Permit - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.PreBind != nil { - in, out := &in.PreBind, &out.PreBind - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.Bind != nil { - in, out := &in.Bind, &out.Bind - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.PostBind != nil { - in, out := &in.PostBind, &out.PostBind - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - if in.Unreserve != nil { - in, out := &in.Unreserve, &out.Unreserve - *out = new(PluginSet) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Plugins. -func (in *Plugins) DeepCopy() *Plugins { - if in == nil { - return nil - } - out := new(Plugins) - 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/vendor/modules.txt b/vendor/modules.txt index 8e05e04fa7b..6f1dbd93a50 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1775,7 +1775,6 @@ k8s.io/kube-openapi/pkg/util/sets k8s.io/kube-proxy/config/v1alpha1 # k8s.io/kube-scheduler v0.0.0 => ./staging/src/k8s.io/kube-scheduler k8s.io/kube-scheduler/config/v1 -k8s.io/kube-scheduler/config/v1alpha1 k8s.io/kube-scheduler/config/v1alpha2 k8s.io/kube-scheduler/extender/v1 # k8s.io/kubectl v0.0.0 => ./staging/src/k8s.io/kubectl