mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Remove scheduler's legacy policy config
This commit is contained in:
		@@ -366,16 +366,12 @@ API rule violation: list_type_missing,k8s.io/kube-controller-manager/config/v1al
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-controller-manager/config/v1alpha1,PersistentVolumeBinderControllerConfiguration,VolumeHostCIDRDenylist
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-proxy/config/v1alpha1,KubeProxyConfiguration,NodePortAddresses
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-proxy/config/v1alpha1,KubeProxyIPVSConfiguration,ExcludeCIDRs
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,ExtenderTLSConfig,CAData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,ExtenderTLSConfig,CertData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,ExtenderTLSConfig,KeyData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,LabelsPresence,Labels
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,LegacyExtender,ManagedResources
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,Policy,Extenders
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,Policy,Predicates
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,Policy,Priorities
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,RequestedToCapacityRatioArguments,Resources
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1,RequestedToCapacityRatioArguments,Shape
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1beta2,ExtenderTLSConfig,CAData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1beta2,ExtenderTLSConfig,CertData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1beta2,ExtenderTLSConfig,KeyData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1beta3,ExtenderTLSConfig,CAData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1beta3,ExtenderTLSConfig,CertData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kube-scheduler/config/v1beta3,ExtenderTLSConfig,KeyData
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kubelet/config/v1alpha1,CredentialProvider,Args
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kubelet/config/v1alpha1,CredentialProvider,Env
 | 
			
		||||
API rule violation: list_type_missing,k8s.io/kubelet/config/v1alpha1,CredentialProvider,MatchImages
 | 
			
		||||
@@ -608,7 +604,6 @@ API rule violation: names_match,k8s.io/kube-controller-manager/config/v1alpha1,V
 | 
			
		||||
API rule violation: names_match,k8s.io/kube-controller-manager/config/v1alpha1,VolumeConfiguration,FlexVolumePluginDir
 | 
			
		||||
API rule violation: names_match,k8s.io/kube-controller-manager/config/v1alpha1,VolumeConfiguration,PersistentVolumeRecyclerConfiguration
 | 
			
		||||
API rule violation: names_match,k8s.io/kube-proxy/config/v1alpha1,KubeProxyConfiguration,IPTables
 | 
			
		||||
API rule violation: names_match,k8s.io/kube-scheduler/config/v1,LegacyExtender,EnableHTTPS
 | 
			
		||||
API rule violation: names_match,k8s.io/kubelet/config/v1beta1,KubeletConfiguration,IPTablesDropBit
 | 
			
		||||
API rule violation: names_match,k8s.io/kubelet/config/v1beta1,KubeletConfiguration,IPTablesMasqueradeBit
 | 
			
		||||
API rule violation: names_match,k8s.io/kubelet/config/v1beta1,KubeletConfiguration,ResolverConfig
 | 
			
		||||
 
 | 
			
		||||
@@ -1,116 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2014 The Kubernetes Authors.
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
See the License for the specific language governing permissions and
 | 
			
		||||
limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
package config
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 | 
			
		||||
 | 
			
		||||
// Policy describes a struct of a policy resource in api.
 | 
			
		||||
type Policy struct {
 | 
			
		||||
	metav1.TypeMeta
 | 
			
		||||
	// Holds the information to configure the fit predicate functions.
 | 
			
		||||
	// If unspecified, the default predicate functions will be applied.
 | 
			
		||||
	// If empty list, all predicates (except the mandatory ones) will be
 | 
			
		||||
	// bypassed.
 | 
			
		||||
	Predicates []PredicatePolicy
 | 
			
		||||
	// Holds the information to configure the priority functions.
 | 
			
		||||
	// If unspecified, the default priority functions will be applied.
 | 
			
		||||
	// If empty list, all priority functions will be bypassed.
 | 
			
		||||
	Priorities []PriorityPolicy
 | 
			
		||||
	// Holds the information to communicate with the extender(s)
 | 
			
		||||
	Extenders []Extender
 | 
			
		||||
	// 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 1-100.
 | 
			
		||||
	HardPodAffinitySymmetricWeight int32
 | 
			
		||||
 | 
			
		||||
	// When AlwaysCheckAllPredicates is set to true, scheduler checks all
 | 
			
		||||
	// the configured predicates even after one or more of them fails.
 | 
			
		||||
	// When the flag is set to false, scheduler skips checking the rest
 | 
			
		||||
	// of the predicates after it finds one predicate that failed.
 | 
			
		||||
	AlwaysCheckAllPredicates bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PredicatePolicy describes a struct of a predicate policy.
 | 
			
		||||
type PredicatePolicy struct {
 | 
			
		||||
	// Identifier of the predicate policy
 | 
			
		||||
	// For a custom predicate, the name can be user-defined
 | 
			
		||||
	// For the Kubernetes provided predicates, the name is the identifier of the pre-defined predicate
 | 
			
		||||
	Name string
 | 
			
		||||
	// Holds the parameters to configure the given predicate
 | 
			
		||||
	Argument *PredicateArgument
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PriorityPolicy describes a struct of a priority policy.
 | 
			
		||||
type PriorityPolicy struct {
 | 
			
		||||
	// Identifier of the priority policy
 | 
			
		||||
	// For a custom priority, the name can be user-defined
 | 
			
		||||
	// For the Kubernetes provided priority functions, the name is the identifier of the pre-defined priority function
 | 
			
		||||
	Name string
 | 
			
		||||
	// The numeric multiplier for the node scores that the priority function generates
 | 
			
		||||
	// The weight should be a positive integer
 | 
			
		||||
	Weight int64
 | 
			
		||||
	// Holds the parameters to configure the given priority function
 | 
			
		||||
	Argument *PriorityArgument
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PredicateArgument represents the arguments to configure predicate functions in scheduler policy configuration.
 | 
			
		||||
// Only one of its members may be specified
 | 
			
		||||
type PredicateArgument struct {
 | 
			
		||||
	// The predicate that checks whether a particular node has a certain label
 | 
			
		||||
	// defined or not, regardless of value
 | 
			
		||||
	LabelsPresence *LabelsPresence
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PriorityArgument represents the arguments to configure priority functions in scheduler policy configuration.
 | 
			
		||||
// Only one of its members may be specified
 | 
			
		||||
type PriorityArgument struct {
 | 
			
		||||
	// The priority function that checks whether a particular node has a certain label
 | 
			
		||||
	// defined or not, regardless of value
 | 
			
		||||
	LabelPreference *LabelPreference
 | 
			
		||||
	// The RequestedToCapacityRatio priority function is parametrized with function shape.
 | 
			
		||||
	RequestedToCapacityRatioArguments *RequestedToCapacityRatioArguments
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LabelsPresence holds the parameters that are used to configure the corresponding predicate in scheduler policy configuration.
 | 
			
		||||
type LabelsPresence struct {
 | 
			
		||||
	// The list of labels that identify node "groups"
 | 
			
		||||
	// All of the labels should be either present (or absent) for the node to be considered a fit for hosting the pod
 | 
			
		||||
	Labels []string
 | 
			
		||||
	// The boolean flag that indicates whether the labels should be present or absent from the node
 | 
			
		||||
	Presence bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LabelPreference holds the parameters that are used to configure the corresponding priority function
 | 
			
		||||
type LabelPreference struct {
 | 
			
		||||
	// Used to identify node "groups"
 | 
			
		||||
	Label string
 | 
			
		||||
	// This is a boolean flag
 | 
			
		||||
	// If true, higher priority is given to nodes that have the label
 | 
			
		||||
	// If false, higher priority is given to nodes that do not have the label
 | 
			
		||||
	Presence bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RequestedToCapacityRatioArguments holds arguments specific to RequestedToCapacityRatio priority function.
 | 
			
		||||
type RequestedToCapacityRatioArguments struct {
 | 
			
		||||
	// Array of point defining priority function shape.
 | 
			
		||||
	Shape     []UtilizationShapePoint
 | 
			
		||||
	Resources []ResourceSpec
 | 
			
		||||
}
 | 
			
		||||
@@ -38,7 +38,6 @@ var (
 | 
			
		||||
func addKnownTypes(scheme *runtime.Scheme) error {
 | 
			
		||||
	scheme.AddKnownTypes(SchemeGroupVersion,
 | 
			
		||||
		&KubeSchedulerConfiguration{},
 | 
			
		||||
		&Policy{},
 | 
			
		||||
		&DefaultPreemptionArgs{},
 | 
			
		||||
		&InterPodAffinityArgs{},
 | 
			
		||||
		&NodeLabelArgs{},
 | 
			
		||||
@@ -51,6 +50,5 @@ func addKnownTypes(scheme *runtime.Scheme) error {
 | 
			
		||||
		&NodeResourcesBalancedAllocationArgs{},
 | 
			
		||||
		&NodeAffinityArgs{},
 | 
			
		||||
	)
 | 
			
		||||
	scheme.AddKnownTypes(schema.GroupVersion{Group: "", Version: runtime.APIVersionInternal}, &Policy{})
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,6 @@ import (
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime/serializer"
 | 
			
		||||
	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
 | 
			
		||||
	config "k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
			
		||||
	configv1 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1"
 | 
			
		||||
	configv1beta2 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1beta2"
 | 
			
		||||
	configv1beta3 "k8s.io/kubernetes/pkg/scheduler/apis/config/v1beta3"
 | 
			
		||||
)
 | 
			
		||||
@@ -41,7 +40,6 @@ func init() {
 | 
			
		||||
// AddToScheme builds the kubescheduler scheme using all known versions of the kubescheduler api.
 | 
			
		||||
func AddToScheme(scheme *runtime.Scheme) {
 | 
			
		||||
	utilruntime.Must(config.AddToScheme(scheme))
 | 
			
		||||
	utilruntime.Must(configv1.AddToScheme(scheme))
 | 
			
		||||
	utilruntime.Must(configv1beta2.AddToScheme(scheme))
 | 
			
		||||
	utilruntime.Must(configv1beta3.AddToScheme(scheme))
 | 
			
		||||
	utilruntime.Must(scheme.SetVersionPriority(
 | 
			
		||||
 
 | 
			
		||||
@@ -1,108 +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 testing
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/google/go-cmp/cmp"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config/scheme"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	policyTemplate = `
 | 
			
		||||
apiVersion: %s
 | 
			
		||||
kind: Policy
 | 
			
		||||
extenders:
 | 
			
		||||
- urlPrefix: http://localhost:8888/
 | 
			
		||||
  filterVerb: filter
 | 
			
		||||
  prioritizeVerb: prioritize
 | 
			
		||||
  weight: 1
 | 
			
		||||
  enableHttps: true
 | 
			
		||||
`
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestSchedulerPolicy(t *testing.T) {
 | 
			
		||||
	expected := &config.Policy{
 | 
			
		||||
		Extenders: []config.Extender{
 | 
			
		||||
			{
 | 
			
		||||
				URLPrefix:      "http://localhost:8888/",
 | 
			
		||||
				FilterVerb:     "filter",
 | 
			
		||||
				PrioritizeVerb: "prioritize",
 | 
			
		||||
				Weight:         1,
 | 
			
		||||
				EnableHTTPS:    true,
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	testcases := []struct {
 | 
			
		||||
		name        string
 | 
			
		||||
		apiVersion  string
 | 
			
		||||
		expectError bool
 | 
			
		||||
		expectedObj *config.Policy
 | 
			
		||||
	}{
 | 
			
		||||
		// verifies if a Policy YAML with apiVersion 'v1' can be
 | 
			
		||||
		// serialized into an unversioned Policy object.
 | 
			
		||||
		{
 | 
			
		||||
			name:        "legacy v1",
 | 
			
		||||
			apiVersion:  "v1",
 | 
			
		||||
			expectError: false,
 | 
			
		||||
			expectedObj: expected,
 | 
			
		||||
		},
 | 
			
		||||
		// verifies if a Policy YAML with apiVersion 'kubescheduler.config.k8s.io/v1'
 | 
			
		||||
		// can be serialized into an unversioned Policy object.
 | 
			
		||||
		{
 | 
			
		||||
			name:        "v1",
 | 
			
		||||
			apiVersion:  "kubescheduler.config.k8s.io/v1",
 | 
			
		||||
			expectError: false,
 | 
			
		||||
			expectedObj: expected,
 | 
			
		||||
		},
 | 
			
		||||
		// ensures unknown version throws a parsing error.
 | 
			
		||||
		{
 | 
			
		||||
			name:        "unknown version",
 | 
			
		||||
			apiVersion:  "kubescheduler.config.k8s.io/vunknown",
 | 
			
		||||
			expectError: true,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	for _, tt := range testcases {
 | 
			
		||||
		t.Run(tt.name, func(t *testing.T) {
 | 
			
		||||
			policyStr := fmt.Sprintf(policyTemplate, tt.apiVersion)
 | 
			
		||||
			got, err := loadPolicy([]byte(policyStr))
 | 
			
		||||
			if (err != nil) != tt.expectError {
 | 
			
		||||
				t.Fatalf("Error while parsing Policy. expectErr=%v, but got=%v.", tt.expectError, err)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if !tt.expectError {
 | 
			
		||||
				if diff := cmp.Diff(tt.expectedObj, got); diff != "" {
 | 
			
		||||
					t.Errorf("Unexpected policy diff (-want, +got): %s", diff)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// loadPolicy decodes data as a Policy object.
 | 
			
		||||
func loadPolicy(data []byte) (*config.Policy, error) {
 | 
			
		||||
	policy := config.Policy{}
 | 
			
		||||
	if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), data, &policy); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return &policy, nil
 | 
			
		||||
}
 | 
			
		||||
@@ -1,95 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2020 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 v1
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"k8s.io/apimachinery/pkg/conversion"
 | 
			
		||||
	"k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func Convert_v1_LegacyExtender_To_config_Extender(in *v1.LegacyExtender, out *config.Extender, s conversion.Scope) error {
 | 
			
		||||
	out.URLPrefix = in.URLPrefix
 | 
			
		||||
	out.FilterVerb = in.FilterVerb
 | 
			
		||||
	out.PreemptVerb = in.PreemptVerb
 | 
			
		||||
	out.PrioritizeVerb = in.PrioritizeVerb
 | 
			
		||||
	out.Weight = in.Weight
 | 
			
		||||
	out.BindVerb = in.BindVerb
 | 
			
		||||
	out.EnableHTTPS = in.EnableHTTPS
 | 
			
		||||
	out.HTTPTimeout.Duration = in.HTTPTimeout
 | 
			
		||||
	out.NodeCacheCapable = in.NodeCacheCapable
 | 
			
		||||
	out.Ignorable = in.Ignorable
 | 
			
		||||
 | 
			
		||||
	if in.TLSConfig != nil {
 | 
			
		||||
		out.TLSConfig = &config.ExtenderTLSConfig{}
 | 
			
		||||
		if err := Convert_v1_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in.TLSConfig, out.TLSConfig, s); err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out.TLSConfig = nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if in.ManagedResources != nil {
 | 
			
		||||
		out.ManagedResources = make([]config.ExtenderManagedResource, len(in.ManagedResources))
 | 
			
		||||
		for i, res := range in.ManagedResources {
 | 
			
		||||
			err := Convert_v1_ExtenderManagedResource_To_config_ExtenderManagedResource(&res, &out.ManagedResources[i], s)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out.ManagedResources = nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Convert_config_Extender_To_v1_LegacyExtender(in *config.Extender, out *v1.LegacyExtender, s conversion.Scope) error {
 | 
			
		||||
	out.URLPrefix = in.URLPrefix
 | 
			
		||||
	out.FilterVerb = in.FilterVerb
 | 
			
		||||
	out.PreemptVerb = in.PreemptVerb
 | 
			
		||||
	out.PrioritizeVerb = in.PrioritizeVerb
 | 
			
		||||
	out.Weight = in.Weight
 | 
			
		||||
	out.BindVerb = in.BindVerb
 | 
			
		||||
	out.EnableHTTPS = in.EnableHTTPS
 | 
			
		||||
	out.HTTPTimeout = in.HTTPTimeout.Duration
 | 
			
		||||
	out.NodeCacheCapable = in.NodeCacheCapable
 | 
			
		||||
	out.Ignorable = in.Ignorable
 | 
			
		||||
 | 
			
		||||
	if in.TLSConfig != nil {
 | 
			
		||||
		out.TLSConfig = &v1.ExtenderTLSConfig{}
 | 
			
		||||
		if err := Convert_config_ExtenderTLSConfig_To_v1_ExtenderTLSConfig(in.TLSConfig, out.TLSConfig, s); err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out.TLSConfig = nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if in.ManagedResources != nil {
 | 
			
		||||
		out.ManagedResources = make([]v1.ExtenderManagedResource, len(in.ManagedResources))
 | 
			
		||||
		for i, res := range in.ManagedResources {
 | 
			
		||||
			err := Convert_config_ExtenderManagedResource_To_v1_ExtenderManagedResource(&res, &out.ManagedResources[i], s)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out.ManagedResources = nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@@ -1,291 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2020 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 v1
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/google/go-cmp/cmp"
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	"k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestV1LegacyExtenderToConfigExtenderConversion(t *testing.T) {
 | 
			
		||||
	cases := []struct {
 | 
			
		||||
		name string
 | 
			
		||||
		in   v1.LegacyExtender
 | 
			
		||||
		out  config.Extender
 | 
			
		||||
		want config.Extender
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			name: "empty extender conversion",
 | 
			
		||||
			in:   v1.LegacyExtender{},
 | 
			
		||||
			out:  config.Extender{},
 | 
			
		||||
			want: config.Extender{},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "fully configured extender conversion",
 | 
			
		||||
			in: v1.LegacyExtender{
 | 
			
		||||
				URLPrefix:      "/prefix",
 | 
			
		||||
				BindVerb:       "bind",
 | 
			
		||||
				FilterVerb:     "filter",
 | 
			
		||||
				PreemptVerb:    "preempt",
 | 
			
		||||
				PrioritizeVerb: "prioritize",
 | 
			
		||||
				Weight:         5,
 | 
			
		||||
				EnableHTTPS:    true,
 | 
			
		||||
				TLSConfig: &v1.ExtenderTLSConfig{
 | 
			
		||||
					Insecure:   true,
 | 
			
		||||
					ServerName: "server-name",
 | 
			
		||||
					CertFile:   "cert-file",
 | 
			
		||||
					KeyFile:    "key-file",
 | 
			
		||||
					CAFile:     "ca-file",
 | 
			
		||||
					CertData:   []byte("cert-data"),
 | 
			
		||||
					KeyData:    []byte("key-data"),
 | 
			
		||||
					CAData:     []byte("ca-data"),
 | 
			
		||||
				},
 | 
			
		||||
				HTTPTimeout:      10 * time.Second,
 | 
			
		||||
				NodeCacheCapable: true,
 | 
			
		||||
				ManagedResources: []v1.ExtenderManagedResource{
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "managed-resource",
 | 
			
		||||
						IgnoredByScheduler: true,
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "another-resource",
 | 
			
		||||
						IgnoredByScheduler: false,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Ignorable: true,
 | 
			
		||||
			},
 | 
			
		||||
			out: config.Extender{},
 | 
			
		||||
			want: config.Extender{
 | 
			
		||||
				URLPrefix:      "/prefix",
 | 
			
		||||
				BindVerb:       "bind",
 | 
			
		||||
				FilterVerb:     "filter",
 | 
			
		||||
				PreemptVerb:    "preempt",
 | 
			
		||||
				PrioritizeVerb: "prioritize",
 | 
			
		||||
				Weight:         5,
 | 
			
		||||
				EnableHTTPS:    true,
 | 
			
		||||
				TLSConfig: &config.ExtenderTLSConfig{
 | 
			
		||||
					Insecure:   true,
 | 
			
		||||
					ServerName: "server-name",
 | 
			
		||||
					CertFile:   "cert-file",
 | 
			
		||||
					KeyFile:    "key-file",
 | 
			
		||||
					CAFile:     "ca-file",
 | 
			
		||||
					CertData:   []byte("cert-data"),
 | 
			
		||||
					KeyData:    []byte("key-data"),
 | 
			
		||||
					CAData:     []byte("ca-data"),
 | 
			
		||||
				},
 | 
			
		||||
				HTTPTimeout:      metav1.Duration{Duration: 10 * time.Second},
 | 
			
		||||
				NodeCacheCapable: true,
 | 
			
		||||
				ManagedResources: []config.ExtenderManagedResource{
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "managed-resource",
 | 
			
		||||
						IgnoredByScheduler: true,
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "another-resource",
 | 
			
		||||
						IgnoredByScheduler: false,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Ignorable: true,
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "clears empty fields",
 | 
			
		||||
			in:   v1.LegacyExtender{},
 | 
			
		||||
			out: config.Extender{
 | 
			
		||||
				URLPrefix:      "/prefix",
 | 
			
		||||
				BindVerb:       "bind",
 | 
			
		||||
				FilterVerb:     "filter",
 | 
			
		||||
				PreemptVerb:    "preempt",
 | 
			
		||||
				PrioritizeVerb: "prioritize",
 | 
			
		||||
				Weight:         5,
 | 
			
		||||
				EnableHTTPS:    true,
 | 
			
		||||
				TLSConfig: &config.ExtenderTLSConfig{
 | 
			
		||||
					Insecure:   true,
 | 
			
		||||
					ServerName: "server-name",
 | 
			
		||||
					CertFile:   "cert-file",
 | 
			
		||||
					KeyFile:    "key-file",
 | 
			
		||||
					CAFile:     "ca-file",
 | 
			
		||||
					CertData:   []byte("cert-data"),
 | 
			
		||||
					KeyData:    []byte("key-data"),
 | 
			
		||||
					CAData:     []byte("ca-data"),
 | 
			
		||||
				},
 | 
			
		||||
				HTTPTimeout:      metav1.Duration{Duration: 10 * time.Second},
 | 
			
		||||
				NodeCacheCapable: true,
 | 
			
		||||
				ManagedResources: []config.ExtenderManagedResource{
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "managed-resource",
 | 
			
		||||
						IgnoredByScheduler: true,
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "another-resource",
 | 
			
		||||
						IgnoredByScheduler: false,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Ignorable: true,
 | 
			
		||||
			},
 | 
			
		||||
			want: config.Extender{},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, tc := range cases {
 | 
			
		||||
		t.Run(tc.name, func(t *testing.T) {
 | 
			
		||||
			if err := Convert_v1_LegacyExtender_To_config_Extender(&tc.in, &tc.out, nil); err != nil {
 | 
			
		||||
				t.Errorf("failed to convert: %+v", err)
 | 
			
		||||
			}
 | 
			
		||||
			if diff := cmp.Diff(tc.want, tc.out); diff != "" {
 | 
			
		||||
				t.Errorf("unexpected conversion (-want, +got):\n%s", diff)
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestConfigExtenderToV1LegacyExtenderConversion(t *testing.T) {
 | 
			
		||||
	cases := []struct {
 | 
			
		||||
		name string
 | 
			
		||||
		in   config.Extender
 | 
			
		||||
		out  v1.LegacyExtender
 | 
			
		||||
		want v1.LegacyExtender
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			name: "empty extender conversion",
 | 
			
		||||
			in:   config.Extender{},
 | 
			
		||||
			out:  v1.LegacyExtender{},
 | 
			
		||||
			want: v1.LegacyExtender{},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "fully configured extender conversion",
 | 
			
		||||
			in: config.Extender{
 | 
			
		||||
				URLPrefix:      "/prefix",
 | 
			
		||||
				BindVerb:       "bind",
 | 
			
		||||
				FilterVerb:     "filter",
 | 
			
		||||
				PreemptVerb:    "preempt",
 | 
			
		||||
				PrioritizeVerb: "prioritize",
 | 
			
		||||
				Weight:         5,
 | 
			
		||||
				EnableHTTPS:    true,
 | 
			
		||||
				TLSConfig: &config.ExtenderTLSConfig{
 | 
			
		||||
					Insecure:   true,
 | 
			
		||||
					ServerName: "server-name",
 | 
			
		||||
					CertFile:   "cert-file",
 | 
			
		||||
					KeyFile:    "key-file",
 | 
			
		||||
					CAFile:     "ca-file",
 | 
			
		||||
					CertData:   []byte("cert-data"),
 | 
			
		||||
					KeyData:    []byte("key-data"),
 | 
			
		||||
					CAData:     []byte("ca-data"),
 | 
			
		||||
				},
 | 
			
		||||
				HTTPTimeout:      metav1.Duration{Duration: 10 * time.Second},
 | 
			
		||||
				NodeCacheCapable: true,
 | 
			
		||||
				ManagedResources: []config.ExtenderManagedResource{
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "managed-resource",
 | 
			
		||||
						IgnoredByScheduler: true,
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "another-resource",
 | 
			
		||||
						IgnoredByScheduler: false,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Ignorable: true,
 | 
			
		||||
			},
 | 
			
		||||
			out: v1.LegacyExtender{},
 | 
			
		||||
			want: v1.LegacyExtender{
 | 
			
		||||
				URLPrefix:      "/prefix",
 | 
			
		||||
				BindVerb:       "bind",
 | 
			
		||||
				FilterVerb:     "filter",
 | 
			
		||||
				PreemptVerb:    "preempt",
 | 
			
		||||
				PrioritizeVerb: "prioritize",
 | 
			
		||||
				Weight:         5,
 | 
			
		||||
				EnableHTTPS:    true,
 | 
			
		||||
				TLSConfig: &v1.ExtenderTLSConfig{
 | 
			
		||||
					Insecure:   true,
 | 
			
		||||
					ServerName: "server-name",
 | 
			
		||||
					CertFile:   "cert-file",
 | 
			
		||||
					KeyFile:    "key-file",
 | 
			
		||||
					CAFile:     "ca-file",
 | 
			
		||||
					CertData:   []byte("cert-data"),
 | 
			
		||||
					KeyData:    []byte("key-data"),
 | 
			
		||||
					CAData:     []byte("ca-data"),
 | 
			
		||||
				},
 | 
			
		||||
				HTTPTimeout:      10 * time.Second,
 | 
			
		||||
				NodeCacheCapable: true,
 | 
			
		||||
				ManagedResources: []v1.ExtenderManagedResource{
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "managed-resource",
 | 
			
		||||
						IgnoredByScheduler: true,
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "another-resource",
 | 
			
		||||
						IgnoredByScheduler: false,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Ignorable: true,
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "clears empty fields",
 | 
			
		||||
			in:   config.Extender{},
 | 
			
		||||
			out: v1.LegacyExtender{
 | 
			
		||||
				URLPrefix:      "/prefix",
 | 
			
		||||
				BindVerb:       "bind",
 | 
			
		||||
				FilterVerb:     "filter",
 | 
			
		||||
				PreemptVerb:    "preempt",
 | 
			
		||||
				PrioritizeVerb: "prioritize",
 | 
			
		||||
				Weight:         5,
 | 
			
		||||
				EnableHTTPS:    true,
 | 
			
		||||
				TLSConfig: &v1.ExtenderTLSConfig{
 | 
			
		||||
					Insecure:   true,
 | 
			
		||||
					ServerName: "server-name",
 | 
			
		||||
					CertFile:   "cert-file",
 | 
			
		||||
					KeyFile:    "key-file",
 | 
			
		||||
					CAFile:     "ca-file",
 | 
			
		||||
					CertData:   []byte("cert-data"),
 | 
			
		||||
					KeyData:    []byte("key-data"),
 | 
			
		||||
					CAData:     []byte("ca-data"),
 | 
			
		||||
				},
 | 
			
		||||
				HTTPTimeout:      10 * time.Second,
 | 
			
		||||
				NodeCacheCapable: true,
 | 
			
		||||
				ManagedResources: []v1.ExtenderManagedResource{
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "managed-resource",
 | 
			
		||||
						IgnoredByScheduler: true,
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						Name:               "another-resource",
 | 
			
		||||
						IgnoredByScheduler: false,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Ignorable: true,
 | 
			
		||||
			},
 | 
			
		||||
			want: v1.LegacyExtender{},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, tc := range cases {
 | 
			
		||||
		t.Run(tc.name, func(t *testing.T) {
 | 
			
		||||
			if err := Convert_config_Extender_To_v1_LegacyExtender(&tc.in, &tc.out, nil); err != nil {
 | 
			
		||||
				t.Errorf("failed to convert: %+v", err)
 | 
			
		||||
			}
 | 
			
		||||
			if diff := cmp.Diff(tc.want, tc.out); diff != "" {
 | 
			
		||||
				t.Errorf("unexpected conversion (-want, +got):\n%s", diff)
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,24 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2016 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/v1
 | 
			
		||||
// +k8s:defaulter-gen=TypeMeta
 | 
			
		||||
// +k8s:defaulter-gen-input=k8s.io/kube-scheduler/config/v1
 | 
			
		||||
// +groupName=kubescheduler.config.k8s.io
 | 
			
		||||
 | 
			
		||||
package v1 // import "k8s.io/kubernetes/pkg/scheduler/apis/config/v1"
 | 
			
		||||
@@ -1,43 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2014 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 v1
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
			
		||||
	kubeschedulerconfigv1 "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// 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: "v1"}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	// localSchemeBuilder extends the SchemeBuilder instance with the external types. In this package,
 | 
			
		||||
	// defaulting and conversion init funcs are registered as well.
 | 
			
		||||
	localSchemeBuilder = &kubeschedulerconfigv1.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(RegisterDefaults)
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										473
									
								
								pkg/scheduler/apis/config/v1/zz_generated.conversion.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										473
									
								
								pkg/scheduler/apis/config/v1/zz_generated.conversion.go
									
									
									
										generated
									
									
									
								
							@@ -1,473 +0,0 @@
 | 
			
		||||
//go:build !ignore_autogenerated
 | 
			
		||||
// +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 v1
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	unsafe "unsafe"
 | 
			
		||||
 | 
			
		||||
	conversion "k8s.io/apimachinery/pkg/conversion"
 | 
			
		||||
	runtime "k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	v1 "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
	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((*v1.ExtenderManagedResource)(nil), (*config.ExtenderManagedResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_ExtenderManagedResource_To_config_ExtenderManagedResource(a.(*v1.ExtenderManagedResource), b.(*config.ExtenderManagedResource), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.ExtenderManagedResource)(nil), (*v1.ExtenderManagedResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_ExtenderManagedResource_To_v1_ExtenderManagedResource(a.(*config.ExtenderManagedResource), b.(*v1.ExtenderManagedResource), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.ExtenderTLSConfig)(nil), (*config.ExtenderTLSConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_ExtenderTLSConfig_To_config_ExtenderTLSConfig(a.(*v1.ExtenderTLSConfig), b.(*config.ExtenderTLSConfig), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.ExtenderTLSConfig)(nil), (*v1.ExtenderTLSConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_ExtenderTLSConfig_To_v1_ExtenderTLSConfig(a.(*config.ExtenderTLSConfig), b.(*v1.ExtenderTLSConfig), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.LabelPreference)(nil), (*config.LabelPreference)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_LabelPreference_To_config_LabelPreference(a.(*v1.LabelPreference), b.(*config.LabelPreference), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.LabelPreference)(nil), (*v1.LabelPreference)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_LabelPreference_To_v1_LabelPreference(a.(*config.LabelPreference), b.(*v1.LabelPreference), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.LabelsPresence)(nil), (*config.LabelsPresence)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_LabelsPresence_To_config_LabelsPresence(a.(*v1.LabelsPresence), b.(*config.LabelsPresence), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.LabelsPresence)(nil), (*v1.LabelsPresence)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_LabelsPresence_To_v1_LabelsPresence(a.(*config.LabelsPresence), b.(*v1.LabelsPresence), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.Policy)(nil), (*config.Policy)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_Policy_To_config_Policy(a.(*v1.Policy), b.(*config.Policy), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.Policy)(nil), (*v1.Policy)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_Policy_To_v1_Policy(a.(*config.Policy), b.(*v1.Policy), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.PredicateArgument)(nil), (*config.PredicateArgument)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_PredicateArgument_To_config_PredicateArgument(a.(*v1.PredicateArgument), b.(*config.PredicateArgument), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.PredicateArgument)(nil), (*v1.PredicateArgument)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_PredicateArgument_To_v1_PredicateArgument(a.(*config.PredicateArgument), b.(*v1.PredicateArgument), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.PredicatePolicy)(nil), (*config.PredicatePolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_PredicatePolicy_To_config_PredicatePolicy(a.(*v1.PredicatePolicy), b.(*config.PredicatePolicy), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.PredicatePolicy)(nil), (*v1.PredicatePolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_PredicatePolicy_To_v1_PredicatePolicy(a.(*config.PredicatePolicy), b.(*v1.PredicatePolicy), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.PriorityArgument)(nil), (*config.PriorityArgument)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_PriorityArgument_To_config_PriorityArgument(a.(*v1.PriorityArgument), b.(*config.PriorityArgument), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.PriorityArgument)(nil), (*v1.PriorityArgument)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_PriorityArgument_To_v1_PriorityArgument(a.(*config.PriorityArgument), b.(*v1.PriorityArgument), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.PriorityPolicy)(nil), (*config.PriorityPolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_PriorityPolicy_To_config_PriorityPolicy(a.(*v1.PriorityPolicy), b.(*config.PriorityPolicy), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.PriorityPolicy)(nil), (*v1.PriorityPolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_PriorityPolicy_To_v1_PriorityPolicy(a.(*config.PriorityPolicy), b.(*v1.PriorityPolicy), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.RequestedToCapacityRatioArguments)(nil), (*config.RequestedToCapacityRatioArguments)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_RequestedToCapacityRatioArguments_To_config_RequestedToCapacityRatioArguments(a.(*v1.RequestedToCapacityRatioArguments), b.(*config.RequestedToCapacityRatioArguments), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.RequestedToCapacityRatioArguments)(nil), (*v1.RequestedToCapacityRatioArguments)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_RequestedToCapacityRatioArguments_To_v1_RequestedToCapacityRatioArguments(a.(*config.RequestedToCapacityRatioArguments), b.(*v1.RequestedToCapacityRatioArguments), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.ResourceSpec)(nil), (*config.ResourceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_ResourceSpec_To_config_ResourceSpec(a.(*v1.ResourceSpec), b.(*config.ResourceSpec), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.ResourceSpec)(nil), (*v1.ResourceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_ResourceSpec_To_v1_ResourceSpec(a.(*config.ResourceSpec), b.(*v1.ResourceSpec), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1.UtilizationShapePoint)(nil), (*config.UtilizationShapePoint)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_UtilizationShapePoint_To_config_UtilizationShapePoint(a.(*v1.UtilizationShapePoint), b.(*config.UtilizationShapePoint), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.UtilizationShapePoint)(nil), (*v1.UtilizationShapePoint)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_UtilizationShapePoint_To_v1_UtilizationShapePoint(a.(*config.UtilizationShapePoint), b.(*v1.UtilizationShapePoint), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddConversionFunc((*config.Extender)(nil), (*v1.LegacyExtender)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_Extender_To_v1_LegacyExtender(a.(*config.Extender), b.(*v1.LegacyExtender), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddConversionFunc((*v1.LegacyExtender)(nil), (*config.Extender)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1_LegacyExtender_To_config_Extender(a.(*v1.LegacyExtender), b.(*config.Extender), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_ExtenderManagedResource_To_config_ExtenderManagedResource(in *v1.ExtenderManagedResource, out *config.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.IgnoredByScheduler = in.IgnoredByScheduler
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_ExtenderManagedResource_To_config_ExtenderManagedResource is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_ExtenderManagedResource_To_config_ExtenderManagedResource(in *v1.ExtenderManagedResource, out *config.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_ExtenderManagedResource_To_config_ExtenderManagedResource(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_ExtenderManagedResource_To_v1_ExtenderManagedResource(in *config.ExtenderManagedResource, out *v1.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.IgnoredByScheduler = in.IgnoredByScheduler
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_ExtenderManagedResource_To_v1_ExtenderManagedResource is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_ExtenderManagedResource_To_v1_ExtenderManagedResource(in *config.ExtenderManagedResource, out *v1.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_ExtenderManagedResource_To_v1_ExtenderManagedResource(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in *v1.ExtenderTLSConfig, out *config.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	out.Insecure = in.Insecure
 | 
			
		||||
	out.ServerName = in.ServerName
 | 
			
		||||
	out.CertFile = in.CertFile
 | 
			
		||||
	out.KeyFile = in.KeyFile
 | 
			
		||||
	out.CAFile = in.CAFile
 | 
			
		||||
	out.CertData = *(*[]byte)(unsafe.Pointer(&in.CertData))
 | 
			
		||||
	out.KeyData = *(*[]byte)(unsafe.Pointer(&in.KeyData))
 | 
			
		||||
	out.CAData = *(*[]byte)(unsafe.Pointer(&in.CAData))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_ExtenderTLSConfig_To_config_ExtenderTLSConfig is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in *v1.ExtenderTLSConfig, out *config.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_ExtenderTLSConfig_To_v1_ExtenderTLSConfig(in *config.ExtenderTLSConfig, out *v1.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	out.Insecure = in.Insecure
 | 
			
		||||
	out.ServerName = in.ServerName
 | 
			
		||||
	out.CertFile = in.CertFile
 | 
			
		||||
	out.KeyFile = in.KeyFile
 | 
			
		||||
	out.CAFile = in.CAFile
 | 
			
		||||
	out.CertData = *(*[]byte)(unsafe.Pointer(&in.CertData))
 | 
			
		||||
	out.KeyData = *(*[]byte)(unsafe.Pointer(&in.KeyData))
 | 
			
		||||
	out.CAData = *(*[]byte)(unsafe.Pointer(&in.CAData))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_ExtenderTLSConfig_To_v1_ExtenderTLSConfig is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_ExtenderTLSConfig_To_v1_ExtenderTLSConfig(in *config.ExtenderTLSConfig, out *v1.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_ExtenderTLSConfig_To_v1_ExtenderTLSConfig(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_LabelPreference_To_config_LabelPreference(in *v1.LabelPreference, out *config.LabelPreference, s conversion.Scope) error {
 | 
			
		||||
	out.Label = in.Label
 | 
			
		||||
	out.Presence = in.Presence
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_LabelPreference_To_config_LabelPreference is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_LabelPreference_To_config_LabelPreference(in *v1.LabelPreference, out *config.LabelPreference, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_LabelPreference_To_config_LabelPreference(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_LabelPreference_To_v1_LabelPreference(in *config.LabelPreference, out *v1.LabelPreference, s conversion.Scope) error {
 | 
			
		||||
	out.Label = in.Label
 | 
			
		||||
	out.Presence = in.Presence
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_LabelPreference_To_v1_LabelPreference is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_LabelPreference_To_v1_LabelPreference(in *config.LabelPreference, out *v1.LabelPreference, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_LabelPreference_To_v1_LabelPreference(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_LabelsPresence_To_config_LabelsPresence(in *v1.LabelsPresence, out *config.LabelsPresence, s conversion.Scope) error {
 | 
			
		||||
	out.Labels = *(*[]string)(unsafe.Pointer(&in.Labels))
 | 
			
		||||
	out.Presence = in.Presence
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_LabelsPresence_To_config_LabelsPresence is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_LabelsPresence_To_config_LabelsPresence(in *v1.LabelsPresence, out *config.LabelsPresence, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_LabelsPresence_To_config_LabelsPresence(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_LabelsPresence_To_v1_LabelsPresence(in *config.LabelsPresence, out *v1.LabelsPresence, s conversion.Scope) error {
 | 
			
		||||
	out.Labels = *(*[]string)(unsafe.Pointer(&in.Labels))
 | 
			
		||||
	out.Presence = in.Presence
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_LabelsPresence_To_v1_LabelsPresence is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_LabelsPresence_To_v1_LabelsPresence(in *config.LabelsPresence, out *v1.LabelsPresence, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_LabelsPresence_To_v1_LabelsPresence(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_Policy_To_config_Policy(in *v1.Policy, out *config.Policy, s conversion.Scope) error {
 | 
			
		||||
	out.Predicates = *(*[]config.PredicatePolicy)(unsafe.Pointer(&in.Predicates))
 | 
			
		||||
	out.Priorities = *(*[]config.PriorityPolicy)(unsafe.Pointer(&in.Priorities))
 | 
			
		||||
	if in.Extenders != nil {
 | 
			
		||||
		in, out := &in.Extenders, &out.Extenders
 | 
			
		||||
		*out = make([]config.Extender, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			if err := Convert_v1_LegacyExtender_To_config_Extender(&(*in)[i], &(*out)[i], s); err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out.Extenders = nil
 | 
			
		||||
	}
 | 
			
		||||
	out.HardPodAffinitySymmetricWeight = in.HardPodAffinitySymmetricWeight
 | 
			
		||||
	out.AlwaysCheckAllPredicates = in.AlwaysCheckAllPredicates
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_Policy_To_config_Policy is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_Policy_To_config_Policy(in *v1.Policy, out *config.Policy, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_Policy_To_config_Policy(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_Policy_To_v1_Policy(in *config.Policy, out *v1.Policy, s conversion.Scope) error {
 | 
			
		||||
	out.Predicates = *(*[]v1.PredicatePolicy)(unsafe.Pointer(&in.Predicates))
 | 
			
		||||
	out.Priorities = *(*[]v1.PriorityPolicy)(unsafe.Pointer(&in.Priorities))
 | 
			
		||||
	if in.Extenders != nil {
 | 
			
		||||
		in, out := &in.Extenders, &out.Extenders
 | 
			
		||||
		*out = make([]v1.LegacyExtender, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			if err := Convert_config_Extender_To_v1_LegacyExtender(&(*in)[i], &(*out)[i], s); err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out.Extenders = nil
 | 
			
		||||
	}
 | 
			
		||||
	out.HardPodAffinitySymmetricWeight = in.HardPodAffinitySymmetricWeight
 | 
			
		||||
	out.AlwaysCheckAllPredicates = in.AlwaysCheckAllPredicates
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_Policy_To_v1_Policy is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_Policy_To_v1_Policy(in *config.Policy, out *v1.Policy, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_Policy_To_v1_Policy(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_PredicateArgument_To_config_PredicateArgument(in *v1.PredicateArgument, out *config.PredicateArgument, s conversion.Scope) error {
 | 
			
		||||
	out.LabelsPresence = (*config.LabelsPresence)(unsafe.Pointer(in.LabelsPresence))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_PredicateArgument_To_config_PredicateArgument is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_PredicateArgument_To_config_PredicateArgument(in *v1.PredicateArgument, out *config.PredicateArgument, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_PredicateArgument_To_config_PredicateArgument(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_PredicateArgument_To_v1_PredicateArgument(in *config.PredicateArgument, out *v1.PredicateArgument, s conversion.Scope) error {
 | 
			
		||||
	out.LabelsPresence = (*v1.LabelsPresence)(unsafe.Pointer(in.LabelsPresence))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_PredicateArgument_To_v1_PredicateArgument is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_PredicateArgument_To_v1_PredicateArgument(in *config.PredicateArgument, out *v1.PredicateArgument, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_PredicateArgument_To_v1_PredicateArgument(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_PredicatePolicy_To_config_PredicatePolicy(in *v1.PredicatePolicy, out *config.PredicatePolicy, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.Argument = (*config.PredicateArgument)(unsafe.Pointer(in.Argument))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_PredicatePolicy_To_config_PredicatePolicy is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_PredicatePolicy_To_config_PredicatePolicy(in *v1.PredicatePolicy, out *config.PredicatePolicy, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_PredicatePolicy_To_config_PredicatePolicy(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_PredicatePolicy_To_v1_PredicatePolicy(in *config.PredicatePolicy, out *v1.PredicatePolicy, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.Argument = (*v1.PredicateArgument)(unsafe.Pointer(in.Argument))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_PredicatePolicy_To_v1_PredicatePolicy is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_PredicatePolicy_To_v1_PredicatePolicy(in *config.PredicatePolicy, out *v1.PredicatePolicy, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_PredicatePolicy_To_v1_PredicatePolicy(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_PriorityArgument_To_config_PriorityArgument(in *v1.PriorityArgument, out *config.PriorityArgument, s conversion.Scope) error {
 | 
			
		||||
	out.LabelPreference = (*config.LabelPreference)(unsafe.Pointer(in.LabelPreference))
 | 
			
		||||
	out.RequestedToCapacityRatioArguments = (*config.RequestedToCapacityRatioArguments)(unsafe.Pointer(in.RequestedToCapacityRatioArguments))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_PriorityArgument_To_config_PriorityArgument is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_PriorityArgument_To_config_PriorityArgument(in *v1.PriorityArgument, out *config.PriorityArgument, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_PriorityArgument_To_config_PriorityArgument(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_PriorityArgument_To_v1_PriorityArgument(in *config.PriorityArgument, out *v1.PriorityArgument, s conversion.Scope) error {
 | 
			
		||||
	out.LabelPreference = (*v1.LabelPreference)(unsafe.Pointer(in.LabelPreference))
 | 
			
		||||
	out.RequestedToCapacityRatioArguments = (*v1.RequestedToCapacityRatioArguments)(unsafe.Pointer(in.RequestedToCapacityRatioArguments))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_PriorityArgument_To_v1_PriorityArgument is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_PriorityArgument_To_v1_PriorityArgument(in *config.PriorityArgument, out *v1.PriorityArgument, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_PriorityArgument_To_v1_PriorityArgument(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_PriorityPolicy_To_config_PriorityPolicy(in *v1.PriorityPolicy, out *config.PriorityPolicy, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.Weight = in.Weight
 | 
			
		||||
	out.Argument = (*config.PriorityArgument)(unsafe.Pointer(in.Argument))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_PriorityPolicy_To_config_PriorityPolicy is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_PriorityPolicy_To_config_PriorityPolicy(in *v1.PriorityPolicy, out *config.PriorityPolicy, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_PriorityPolicy_To_config_PriorityPolicy(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_PriorityPolicy_To_v1_PriorityPolicy(in *config.PriorityPolicy, out *v1.PriorityPolicy, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.Weight = in.Weight
 | 
			
		||||
	out.Argument = (*v1.PriorityArgument)(unsafe.Pointer(in.Argument))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_PriorityPolicy_To_v1_PriorityPolicy is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_PriorityPolicy_To_v1_PriorityPolicy(in *config.PriorityPolicy, out *v1.PriorityPolicy, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_PriorityPolicy_To_v1_PriorityPolicy(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_RequestedToCapacityRatioArguments_To_config_RequestedToCapacityRatioArguments(in *v1.RequestedToCapacityRatioArguments, out *config.RequestedToCapacityRatioArguments, s conversion.Scope) error {
 | 
			
		||||
	out.Shape = *(*[]config.UtilizationShapePoint)(unsafe.Pointer(&in.Shape))
 | 
			
		||||
	out.Resources = *(*[]config.ResourceSpec)(unsafe.Pointer(&in.Resources))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_RequestedToCapacityRatioArguments_To_config_RequestedToCapacityRatioArguments is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_RequestedToCapacityRatioArguments_To_config_RequestedToCapacityRatioArguments(in *v1.RequestedToCapacityRatioArguments, out *config.RequestedToCapacityRatioArguments, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_RequestedToCapacityRatioArguments_To_config_RequestedToCapacityRatioArguments(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_RequestedToCapacityRatioArguments_To_v1_RequestedToCapacityRatioArguments(in *config.RequestedToCapacityRatioArguments, out *v1.RequestedToCapacityRatioArguments, s conversion.Scope) error {
 | 
			
		||||
	out.Shape = *(*[]v1.UtilizationShapePoint)(unsafe.Pointer(&in.Shape))
 | 
			
		||||
	out.Resources = *(*[]v1.ResourceSpec)(unsafe.Pointer(&in.Resources))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_RequestedToCapacityRatioArguments_To_v1_RequestedToCapacityRatioArguments is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_RequestedToCapacityRatioArguments_To_v1_RequestedToCapacityRatioArguments(in *config.RequestedToCapacityRatioArguments, out *v1.RequestedToCapacityRatioArguments, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_RequestedToCapacityRatioArguments_To_v1_RequestedToCapacityRatioArguments(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_ResourceSpec_To_config_ResourceSpec(in *v1.ResourceSpec, out *config.ResourceSpec, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.Weight = in.Weight
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_ResourceSpec_To_config_ResourceSpec is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_ResourceSpec_To_config_ResourceSpec(in *v1.ResourceSpec, out *config.ResourceSpec, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_ResourceSpec_To_config_ResourceSpec(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_ResourceSpec_To_v1_ResourceSpec(in *config.ResourceSpec, out *v1.ResourceSpec, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.Weight = in.Weight
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_ResourceSpec_To_v1_ResourceSpec is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_ResourceSpec_To_v1_ResourceSpec(in *config.ResourceSpec, out *v1.ResourceSpec, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_ResourceSpec_To_v1_ResourceSpec(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1_UtilizationShapePoint_To_config_UtilizationShapePoint(in *v1.UtilizationShapePoint, out *config.UtilizationShapePoint, s conversion.Scope) error {
 | 
			
		||||
	out.Utilization = in.Utilization
 | 
			
		||||
	out.Score = in.Score
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1_UtilizationShapePoint_To_config_UtilizationShapePoint is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1_UtilizationShapePoint_To_config_UtilizationShapePoint(in *v1.UtilizationShapePoint, out *config.UtilizationShapePoint, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1_UtilizationShapePoint_To_config_UtilizationShapePoint(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_UtilizationShapePoint_To_v1_UtilizationShapePoint(in *config.UtilizationShapePoint, out *v1.UtilizationShapePoint, s conversion.Scope) error {
 | 
			
		||||
	out.Utilization = in.Utilization
 | 
			
		||||
	out.Score = in.Score
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_UtilizationShapePoint_To_v1_UtilizationShapePoint is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_UtilizationShapePoint_To_v1_UtilizationShapePoint(in *config.UtilizationShapePoint, out *v1.UtilizationShapePoint, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_UtilizationShapePoint_To_v1_UtilizationShapePoint(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
//go:build !ignore_autogenerated
 | 
			
		||||
// +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 v1
 | 
			
		||||
@@ -1,33 +0,0 @@
 | 
			
		||||
//go:build !ignore_autogenerated
 | 
			
		||||
// +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 v1
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	runtime "k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// 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 {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@@ -29,7 +29,6 @@ import (
 | 
			
		||||
	conversion "k8s.io/apimachinery/pkg/conversion"
 | 
			
		||||
	runtime "k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	v1alpha1 "k8s.io/component-base/config/v1alpha1"
 | 
			
		||||
	configv1 "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
	v1beta2 "k8s.io/kube-scheduler/config/v1beta2"
 | 
			
		||||
	config "k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
			
		||||
)
 | 
			
		||||
@@ -61,6 +60,26 @@ func RegisterConversions(s *runtime.Scheme) error {
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1beta2.ExtenderManagedResource)(nil), (*config.ExtenderManagedResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1beta2_ExtenderManagedResource_To_config_ExtenderManagedResource(a.(*v1beta2.ExtenderManagedResource), b.(*config.ExtenderManagedResource), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.ExtenderManagedResource)(nil), (*v1beta2.ExtenderManagedResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_ExtenderManagedResource_To_v1beta2_ExtenderManagedResource(a.(*config.ExtenderManagedResource), b.(*v1beta2.ExtenderManagedResource), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1beta2.ExtenderTLSConfig)(nil), (*config.ExtenderTLSConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1beta2_ExtenderTLSConfig_To_config_ExtenderTLSConfig(a.(*v1beta2.ExtenderTLSConfig), b.(*config.ExtenderTLSConfig), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.ExtenderTLSConfig)(nil), (*v1beta2.ExtenderTLSConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_ExtenderTLSConfig_To_v1beta2_ExtenderTLSConfig(a.(*config.ExtenderTLSConfig), b.(*v1beta2.ExtenderTLSConfig), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1beta2.InterPodAffinityArgs)(nil), (*config.InterPodAffinityArgs)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1beta2_InterPodAffinityArgs_To_config_InterPodAffinityArgs(a.(*v1beta2.InterPodAffinityArgs), b.(*config.InterPodAffinityArgs), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
@@ -283,10 +302,10 @@ func autoConvert_config_Extender_To_v1beta2_Extender(in *config.Extender, out *v
 | 
			
		||||
	out.Weight = in.Weight
 | 
			
		||||
	out.BindVerb = in.BindVerb
 | 
			
		||||
	out.EnableHTTPS = in.EnableHTTPS
 | 
			
		||||
	out.TLSConfig = (*configv1.ExtenderTLSConfig)(unsafe.Pointer(in.TLSConfig))
 | 
			
		||||
	out.TLSConfig = (*v1beta2.ExtenderTLSConfig)(unsafe.Pointer(in.TLSConfig))
 | 
			
		||||
	out.HTTPTimeout = in.HTTPTimeout
 | 
			
		||||
	out.NodeCacheCapable = in.NodeCacheCapable
 | 
			
		||||
	out.ManagedResources = *(*[]configv1.ExtenderManagedResource)(unsafe.Pointer(&in.ManagedResources))
 | 
			
		||||
	out.ManagedResources = *(*[]v1beta2.ExtenderManagedResource)(unsafe.Pointer(&in.ManagedResources))
 | 
			
		||||
	out.Ignorable = in.Ignorable
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@@ -296,6 +315,62 @@ func Convert_config_Extender_To_v1beta2_Extender(in *config.Extender, out *v1bet
 | 
			
		||||
	return autoConvert_config_Extender_To_v1beta2_Extender(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1beta2_ExtenderManagedResource_To_config_ExtenderManagedResource(in *v1beta2.ExtenderManagedResource, out *config.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.IgnoredByScheduler = in.IgnoredByScheduler
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1beta2_ExtenderManagedResource_To_config_ExtenderManagedResource is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1beta2_ExtenderManagedResource_To_config_ExtenderManagedResource(in *v1beta2.ExtenderManagedResource, out *config.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1beta2_ExtenderManagedResource_To_config_ExtenderManagedResource(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_ExtenderManagedResource_To_v1beta2_ExtenderManagedResource(in *config.ExtenderManagedResource, out *v1beta2.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.IgnoredByScheduler = in.IgnoredByScheduler
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_ExtenderManagedResource_To_v1beta2_ExtenderManagedResource is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_ExtenderManagedResource_To_v1beta2_ExtenderManagedResource(in *config.ExtenderManagedResource, out *v1beta2.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_ExtenderManagedResource_To_v1beta2_ExtenderManagedResource(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1beta2_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in *v1beta2.ExtenderTLSConfig, out *config.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	out.Insecure = in.Insecure
 | 
			
		||||
	out.ServerName = in.ServerName
 | 
			
		||||
	out.CertFile = in.CertFile
 | 
			
		||||
	out.KeyFile = in.KeyFile
 | 
			
		||||
	out.CAFile = in.CAFile
 | 
			
		||||
	out.CertData = *(*[]byte)(unsafe.Pointer(&in.CertData))
 | 
			
		||||
	out.KeyData = *(*[]byte)(unsafe.Pointer(&in.KeyData))
 | 
			
		||||
	out.CAData = *(*[]byte)(unsafe.Pointer(&in.CAData))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1beta2_ExtenderTLSConfig_To_config_ExtenderTLSConfig is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1beta2_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in *v1beta2.ExtenderTLSConfig, out *config.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1beta2_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_ExtenderTLSConfig_To_v1beta2_ExtenderTLSConfig(in *config.ExtenderTLSConfig, out *v1beta2.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	out.Insecure = in.Insecure
 | 
			
		||||
	out.ServerName = in.ServerName
 | 
			
		||||
	out.CertFile = in.CertFile
 | 
			
		||||
	out.KeyFile = in.KeyFile
 | 
			
		||||
	out.CAFile = in.CAFile
 | 
			
		||||
	out.CertData = *(*[]byte)(unsafe.Pointer(&in.CertData))
 | 
			
		||||
	out.KeyData = *(*[]byte)(unsafe.Pointer(&in.KeyData))
 | 
			
		||||
	out.CAData = *(*[]byte)(unsafe.Pointer(&in.CAData))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_ExtenderTLSConfig_To_v1beta2_ExtenderTLSConfig is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_ExtenderTLSConfig_To_v1beta2_ExtenderTLSConfig(in *config.ExtenderTLSConfig, out *v1beta2.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_ExtenderTLSConfig_To_v1beta2_ExtenderTLSConfig(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1beta2_InterPodAffinityArgs_To_config_InterPodAffinityArgs(in *v1beta2.InterPodAffinityArgs, out *config.InterPodAffinityArgs, s conversion.Scope) error {
 | 
			
		||||
	if err := v1.Convert_Pointer_int32_To_int32(&in.HardPodAffinityWeight, &out.HardPodAffinityWeight, s); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,6 @@ import (
 | 
			
		||||
	conversion "k8s.io/apimachinery/pkg/conversion"
 | 
			
		||||
	runtime "k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	v1alpha1 "k8s.io/component-base/config/v1alpha1"
 | 
			
		||||
	configv1 "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
	v1beta3 "k8s.io/kube-scheduler/config/v1beta3"
 | 
			
		||||
	config "k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
			
		||||
)
 | 
			
		||||
@@ -61,6 +60,26 @@ func RegisterConversions(s *runtime.Scheme) error {
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1beta3.ExtenderManagedResource)(nil), (*config.ExtenderManagedResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1beta3_ExtenderManagedResource_To_config_ExtenderManagedResource(a.(*v1beta3.ExtenderManagedResource), b.(*config.ExtenderManagedResource), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.ExtenderManagedResource)(nil), (*v1beta3.ExtenderManagedResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_ExtenderManagedResource_To_v1beta3_ExtenderManagedResource(a.(*config.ExtenderManagedResource), b.(*v1beta3.ExtenderManagedResource), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1beta3.ExtenderTLSConfig)(nil), (*config.ExtenderTLSConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1beta3_ExtenderTLSConfig_To_config_ExtenderTLSConfig(a.(*v1beta3.ExtenderTLSConfig), b.(*config.ExtenderTLSConfig), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*config.ExtenderTLSConfig)(nil), (*v1beta3.ExtenderTLSConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_config_ExtenderTLSConfig_To_v1beta3_ExtenderTLSConfig(a.(*config.ExtenderTLSConfig), b.(*v1beta3.ExtenderTLSConfig), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := s.AddGeneratedConversionFunc((*v1beta3.InterPodAffinityArgs)(nil), (*config.InterPodAffinityArgs)(nil), func(a, b interface{}, scope conversion.Scope) error {
 | 
			
		||||
		return Convert_v1beta3_InterPodAffinityArgs_To_config_InterPodAffinityArgs(a.(*v1beta3.InterPodAffinityArgs), b.(*config.InterPodAffinityArgs), scope)
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
@@ -283,10 +302,10 @@ func autoConvert_config_Extender_To_v1beta3_Extender(in *config.Extender, out *v
 | 
			
		||||
	out.Weight = in.Weight
 | 
			
		||||
	out.BindVerb = in.BindVerb
 | 
			
		||||
	out.EnableHTTPS = in.EnableHTTPS
 | 
			
		||||
	out.TLSConfig = (*configv1.ExtenderTLSConfig)(unsafe.Pointer(in.TLSConfig))
 | 
			
		||||
	out.TLSConfig = (*v1beta3.ExtenderTLSConfig)(unsafe.Pointer(in.TLSConfig))
 | 
			
		||||
	out.HTTPTimeout = in.HTTPTimeout
 | 
			
		||||
	out.NodeCacheCapable = in.NodeCacheCapable
 | 
			
		||||
	out.ManagedResources = *(*[]configv1.ExtenderManagedResource)(unsafe.Pointer(&in.ManagedResources))
 | 
			
		||||
	out.ManagedResources = *(*[]v1beta3.ExtenderManagedResource)(unsafe.Pointer(&in.ManagedResources))
 | 
			
		||||
	out.Ignorable = in.Ignorable
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@@ -296,6 +315,62 @@ func Convert_config_Extender_To_v1beta3_Extender(in *config.Extender, out *v1bet
 | 
			
		||||
	return autoConvert_config_Extender_To_v1beta3_Extender(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1beta3_ExtenderManagedResource_To_config_ExtenderManagedResource(in *v1beta3.ExtenderManagedResource, out *config.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.IgnoredByScheduler = in.IgnoredByScheduler
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1beta3_ExtenderManagedResource_To_config_ExtenderManagedResource is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1beta3_ExtenderManagedResource_To_config_ExtenderManagedResource(in *v1beta3.ExtenderManagedResource, out *config.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1beta3_ExtenderManagedResource_To_config_ExtenderManagedResource(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_ExtenderManagedResource_To_v1beta3_ExtenderManagedResource(in *config.ExtenderManagedResource, out *v1beta3.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	out.Name = in.Name
 | 
			
		||||
	out.IgnoredByScheduler = in.IgnoredByScheduler
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_ExtenderManagedResource_To_v1beta3_ExtenderManagedResource is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_ExtenderManagedResource_To_v1beta3_ExtenderManagedResource(in *config.ExtenderManagedResource, out *v1beta3.ExtenderManagedResource, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_ExtenderManagedResource_To_v1beta3_ExtenderManagedResource(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1beta3_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in *v1beta3.ExtenderTLSConfig, out *config.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	out.Insecure = in.Insecure
 | 
			
		||||
	out.ServerName = in.ServerName
 | 
			
		||||
	out.CertFile = in.CertFile
 | 
			
		||||
	out.KeyFile = in.KeyFile
 | 
			
		||||
	out.CAFile = in.CAFile
 | 
			
		||||
	out.CertData = *(*[]byte)(unsafe.Pointer(&in.CertData))
 | 
			
		||||
	out.KeyData = *(*[]byte)(unsafe.Pointer(&in.KeyData))
 | 
			
		||||
	out.CAData = *(*[]byte)(unsafe.Pointer(&in.CAData))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_v1beta3_ExtenderTLSConfig_To_config_ExtenderTLSConfig is an autogenerated conversion function.
 | 
			
		||||
func Convert_v1beta3_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in *v1beta3.ExtenderTLSConfig, out *config.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_v1beta3_ExtenderTLSConfig_To_config_ExtenderTLSConfig(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_config_ExtenderTLSConfig_To_v1beta3_ExtenderTLSConfig(in *config.ExtenderTLSConfig, out *v1beta3.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	out.Insecure = in.Insecure
 | 
			
		||||
	out.ServerName = in.ServerName
 | 
			
		||||
	out.CertFile = in.CertFile
 | 
			
		||||
	out.KeyFile = in.KeyFile
 | 
			
		||||
	out.CAFile = in.CAFile
 | 
			
		||||
	out.CertData = *(*[]byte)(unsafe.Pointer(&in.CertData))
 | 
			
		||||
	out.KeyData = *(*[]byte)(unsafe.Pointer(&in.KeyData))
 | 
			
		||||
	out.CAData = *(*[]byte)(unsafe.Pointer(&in.CAData))
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert_config_ExtenderTLSConfig_To_v1beta3_ExtenderTLSConfig is an autogenerated conversion function.
 | 
			
		||||
func Convert_config_ExtenderTLSConfig_To_v1beta3_ExtenderTLSConfig(in *config.ExtenderTLSConfig, out *v1beta3.ExtenderTLSConfig, s conversion.Scope) error {
 | 
			
		||||
	return autoConvert_config_ExtenderTLSConfig_To_v1beta3_ExtenderTLSConfig(in, out, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autoConvert_v1beta3_InterPodAffinityArgs_To_config_InterPodAffinityArgs(in *v1beta3.InterPodAffinityArgs, out *config.InterPodAffinityArgs, s conversion.Scope) error {
 | 
			
		||||
	if err := v1.Convert_Pointer_int32_To_int32(&in.HardPodAffinityWeight, &out.HardPodAffinityWeight, s); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
 
 | 
			
		||||
@@ -283,29 +283,6 @@ func validateCommonQueueSort(path *field.Path, profiles []config.KubeSchedulerPr
 | 
			
		||||
	return errs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ValidatePolicy checks for errors in the Config
 | 
			
		||||
// It does not return early so that it can find as many errors as possible
 | 
			
		||||
func ValidatePolicy(policy config.Policy) error {
 | 
			
		||||
	var validationErrors []error
 | 
			
		||||
 | 
			
		||||
	priorities := make(map[string]config.PriorityPolicy, len(policy.Priorities))
 | 
			
		||||
	for _, priority := range policy.Priorities {
 | 
			
		||||
		if priority.Weight <= 0 || priority.Weight >= config.MaxWeight {
 | 
			
		||||
			validationErrors = append(validationErrors, fmt.Errorf("priority %s should have a positive weight applied to it or it has overflown", priority.Name))
 | 
			
		||||
		}
 | 
			
		||||
		validationErrors = append(validationErrors, validateCustomPriorities(priorities, priority))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if extenderErrs := validateExtenders(field.NewPath("extenders"), policy.Extenders); len(extenderErrs) > 0 {
 | 
			
		||||
		validationErrors = append(validationErrors, extenderErrs...)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if policy.HardPodAffinitySymmetricWeight < 0 || policy.HardPodAffinitySymmetricWeight > 100 {
 | 
			
		||||
		validationErrors = append(validationErrors, field.Invalid(field.NewPath("hardPodAffinitySymmetricWeight"), policy.HardPodAffinitySymmetricWeight, "not in valid range [0-100]"))
 | 
			
		||||
	}
 | 
			
		||||
	return utilerrors.NewAggregate(validationErrors)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// validateExtenders validates the configured extenders for the Scheduler
 | 
			
		||||
func validateExtenders(fldPath *field.Path, extenders []config.Extender) []error {
 | 
			
		||||
	var errs []error
 | 
			
		||||
@@ -337,43 +314,6 @@ func validateExtenders(fldPath *field.Path, extenders []config.Extender) []error
 | 
			
		||||
	return errs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// validateCustomPriorities validates that:
 | 
			
		||||
// 1. RequestedToCapacityRatioRedeclared custom priority cannot be declared multiple times,
 | 
			
		||||
// 2. LabelPreference/ServiceAntiAffinity custom priorities can be declared multiple times,
 | 
			
		||||
// however the weights for each custom priority type should be the same.
 | 
			
		||||
func validateCustomPriorities(priorities map[string]config.PriorityPolicy, priority config.PriorityPolicy) error {
 | 
			
		||||
	verifyRedeclaration := func(priorityType string) error {
 | 
			
		||||
		if existing, alreadyDeclared := priorities[priorityType]; alreadyDeclared {
 | 
			
		||||
			return fmt.Errorf("priority %q redeclares custom priority %q, from: %q", priority.Name, priorityType, existing.Name)
 | 
			
		||||
		}
 | 
			
		||||
		priorities[priorityType] = priority
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	verifyDifferentWeights := func(priorityType string) error {
 | 
			
		||||
		if existing, alreadyDeclared := priorities[priorityType]; alreadyDeclared {
 | 
			
		||||
			if existing.Weight != priority.Weight {
 | 
			
		||||
				return fmt.Errorf("%s  priority %q has a different weight with %q", priorityType, priority.Name, existing.Name)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		priorities[priorityType] = priority
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	if priority.Argument != nil {
 | 
			
		||||
		if priority.Argument.LabelPreference != nil {
 | 
			
		||||
			if err := verifyDifferentWeights("LabelPreference"); err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		} else if priority.Argument.RequestedToCapacityRatioArguments != nil {
 | 
			
		||||
			if err := verifyRedeclaration("RequestedToCapacityRatio"); err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			return fmt.Errorf("no priority arguments set for priority %s", priority.Name)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// validateExtendedResourceName checks whether the specified name is a valid
 | 
			
		||||
// extended resource name.
 | 
			
		||||
func validateExtendedResourceName(path *field.Path, name v1.ResourceName) []error {
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,6 @@ limitations under the License.
 | 
			
		||||
package validation
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
@@ -633,126 +632,3 @@ func TestValidateKubeSchedulerConfigurationV1beta3(t *testing.T) {
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestValidatePolicy(t *testing.T) {
 | 
			
		||||
	tests := []struct {
 | 
			
		||||
		policy   config.Policy
 | 
			
		||||
		expected error
 | 
			
		||||
		name     string
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			name:     "no weight defined in policy",
 | 
			
		||||
			policy:   config.Policy{Priorities: []config.PriorityPolicy{{Name: "NoWeightPriority"}}},
 | 
			
		||||
			expected: errors.New("priority NoWeightPriority should have a positive weight applied to it or it has overflown"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:     "policy weight is not positive",
 | 
			
		||||
			policy:   config.Policy{Priorities: []config.PriorityPolicy{{Name: "NoWeightPriority", Weight: 0}}},
 | 
			
		||||
			expected: errors.New("priority NoWeightPriority should have a positive weight applied to it or it has overflown"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:     "valid weight priority",
 | 
			
		||||
			policy:   config.Policy{Priorities: []config.PriorityPolicy{{Name: "WeightPriority", Weight: 2}}},
 | 
			
		||||
			expected: nil,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:     "invalid negative weight policy",
 | 
			
		||||
			policy:   config.Policy{Priorities: []config.PriorityPolicy{{Name: "WeightPriority", Weight: -2}}},
 | 
			
		||||
			expected: errors.New("priority WeightPriority should have a positive weight applied to it or it has overflown"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:     "policy weight exceeds maximum",
 | 
			
		||||
			policy:   config.Policy{Priorities: []config.PriorityPolicy{{Name: "WeightPriority", Weight: config.MaxWeight}}},
 | 
			
		||||
			expected: errors.New("priority WeightPriority should have a positive weight applied to it or it has overflown"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:     "valid weight in policy extender config",
 | 
			
		||||
			policy:   config.Policy{Extenders: []config.Extender{{URLPrefix: "http://127.0.0.1:8081/extender", PrioritizeVerb: "prioritize", Weight: 2}}},
 | 
			
		||||
			expected: nil,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:     "invalid negative weight in policy extender config",
 | 
			
		||||
			policy:   config.Policy{Extenders: []config.Extender{{URLPrefix: "http://127.0.0.1:8081/extender", PrioritizeVerb: "prioritize", Weight: -2}}},
 | 
			
		||||
			expected: errors.New("extenders[0].weight: Invalid value: -2: must have a positive weight applied to it"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:     "valid filter verb and url prefix",
 | 
			
		||||
			policy:   config.Policy{Extenders: []config.Extender{{URLPrefix: "http://127.0.0.1:8081/extender", FilterVerb: "filter"}}},
 | 
			
		||||
			expected: nil,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:     "valid preemt verb and urlprefix",
 | 
			
		||||
			policy:   config.Policy{Extenders: []config.Extender{{URLPrefix: "http://127.0.0.1:8081/extender", PreemptVerb: "preempt"}}},
 | 
			
		||||
			expected: nil,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid multiple extenders",
 | 
			
		||||
			policy: config.Policy{
 | 
			
		||||
				Extenders: []config.Extender{
 | 
			
		||||
					{URLPrefix: "http://127.0.0.1:8081/extender", BindVerb: "bind"},
 | 
			
		||||
					{URLPrefix: "http://127.0.0.1:8082/extender", BindVerb: "bind"},
 | 
			
		||||
				}},
 | 
			
		||||
			expected: errors.New("extenders: Invalid value: \"found 2 extenders implementing bind\": only one extender can implement bind"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid duplicate extender resource name",
 | 
			
		||||
			policy: config.Policy{
 | 
			
		||||
				Extenders: []config.Extender{
 | 
			
		||||
					{URLPrefix: "http://127.0.0.1:8081/extender", ManagedResources: []config.ExtenderManagedResource{{Name: "foo.com/bar"}}},
 | 
			
		||||
					{URLPrefix: "http://127.0.0.1:8082/extender", BindVerb: "bind", ManagedResources: []config.ExtenderManagedResource{{Name: "foo.com/bar"}}},
 | 
			
		||||
				}},
 | 
			
		||||
			expected: errors.New("extenders[1].managedResources[0].name: Invalid value: \"foo.com/bar\": duplicate extender managed resource name"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid extended resource name",
 | 
			
		||||
			policy: config.Policy{
 | 
			
		||||
				Extenders: []config.Extender{
 | 
			
		||||
					{URLPrefix: "http://127.0.0.1:8081/extender", ManagedResources: []config.ExtenderManagedResource{{Name: "kubernetes.io/foo"}}},
 | 
			
		||||
				}},
 | 
			
		||||
			expected: errors.New("extenders[0].managedResources[0].name: Invalid value: \"kubernetes.io/foo\": is an invalid extended resource name"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid redeclared RequestedToCapacityRatio custom priority",
 | 
			
		||||
			policy: config.Policy{
 | 
			
		||||
				Priorities: []config.PriorityPolicy{
 | 
			
		||||
					{Name: "customPriority1", Weight: 1, Argument: &config.PriorityArgument{RequestedToCapacityRatioArguments: &config.RequestedToCapacityRatioArguments{}}},
 | 
			
		||||
					{Name: "customPriority2", Weight: 1, Argument: &config.PriorityArgument{RequestedToCapacityRatioArguments: &config.RequestedToCapacityRatioArguments{}}},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expected: errors.New("priority \"customPriority2\" redeclares custom priority \"RequestedToCapacityRatio\", from: \"customPriority1\""),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "different weights for LabelPreference custom priority",
 | 
			
		||||
			policy: config.Policy{
 | 
			
		||||
				Priorities: []config.PriorityPolicy{
 | 
			
		||||
					{Name: "customPriority1", Weight: 1, Argument: &config.PriorityArgument{LabelPreference: &config.LabelPreference{}}},
 | 
			
		||||
					{Name: "customPriority2", Weight: 2, Argument: &config.PriorityArgument{LabelPreference: &config.LabelPreference{}}},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expected: errors.New("LabelPreference  priority \"customPriority2\" has a different weight with \"customPriority1\""),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid hardPodAffinitySymmetricWeight, above the range",
 | 
			
		||||
			policy: config.Policy{
 | 
			
		||||
				HardPodAffinitySymmetricWeight: 101,
 | 
			
		||||
			},
 | 
			
		||||
			expected: errors.New("hardPodAffinitySymmetricWeight: Invalid value: 101: not in valid range [0-100]"),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid hardPodAffinitySymmetricWeight, below the range",
 | 
			
		||||
			policy: config.Policy{
 | 
			
		||||
				HardPodAffinitySymmetricWeight: -1,
 | 
			
		||||
			},
 | 
			
		||||
			expected: errors.New("hardPodAffinitySymmetricWeight: Invalid value: -1: not in valid range [0-100]"),
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, test := range tests {
 | 
			
		||||
		t.Run(test.name, func(t *testing.T) {
 | 
			
		||||
			actual := ValidatePolicy(test.policy)
 | 
			
		||||
			if fmt.Sprint(test.expected) != fmt.Sprint(actual) {
 | 
			
		||||
				t.Errorf("expected: %s, actual: %s", test.expected, actual)
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										198
									
								
								pkg/scheduler/apis/config/zz_generated.deepcopy.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										198
									
								
								pkg/scheduler/apis/config/zz_generated.deepcopy.go
									
									
									
										generated
									
									
									
								
							@@ -220,43 +220,6 @@ func (in *KubeSchedulerProfile) DeepCopy() *KubeSchedulerProfile {
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *LabelPreference) DeepCopyInto(out *LabelPreference) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelPreference.
 | 
			
		||||
func (in *LabelPreference) DeepCopy() *LabelPreference {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(LabelPreference)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *LabelsPresence) DeepCopyInto(out *LabelsPresence) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.Labels != nil {
 | 
			
		||||
		in, out := &in.Labels, &out.Labels
 | 
			
		||||
		*out = make([]string, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelsPresence.
 | 
			
		||||
func (in *LabelsPresence) DeepCopy() *LabelsPresence {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(LabelsPresence)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *NodeAffinityArgs) DeepCopyInto(out *NodeAffinityArgs) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
@@ -582,141 +545,6 @@ func (in *PodTopologySpreadArgs) DeepCopyObject() runtime.Object {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *Policy) DeepCopyInto(out *Policy) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	out.TypeMeta = in.TypeMeta
 | 
			
		||||
	if in.Predicates != nil {
 | 
			
		||||
		in, out := &in.Predicates, &out.Predicates
 | 
			
		||||
		*out = make([]PredicatePolicy, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			(*in)[i].DeepCopyInto(&(*out)[i])
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if in.Priorities != nil {
 | 
			
		||||
		in, out := &in.Priorities, &out.Priorities
 | 
			
		||||
		*out = make([]PriorityPolicy, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			(*in)[i].DeepCopyInto(&(*out)[i])
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if in.Extenders != nil {
 | 
			
		||||
		in, out := &in.Extenders, &out.Extenders
 | 
			
		||||
		*out = make([]Extender, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			(*in)[i].DeepCopyInto(&(*out)[i])
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy.
 | 
			
		||||
func (in *Policy) DeepCopy() *Policy {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(Policy)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
 | 
			
		||||
func (in *Policy) 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 *PredicateArgument) DeepCopyInto(out *PredicateArgument) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.LabelsPresence != nil {
 | 
			
		||||
		in, out := &in.LabelsPresence, &out.LabelsPresence
 | 
			
		||||
		*out = new(LabelsPresence)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PredicateArgument.
 | 
			
		||||
func (in *PredicateArgument) DeepCopy() *PredicateArgument {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(PredicateArgument)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *PredicatePolicy) DeepCopyInto(out *PredicatePolicy) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.Argument != nil {
 | 
			
		||||
		in, out := &in.Argument, &out.Argument
 | 
			
		||||
		*out = new(PredicateArgument)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PredicatePolicy.
 | 
			
		||||
func (in *PredicatePolicy) DeepCopy() *PredicatePolicy {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(PredicatePolicy)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *PriorityArgument) DeepCopyInto(out *PriorityArgument) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.LabelPreference != nil {
 | 
			
		||||
		in, out := &in.LabelPreference, &out.LabelPreference
 | 
			
		||||
		*out = new(LabelPreference)
 | 
			
		||||
		**out = **in
 | 
			
		||||
	}
 | 
			
		||||
	if in.RequestedToCapacityRatioArguments != nil {
 | 
			
		||||
		in, out := &in.RequestedToCapacityRatioArguments, &out.RequestedToCapacityRatioArguments
 | 
			
		||||
		*out = new(RequestedToCapacityRatioArguments)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityArgument.
 | 
			
		||||
func (in *PriorityArgument) DeepCopy() *PriorityArgument {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(PriorityArgument)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *PriorityPolicy) DeepCopyInto(out *PriorityPolicy) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.Argument != nil {
 | 
			
		||||
		in, out := &in.Argument, &out.Argument
 | 
			
		||||
		*out = new(PriorityArgument)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityPolicy.
 | 
			
		||||
func (in *PriorityPolicy) DeepCopy() *PriorityPolicy {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(PriorityPolicy)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *RequestedToCapacityRatioArgs) DeepCopyInto(out *RequestedToCapacityRatioArgs) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
@@ -752,32 +580,6 @@ func (in *RequestedToCapacityRatioArgs) DeepCopyObject() runtime.Object {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *RequestedToCapacityRatioArguments) DeepCopyInto(out *RequestedToCapacityRatioArguments) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.Shape != nil {
 | 
			
		||||
		in, out := &in.Shape, &out.Shape
 | 
			
		||||
		*out = make([]UtilizationShapePoint, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	if in.Resources != nil {
 | 
			
		||||
		in, out := &in.Resources, &out.Resources
 | 
			
		||||
		*out = make([]ResourceSpec, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestedToCapacityRatioArguments.
 | 
			
		||||
func (in *RequestedToCapacityRatioArguments) DeepCopy() *RequestedToCapacityRatioArguments {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(RequestedToCapacityRatioArguments)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *RequestedToCapacityRatioParam) DeepCopyInto(out *RequestedToCapacityRatioParam) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
 
 | 
			
		||||
@@ -1,682 +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 plugins
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"sort"
 | 
			
		||||
 | 
			
		||||
	v1 "k8s.io/api/core/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/util/sets"
 | 
			
		||||
	"k8s.io/apiserver/pkg/util/feature"
 | 
			
		||||
	"k8s.io/klog/v2"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/features"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/imagelocality"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodelabel"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodename"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeports"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodepreferavoidpods"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeunschedulable"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodevolumelimits"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/podtopologyspread"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/selectorspread"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/tainttoleration"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumerestrictions"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumezone"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// EqualPriority defines the name of prioritizer function that gives an equal weight of one to all nodes.
 | 
			
		||||
	EqualPriority = "EqualPriority"
 | 
			
		||||
	// MostRequestedPriority defines the name of prioritizer function that gives used nodes higher priority.
 | 
			
		||||
	MostRequestedPriority = "MostRequestedPriority"
 | 
			
		||||
	// RequestedToCapacityRatioPriority defines the name of RequestedToCapacityRatioPriority.
 | 
			
		||||
	RequestedToCapacityRatioPriority = "RequestedToCapacityRatioPriority"
 | 
			
		||||
	// SelectorSpreadPriority defines the name of prioritizer function that spreads pods by minimizing
 | 
			
		||||
	// the number of pods (belonging to the same service or replication controller) on the same node.
 | 
			
		||||
	SelectorSpreadPriority = "SelectorSpreadPriority"
 | 
			
		||||
	// ServiceSpreadingPriority is largely replaced by "SelectorSpreadPriority".
 | 
			
		||||
	ServiceSpreadingPriority = "ServiceSpreadingPriority"
 | 
			
		||||
	// InterPodAffinityPriority defines the name of prioritizer function that decides which pods should or
 | 
			
		||||
	// should not be placed in the same topological domain as some other pods.
 | 
			
		||||
	InterPodAffinityPriority = "InterPodAffinityPriority"
 | 
			
		||||
	// LeastRequestedPriority defines the name of prioritizer function that prioritize nodes by least
 | 
			
		||||
	// requested utilization.
 | 
			
		||||
	LeastRequestedPriority = "LeastRequestedPriority"
 | 
			
		||||
	// BalancedResourceAllocation defines the name of prioritizer function that prioritizes nodes
 | 
			
		||||
	// to help achieve balanced resource usage.
 | 
			
		||||
	BalancedResourceAllocation = "BalancedResourceAllocation"
 | 
			
		||||
	// NodePreferAvoidPodsPriority defines the name of prioritizer function that priorities nodes according to
 | 
			
		||||
	// the node annotation "scheduler.alpha.kubernetes.io/preferAvoidPods".
 | 
			
		||||
	NodePreferAvoidPodsPriority = "NodePreferAvoidPodsPriority"
 | 
			
		||||
	// NodeAffinityPriority defines the name of prioritizer function that prioritizes nodes which have labels
 | 
			
		||||
	// matching NodeAffinity.
 | 
			
		||||
	NodeAffinityPriority = "NodeAffinityPriority"
 | 
			
		||||
	// TaintTolerationPriority defines the name of prioritizer function that prioritizes nodes that marked
 | 
			
		||||
	// with taint which pod can tolerate.
 | 
			
		||||
	TaintTolerationPriority = "TaintTolerationPriority"
 | 
			
		||||
	// ImageLocalityPriority defines the name of prioritizer function that prioritizes nodes that have images
 | 
			
		||||
	// requested by the pod present.
 | 
			
		||||
	ImageLocalityPriority = "ImageLocalityPriority"
 | 
			
		||||
	// EvenPodsSpreadPriority defines the name of prioritizer function that prioritizes nodes
 | 
			
		||||
	// which have pods and labels matching the incoming pod's topologySpreadConstraints.
 | 
			
		||||
	EvenPodsSpreadPriority = "EvenPodsSpreadPriority"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// MatchInterPodAffinityPred defines the name of predicate MatchInterPodAffinity.
 | 
			
		||||
	MatchInterPodAffinityPred = "MatchInterPodAffinity"
 | 
			
		||||
	// CheckVolumeBindingPred defines the name of predicate CheckVolumeBinding.
 | 
			
		||||
	CheckVolumeBindingPred = "CheckVolumeBinding"
 | 
			
		||||
	// GeneralPred defines the name of predicate GeneralPredicates.
 | 
			
		||||
	GeneralPred = "GeneralPredicates"
 | 
			
		||||
	// HostNamePred defines the name of predicate HostName.
 | 
			
		||||
	HostNamePred = "HostName"
 | 
			
		||||
	// PodFitsHostPortsPred defines the name of predicate PodFitsHostPorts.
 | 
			
		||||
	PodFitsHostPortsPred = "PodFitsHostPorts"
 | 
			
		||||
	// MatchNodeSelectorPred defines the name of predicate MatchNodeSelector.
 | 
			
		||||
	MatchNodeSelectorPred = "MatchNodeSelector"
 | 
			
		||||
	// PodFitsResourcesPred defines the name of predicate PodFitsResources.
 | 
			
		||||
	PodFitsResourcesPred = "PodFitsResources"
 | 
			
		||||
	// NoDiskConflictPred defines the name of predicate NoDiskConflict.
 | 
			
		||||
	NoDiskConflictPred = "NoDiskConflict"
 | 
			
		||||
	// PodToleratesNodeTaintsPred defines the name of predicate PodToleratesNodeTaints.
 | 
			
		||||
	PodToleratesNodeTaintsPred = "PodToleratesNodeTaints"
 | 
			
		||||
	// CheckNodeUnschedulablePred defines the name of predicate CheckNodeUnschedulablePredicate.
 | 
			
		||||
	CheckNodeUnschedulablePred = "CheckNodeUnschedulable"
 | 
			
		||||
	// CheckNodeLabelPresencePred defines the name of predicate CheckNodeLabelPresence.
 | 
			
		||||
	CheckNodeLabelPresencePred = "CheckNodeLabelPresence"
 | 
			
		||||
	// MaxEBSVolumeCountPred defines the name of predicate MaxEBSVolumeCount.
 | 
			
		||||
	// DEPRECATED
 | 
			
		||||
	// All cloudprovider specific predicates are deprecated in favour of MaxCSIVolumeCountPred.
 | 
			
		||||
	MaxEBSVolumeCountPred = "MaxEBSVolumeCount"
 | 
			
		||||
	// MaxGCEPDVolumeCountPred defines the name of predicate MaxGCEPDVolumeCount.
 | 
			
		||||
	// DEPRECATED
 | 
			
		||||
	// All cloudprovider specific predicates are deprecated in favour of MaxCSIVolumeCountPred.
 | 
			
		||||
	MaxGCEPDVolumeCountPred = "MaxGCEPDVolumeCount"
 | 
			
		||||
	// MaxAzureDiskVolumeCountPred defines the name of predicate MaxAzureDiskVolumeCount.
 | 
			
		||||
	// DEPRECATED
 | 
			
		||||
	// All cloudprovider specific predicates are deprecated in favour of MaxCSIVolumeCountPred.
 | 
			
		||||
	MaxAzureDiskVolumeCountPred = "MaxAzureDiskVolumeCount"
 | 
			
		||||
	// MaxCinderVolumeCountPred defines the name of predicate MaxCinderDiskVolumeCount.
 | 
			
		||||
	// DEPRECATED
 | 
			
		||||
	// All cloudprovider specific predicates are deprecated in favour of MaxCSIVolumeCountPred.
 | 
			
		||||
	MaxCinderVolumeCountPred = "MaxCinderVolumeCount"
 | 
			
		||||
	// MaxCSIVolumeCountPred defines the predicate that decides how many CSI volumes should be attached.
 | 
			
		||||
	MaxCSIVolumeCountPred = "MaxCSIVolumeCountPred"
 | 
			
		||||
	// NoVolumeZoneConflictPred defines the name of predicate NoVolumeZoneConflict.
 | 
			
		||||
	NoVolumeZoneConflictPred = "NoVolumeZoneConflict"
 | 
			
		||||
	// EvenPodsSpreadPred defines the name of predicate EvenPodsSpread.
 | 
			
		||||
	EvenPodsSpreadPred = "EvenPodsSpread"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// predicateOrdering is the ordering of predicate execution.
 | 
			
		||||
var predicateOrdering = []string{
 | 
			
		||||
	CheckNodeUnschedulablePred,
 | 
			
		||||
	GeneralPred, HostNamePred, PodFitsHostPortsPred,
 | 
			
		||||
	MatchNodeSelectorPred, PodFitsResourcesPred, NoDiskConflictPred,
 | 
			
		||||
	PodToleratesNodeTaintsPred, CheckNodeLabelPresencePred,
 | 
			
		||||
	MaxEBSVolumeCountPred, MaxGCEPDVolumeCountPred, MaxCSIVolumeCountPred,
 | 
			
		||||
	MaxAzureDiskVolumeCountPred, MaxCinderVolumeCountPred, CheckVolumeBindingPred, NoVolumeZoneConflictPred,
 | 
			
		||||
	EvenPodsSpreadPred, MatchInterPodAffinityPred,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LegacyRegistry is used to store current state of registered predicates and priorities.
 | 
			
		||||
type LegacyRegistry struct {
 | 
			
		||||
	// maps that associate predicates/priorities with framework plugin configurations.
 | 
			
		||||
	predicateToConfigProducer map[string]configProducer
 | 
			
		||||
	priorityToConfigProducer  map[string]configProducer
 | 
			
		||||
	// predicates that will always be configured.
 | 
			
		||||
	mandatoryPredicates sets.String
 | 
			
		||||
	// predicates and priorities that will be used if either was set to nil in a
 | 
			
		||||
	// given v1.Policy configuration.
 | 
			
		||||
	DefaultPredicates sets.String
 | 
			
		||||
	DefaultPriorities map[string]int64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ConfigProducerArgs contains arguments that are passed to the producer.
 | 
			
		||||
// As we add more predicates/priorities to framework plugins mappings, more arguments
 | 
			
		||||
// may be added here.
 | 
			
		||||
type ConfigProducerArgs struct {
 | 
			
		||||
	// Weight used for priority functions.
 | 
			
		||||
	Weight int32
 | 
			
		||||
	// NodeLabelArgs is the args for the NodeLabel plugin.
 | 
			
		||||
	NodeLabelArgs *config.NodeLabelArgs
 | 
			
		||||
	// RequestedToCapacityRatioArgs is the args for the RequestedToCapacityRatio plugin.
 | 
			
		||||
	RequestedToCapacityRatioArgs *config.RequestedToCapacityRatioArgs
 | 
			
		||||
	// NodeResourcesFitArgs is the args for the NodeResources fit filter.
 | 
			
		||||
	NodeResourcesFitArgs *config.NodeResourcesFitArgs
 | 
			
		||||
	// InterPodAffinityArgs is the args for InterPodAffinity plugin
 | 
			
		||||
	InterPodAffinityArgs *config.InterPodAffinityArgs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// configProducer appends the set of plugins and their configuration for a
 | 
			
		||||
// predicate/priority given the args.
 | 
			
		||||
type configProducer func(ConfigProducerArgs, *config.Plugins, *[]config.PluginConfig)
 | 
			
		||||
 | 
			
		||||
// NewLegacyRegistry returns a legacy algorithm registry of predicates and priorities.
 | 
			
		||||
func NewLegacyRegistry() *LegacyRegistry {
 | 
			
		||||
	registry := &LegacyRegistry{
 | 
			
		||||
		// mandatoryPredicates the set of keys for predicates that the scheduler will
 | 
			
		||||
		// be configured with all the time.
 | 
			
		||||
		mandatoryPredicates: sets.NewString(
 | 
			
		||||
			PodToleratesNodeTaintsPred,
 | 
			
		||||
			CheckNodeUnschedulablePred,
 | 
			
		||||
		),
 | 
			
		||||
 | 
			
		||||
		// Used as the default set of predicates if Policy was specified, but predicates was nil.
 | 
			
		||||
		DefaultPredicates: sets.NewString(
 | 
			
		||||
			NoVolumeZoneConflictPred,
 | 
			
		||||
			MaxEBSVolumeCountPred,
 | 
			
		||||
			MaxGCEPDVolumeCountPred,
 | 
			
		||||
			MaxAzureDiskVolumeCountPred,
 | 
			
		||||
			MaxCSIVolumeCountPred,
 | 
			
		||||
			MatchInterPodAffinityPred,
 | 
			
		||||
			NoDiskConflictPred,
 | 
			
		||||
			GeneralPred,
 | 
			
		||||
			PodToleratesNodeTaintsPred,
 | 
			
		||||
			CheckVolumeBindingPred,
 | 
			
		||||
			CheckNodeUnschedulablePred,
 | 
			
		||||
			EvenPodsSpreadPred,
 | 
			
		||||
		),
 | 
			
		||||
 | 
			
		||||
		// Used as the default set of predicates if Policy was specified, but priorities was nil.
 | 
			
		||||
		DefaultPriorities: map[string]int64{
 | 
			
		||||
			SelectorSpreadPriority:      1,
 | 
			
		||||
			InterPodAffinityPriority:    1,
 | 
			
		||||
			LeastRequestedPriority:      1,
 | 
			
		||||
			BalancedResourceAllocation:  1,
 | 
			
		||||
			NodePreferAvoidPodsPriority: 10000,
 | 
			
		||||
			NodeAffinityPriority:        1,
 | 
			
		||||
			TaintTolerationPriority:     1,
 | 
			
		||||
			ImageLocalityPriority:       1,
 | 
			
		||||
			EvenPodsSpreadPriority:      2,
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		predicateToConfigProducer: make(map[string]configProducer),
 | 
			
		||||
		priorityToConfigProducer:  make(map[string]configProducer),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	registry.registerPredicateConfigProducer(GeneralPred,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			// GeneralPredicate is a combination of predicates.
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, noderesources.FitName, nil)
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, noderesources.FitName, nil)
 | 
			
		||||
			if args.NodeResourcesFitArgs != nil {
 | 
			
		||||
				*pluginConfig = append(*pluginConfig,
 | 
			
		||||
					config.PluginConfig{Name: noderesources.FitName, Args: args.NodeResourcesFitArgs})
 | 
			
		||||
			}
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodename.Name, nil)
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodeports.Name, nil)
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, nodeports.Name, nil)
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodeaffinity.Name, nil)
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, nodeaffinity.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(PodToleratesNodeTaintsPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, tainttoleration.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(PodFitsResourcesPred,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, noderesources.FitName, nil)
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, noderesources.FitName, nil)
 | 
			
		||||
			if args.NodeResourcesFitArgs != nil {
 | 
			
		||||
				*pluginConfig = append(*pluginConfig,
 | 
			
		||||
					config.PluginConfig{Name: noderesources.FitName, Args: args.NodeResourcesFitArgs})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(HostNamePred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodename.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(PodFitsHostPortsPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodeports.Name, nil)
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, nodeports.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(MatchNodeSelectorPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodeaffinity.Name, nil)
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, nodeaffinity.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(CheckNodeUnschedulablePred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodeunschedulable.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(CheckVolumeBindingPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, volumebinding.Name, nil)
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, volumebinding.Name, nil)
 | 
			
		||||
			plugins.Reserve = appendToPluginSet(plugins.Reserve, volumebinding.Name, nil)
 | 
			
		||||
			plugins.PreBind = appendToPluginSet(plugins.PreBind, volumebinding.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(NoDiskConflictPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, volumerestrictions.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(NoVolumeZoneConflictPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, volumezone.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(MaxCSIVolumeCountPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodevolumelimits.CSIName, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(MaxEBSVolumeCountPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodevolumelimits.EBSName, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(MaxGCEPDVolumeCountPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodevolumelimits.GCEPDName, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(MaxAzureDiskVolumeCountPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodevolumelimits.AzureDiskName, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(MaxCinderVolumeCountPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodevolumelimits.CinderName, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(MatchInterPodAffinityPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, interpodaffinity.Name, nil)
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, interpodaffinity.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(CheckNodeLabelPresencePred,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, nodelabel.Name, nil)
 | 
			
		||||
			if args.NodeLabelArgs != nil {
 | 
			
		||||
				*pluginConfig = append(*pluginConfig,
 | 
			
		||||
					config.PluginConfig{Name: nodelabel.Name, Args: args.NodeLabelArgs})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPredicateConfigProducer(EvenPodsSpreadPred,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.PreFilter = appendToPluginSet(plugins.PreFilter, podtopologyspread.Name, nil)
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, podtopologyspread.Name, nil)
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
	// Register Priorities.
 | 
			
		||||
	registry.registerPriorityConfigProducer(SelectorSpreadPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			if !feature.DefaultFeatureGate.Enabled(features.DefaultPodTopologySpread) {
 | 
			
		||||
				plugins.Score = appendToPluginSet(plugins.Score, selectorspread.Name, &args.Weight)
 | 
			
		||||
				plugins.PreScore = appendToPluginSet(plugins.PreScore, selectorspread.Name, nil)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, podtopologyspread.Name, &args.Weight)
 | 
			
		||||
			plugins.PreScore = appendToPluginSet(plugins.PreScore, podtopologyspread.Name, nil)
 | 
			
		||||
			plArgs := config.PodTopologySpreadArgs{
 | 
			
		||||
				DefaultingType: config.SystemDefaulting,
 | 
			
		||||
			}
 | 
			
		||||
			// The order in which SelectorSpreadPriority or EvenPodsSpreadPriority producers
 | 
			
		||||
			// are called is not guaranteed. Override or append configuration.
 | 
			
		||||
			for i, e := range *pluginConfig {
 | 
			
		||||
				if e.Name == podtopologyspread.Name {
 | 
			
		||||
					(*pluginConfig)[i].Args = &plArgs
 | 
			
		||||
					return
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			*pluginConfig = append(*pluginConfig, config.PluginConfig{
 | 
			
		||||
				Name: podtopologyspread.Name,
 | 
			
		||||
				Args: &plArgs,
 | 
			
		||||
			})
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(TaintTolerationPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.PreScore = appendToPluginSet(plugins.PreScore, tainttoleration.Name, nil)
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, tainttoleration.Name, &args.Weight)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(NodeAffinityPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.PreScore = appendToPluginSet(plugins.PreScore, nodeaffinity.Name, nil)
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, nodeaffinity.Name, &args.Weight)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(ImageLocalityPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, imagelocality.Name, &args.Weight)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(InterPodAffinityPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			plugins.PreScore = appendToPluginSet(plugins.PreScore, interpodaffinity.Name, nil)
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, interpodaffinity.Name, &args.Weight)
 | 
			
		||||
			if args.InterPodAffinityArgs != nil {
 | 
			
		||||
				*pluginConfig = append(*pluginConfig,
 | 
			
		||||
					config.PluginConfig{Name: interpodaffinity.Name, Args: args.InterPodAffinityArgs})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(NodePreferAvoidPodsPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, nodepreferavoidpods.Name, &args.Weight)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(MostRequestedPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, noderesources.MostAllocatedName, &args.Weight)
 | 
			
		||||
			*pluginConfig = append(*pluginConfig,
 | 
			
		||||
				config.PluginConfig{Name: noderesources.MostAllocatedName, Args: &config.NodeResourcesMostAllocatedArgs{
 | 
			
		||||
					Resources: []config.ResourceSpec{
 | 
			
		||||
						{Name: string(v1.ResourceCPU), Weight: 1},
 | 
			
		||||
						{Name: string(v1.ResourceMemory), Weight: 1},
 | 
			
		||||
					},
 | 
			
		||||
				}})
 | 
			
		||||
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(BalancedResourceAllocation,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, noderesources.BalancedAllocationName, &args.Weight)
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(LeastRequestedPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, noderesources.LeastAllocatedName, &args.Weight)
 | 
			
		||||
			*pluginConfig = append(*pluginConfig,
 | 
			
		||||
				config.PluginConfig{Name: noderesources.LeastAllocatedName, Args: &config.NodeResourcesLeastAllocatedArgs{
 | 
			
		||||
					Resources: []config.ResourceSpec{
 | 
			
		||||
						{Name: string(v1.ResourceCPU), Weight: 1},
 | 
			
		||||
						{Name: string(v1.ResourceMemory), Weight: 1},
 | 
			
		||||
					},
 | 
			
		||||
				}})
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(noderesources.RequestedToCapacityRatioName,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, noderesources.RequestedToCapacityRatioName, &args.Weight)
 | 
			
		||||
			if args.RequestedToCapacityRatioArgs != nil {
 | 
			
		||||
				*pluginConfig = append(*pluginConfig,
 | 
			
		||||
					config.PluginConfig{Name: noderesources.RequestedToCapacityRatioName, Args: args.RequestedToCapacityRatioArgs})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(nodelabel.Name,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			// If there are n LabelPreference priorities in the policy, the weight for the corresponding
 | 
			
		||||
			// score plugin is n*weight (note that the validation logic verifies that all LabelPreference
 | 
			
		||||
			// priorities specified in Policy have the same weight).
 | 
			
		||||
			weight := args.Weight * int32(len(args.NodeLabelArgs.PresentLabelsPreference)+len(args.NodeLabelArgs.AbsentLabelsPreference))
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, nodelabel.Name, &weight)
 | 
			
		||||
			if args.NodeLabelArgs != nil {
 | 
			
		||||
				*pluginConfig = append(*pluginConfig,
 | 
			
		||||
					config.PluginConfig{Name: nodelabel.Name, Args: args.NodeLabelArgs})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	registry.registerPriorityConfigProducer(EvenPodsSpreadPriority,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, pluginConfig *[]config.PluginConfig) {
 | 
			
		||||
			plugins.PreScore = appendToPluginSet(plugins.PreScore, podtopologyspread.Name, nil)
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, podtopologyspread.Name, &args.Weight)
 | 
			
		||||
			if feature.DefaultFeatureGate.Enabled(features.DefaultPodTopologySpread) {
 | 
			
		||||
				// The order in which SelectorSpreadPriority or EvenPodsSpreadPriority producers
 | 
			
		||||
				// are called is not guaranteed. If plugin was not configured yet, append
 | 
			
		||||
				// configuration where system default constraints are disabled.
 | 
			
		||||
				for _, e := range *pluginConfig {
 | 
			
		||||
					if e.Name == podtopologyspread.Name {
 | 
			
		||||
						return
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				*pluginConfig = append(*pluginConfig, config.PluginConfig{
 | 
			
		||||
					Name: podtopologyspread.Name,
 | 
			
		||||
					Args: &config.PodTopologySpreadArgs{
 | 
			
		||||
						DefaultingType: config.ListDefaulting,
 | 
			
		||||
					},
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
	return registry
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AppendPredicateConfigs returns predicates configuration that will run as framework plugins.
 | 
			
		||||
// Note that the framework executes plugins according to their order in the Plugins list, and so predicates run as plugins
 | 
			
		||||
// are added to the Plugins list according to the order specified in predicateOrdering.
 | 
			
		||||
func (lr *LegacyRegistry) AppendPredicateConfigs(keys sets.String, args *ConfigProducerArgs, plugins config.Plugins, pluginConfig []config.PluginConfig) (config.Plugins, []config.PluginConfig, error) {
 | 
			
		||||
	allPredicates := keys.Union(lr.mandatoryPredicates)
 | 
			
		||||
 | 
			
		||||
	// Create the framework plugin configurations, and place them in the order
 | 
			
		||||
	// that the corresponding predicates were supposed to run.
 | 
			
		||||
	for _, predicateKey := range predicateOrdering {
 | 
			
		||||
		if allPredicates.Has(predicateKey) {
 | 
			
		||||
			producer, exist := lr.predicateToConfigProducer[predicateKey]
 | 
			
		||||
			if !exist {
 | 
			
		||||
				return config.Plugins{}, nil, fmt.Errorf("no framework config producer registered for %q", predicateKey)
 | 
			
		||||
			}
 | 
			
		||||
			producer(*args, &plugins, &pluginConfig)
 | 
			
		||||
			allPredicates.Delete(predicateKey)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Sort the keys so that it is easier for unit tests to do compare.
 | 
			
		||||
	sortedKeys := make([]string, 0, len(allPredicates))
 | 
			
		||||
	for k := range allPredicates {
 | 
			
		||||
		sortedKeys = append(sortedKeys, k)
 | 
			
		||||
	}
 | 
			
		||||
	sort.Strings(sortedKeys)
 | 
			
		||||
 | 
			
		||||
	for _, predicateKey := range sortedKeys {
 | 
			
		||||
		producer, exist := lr.predicateToConfigProducer[predicateKey]
 | 
			
		||||
		if !exist {
 | 
			
		||||
			return config.Plugins{}, nil, fmt.Errorf("no framework config producer registered for %q", predicateKey)
 | 
			
		||||
		}
 | 
			
		||||
		producer(*args, &plugins, &pluginConfig)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return plugins, pluginConfig, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AppendPriorityConfigs returns priorities configuration that will run as framework plugins.
 | 
			
		||||
func (lr *LegacyRegistry) AppendPriorityConfigs(keys map[string]int64, args *ConfigProducerArgs, plugins config.Plugins, pluginConfig []config.PluginConfig) (config.Plugins, []config.PluginConfig, error) {
 | 
			
		||||
	// Sort the keys so that it is easier for unit tests to do compare.
 | 
			
		||||
	sortedKeys := make([]string, 0, len(keys))
 | 
			
		||||
	for k := range keys {
 | 
			
		||||
		sortedKeys = append(sortedKeys, k)
 | 
			
		||||
	}
 | 
			
		||||
	sort.Strings(sortedKeys)
 | 
			
		||||
 | 
			
		||||
	for _, priority := range sortedKeys {
 | 
			
		||||
		weight := keys[priority]
 | 
			
		||||
		producer, exist := lr.priorityToConfigProducer[priority]
 | 
			
		||||
		if !exist {
 | 
			
		||||
			return config.Plugins{}, nil, fmt.Errorf("no config producer registered for %q", priority)
 | 
			
		||||
		}
 | 
			
		||||
		a := *args
 | 
			
		||||
		a.Weight = int32(weight)
 | 
			
		||||
		producer(a, &plugins, &pluginConfig)
 | 
			
		||||
	}
 | 
			
		||||
	return plugins, pluginConfig, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// registers a config producer for a predicate.
 | 
			
		||||
func (lr *LegacyRegistry) registerPredicateConfigProducer(name string, producer configProducer) {
 | 
			
		||||
	if _, exist := lr.predicateToConfigProducer[name]; exist {
 | 
			
		||||
		klog.Fatalf("already registered %q", name)
 | 
			
		||||
	}
 | 
			
		||||
	lr.predicateToConfigProducer[name] = producer
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// registers a framework config producer for a priority.
 | 
			
		||||
func (lr *LegacyRegistry) registerPriorityConfigProducer(name string, producer configProducer) {
 | 
			
		||||
	if _, exist := lr.priorityToConfigProducer[name]; exist {
 | 
			
		||||
		klog.Fatalf("already registered %q", name)
 | 
			
		||||
	}
 | 
			
		||||
	lr.priorityToConfigProducer[name] = producer
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func appendToPluginSet(set config.PluginSet, name string, weight *int32) config.PluginSet {
 | 
			
		||||
	for _, e := range set.Enabled {
 | 
			
		||||
		if e.Name == name {
 | 
			
		||||
			// Keep the max weight.
 | 
			
		||||
			if weight != nil && *weight > e.Weight {
 | 
			
		||||
				e.Weight = *weight
 | 
			
		||||
			}
 | 
			
		||||
			return set
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	cfg := config.Plugin{Name: name}
 | 
			
		||||
	if weight != nil {
 | 
			
		||||
		cfg.Weight = *weight
 | 
			
		||||
	}
 | 
			
		||||
	set.Enabled = append(set.Enabled, cfg)
 | 
			
		||||
	return set
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProcessPredicatePolicy given a PredicatePolicy, return the plugin name implementing the predicate and update
 | 
			
		||||
// the ConfigProducerArgs if necessary.
 | 
			
		||||
func (lr *LegacyRegistry) ProcessPredicatePolicy(policy config.PredicatePolicy, pluginArgs *ConfigProducerArgs) (string, error) {
 | 
			
		||||
	if err := validatePredicate(policy); err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	predicateName := policy.Name
 | 
			
		||||
	if policy.Name == "PodFitsPorts" {
 | 
			
		||||
		// For compatibility reasons, "PodFitsPorts" as a key is still supported.
 | 
			
		||||
		predicateName = PodFitsHostPortsPred
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if _, ok := lr.predicateToConfigProducer[predicateName]; ok {
 | 
			
		||||
		// checking to see if a pre-defined predicate is requested
 | 
			
		||||
		klog.V(2).Infof("Predicate type %s already registered, reusing.", policy.Name)
 | 
			
		||||
		return predicateName, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if policy.Argument == nil || policy.Argument.LabelsPresence == nil {
 | 
			
		||||
		return "", fmt.Errorf("predicate type not found for %q", predicateName)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if policy.Argument.LabelsPresence != nil {
 | 
			
		||||
		// Map LabelPresence policy to ConfigProducerArgs that's used to configure the NodeLabel plugin.
 | 
			
		||||
		if pluginArgs.NodeLabelArgs == nil {
 | 
			
		||||
			pluginArgs.NodeLabelArgs = &config.NodeLabelArgs{}
 | 
			
		||||
		}
 | 
			
		||||
		if policy.Argument.LabelsPresence.Presence {
 | 
			
		||||
			pluginArgs.NodeLabelArgs.PresentLabels = append(pluginArgs.NodeLabelArgs.PresentLabels, policy.Argument.LabelsPresence.Labels...)
 | 
			
		||||
		} else {
 | 
			
		||||
			pluginArgs.NodeLabelArgs.AbsentLabels = append(pluginArgs.NodeLabelArgs.AbsentLabels, policy.Argument.LabelsPresence.Labels...)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// We use the CheckNodeLabelPresencePred predicate name for all kNodeLabel custom predicates.
 | 
			
		||||
		// It may get called multiple times but we essentially only register one instance of NodeLabel predicate.
 | 
			
		||||
		// This name is then used to find the registered plugin and run the plugin instead of the predicate.
 | 
			
		||||
		predicateName = CheckNodeLabelPresencePred
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	return predicateName, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProcessPriorityPolicy given a PriorityPolicy, return the plugin name implementing the priority and update
 | 
			
		||||
// the ConfigProducerArgs if necessary.
 | 
			
		||||
func (lr *LegacyRegistry) ProcessPriorityPolicy(policy config.PriorityPolicy, configProducerArgs *ConfigProducerArgs) (string, error) {
 | 
			
		||||
	if err := validatePriority(policy); err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	priorityName := policy.Name
 | 
			
		||||
	if policy.Name == ServiceSpreadingPriority {
 | 
			
		||||
		// For compatibility reasons, "ServiceSpreadingPriority" as a key is still supported.
 | 
			
		||||
		priorityName = SelectorSpreadPriority
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if _, ok := lr.priorityToConfigProducer[priorityName]; ok {
 | 
			
		||||
		klog.V(2).Infof("Priority type %s already registered, reusing.", priorityName)
 | 
			
		||||
		return priorityName, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// generate the priority function, if a custom priority is requested
 | 
			
		||||
	if policy.Argument == nil ||
 | 
			
		||||
		(policy.Argument.RequestedToCapacityRatioArguments == nil &&
 | 
			
		||||
			policy.Argument.LabelPreference == nil) {
 | 
			
		||||
		return "", fmt.Errorf("priority type not found for %q", priorityName)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if policy.Argument.LabelPreference != nil {
 | 
			
		||||
		// We use the NodeLabel plugin name for all NodeLabel custom priorities.
 | 
			
		||||
		// It may get called multiple times but we essentially only register one instance of NodeLabel priority.
 | 
			
		||||
		// This name is then used to find the registered plugin and run the plugin instead of the priority.
 | 
			
		||||
		priorityName = nodelabel.Name
 | 
			
		||||
		if configProducerArgs.NodeLabelArgs == nil {
 | 
			
		||||
			configProducerArgs.NodeLabelArgs = &config.NodeLabelArgs{}
 | 
			
		||||
		}
 | 
			
		||||
		if policy.Argument.LabelPreference.Presence {
 | 
			
		||||
			configProducerArgs.NodeLabelArgs.PresentLabelsPreference = append(
 | 
			
		||||
				configProducerArgs.NodeLabelArgs.PresentLabelsPreference,
 | 
			
		||||
				policy.Argument.LabelPreference.Label,
 | 
			
		||||
			)
 | 
			
		||||
		} else {
 | 
			
		||||
			configProducerArgs.NodeLabelArgs.AbsentLabelsPreference = append(
 | 
			
		||||
				configProducerArgs.NodeLabelArgs.AbsentLabelsPreference,
 | 
			
		||||
				policy.Argument.LabelPreference.Label,
 | 
			
		||||
			)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if policy.Argument.RequestedToCapacityRatioArguments != nil {
 | 
			
		||||
		policyArgs := policy.Argument.RequestedToCapacityRatioArguments
 | 
			
		||||
		args := &config.RequestedToCapacityRatioArgs{}
 | 
			
		||||
 | 
			
		||||
		args.Shape = make([]config.UtilizationShapePoint, len(policyArgs.Shape))
 | 
			
		||||
		for i, s := range policyArgs.Shape {
 | 
			
		||||
			args.Shape[i] = config.UtilizationShapePoint{
 | 
			
		||||
				Utilization: s.Utilization,
 | 
			
		||||
				Score:       s.Score,
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		args.Resources = make([]config.ResourceSpec, len(policyArgs.Resources))
 | 
			
		||||
		for i, r := range policyArgs.Resources {
 | 
			
		||||
			args.Resources[i] = config.ResourceSpec{
 | 
			
		||||
				Name:   r.Name,
 | 
			
		||||
				Weight: r.Weight,
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		configProducerArgs.RequestedToCapacityRatioArgs = args
 | 
			
		||||
 | 
			
		||||
		// We do not allow specifying the name for custom plugins, see #83472
 | 
			
		||||
		priorityName = noderesources.RequestedToCapacityRatioName
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return priorityName, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func validatePredicate(predicate config.PredicatePolicy) error {
 | 
			
		||||
	if predicate.Argument != nil {
 | 
			
		||||
		numArgs := 0
 | 
			
		||||
		if predicate.Argument.LabelsPresence != nil {
 | 
			
		||||
			numArgs++
 | 
			
		||||
		}
 | 
			
		||||
		if numArgs != 1 {
 | 
			
		||||
			return fmt.Errorf("exactly 1 predicate argument is required, numArgs: %v, predicate %v", numArgs, predicate)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func validatePriority(priority config.PriorityPolicy) error {
 | 
			
		||||
	if priority.Argument != nil {
 | 
			
		||||
		numArgs := 0
 | 
			
		||||
		if priority.Argument.LabelPreference != nil {
 | 
			
		||||
			numArgs++
 | 
			
		||||
		}
 | 
			
		||||
		if priority.Argument.RequestedToCapacityRatioArguments != nil {
 | 
			
		||||
			numArgs++
 | 
			
		||||
		}
 | 
			
		||||
		if numArgs != 1 {
 | 
			
		||||
			return fmt.Errorf("exactly 1 priority argument is required, numArgs: %v, priority %v", numArgs, priority)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@@ -1,260 +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 plugins
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/google/go-cmp/cmp"
 | 
			
		||||
	"k8s.io/api/core/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/util/sets"
 | 
			
		||||
	"k8s.io/apiserver/pkg/util/feature"
 | 
			
		||||
	"k8s.io/component-base/featuregate"
 | 
			
		||||
	featuregatetesting "k8s.io/component-base/featuregate/testing"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/features"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/imagelocality"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodepreferavoidpods"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeunschedulable"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/podtopologyspread"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/selectorspread"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/scheduler/framework/plugins/tainttoleration"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestRegisterConfigProducers(t *testing.T) {
 | 
			
		||||
	registry := NewLegacyRegistry()
 | 
			
		||||
	testPredicateName1 := "testPredicate1"
 | 
			
		||||
	testFilterName1 := "testFilter1"
 | 
			
		||||
	registry.registerPredicateConfigProducer(testPredicateName1,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, testFilterName1, nil)
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
	testPredicateName2 := "testPredicate2"
 | 
			
		||||
	testFilterName2 := "testFilter2"
 | 
			
		||||
	registry.registerPredicateConfigProducer(testPredicateName2,
 | 
			
		||||
		func(_ ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Filter = appendToPluginSet(plugins.Filter, testFilterName2, nil)
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
	testPriorityName1 := "testPriority1"
 | 
			
		||||
	testScoreName1 := "testScore1"
 | 
			
		||||
	registry.registerPriorityConfigProducer(testPriorityName1,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, testScoreName1, &args.Weight)
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
	testPriorityName2 := "testPriority2"
 | 
			
		||||
	testScoreName2 := "testScore2"
 | 
			
		||||
	registry.registerPriorityConfigProducer(testPriorityName2,
 | 
			
		||||
		func(args ConfigProducerArgs, plugins *config.Plugins, _ *[]config.PluginConfig) {
 | 
			
		||||
			plugins.Score = appendToPluginSet(plugins.Score, testScoreName2, &args.Weight)
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
	args := ConfigProducerArgs{Weight: 1}
 | 
			
		||||
	var gotPlugins config.Plugins
 | 
			
		||||
	gotPlugins, _, err := registry.AppendPredicateConfigs(sets.NewString(testPredicateName1, testPredicateName2), &args, gotPlugins, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("producing predicate framework configs: %v.", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	priorities := map[string]int64{
 | 
			
		||||
		testPriorityName1: 1,
 | 
			
		||||
		testPriorityName2: 1,
 | 
			
		||||
	}
 | 
			
		||||
	gotPlugins, _, err = registry.AppendPriorityConfigs(priorities, &args, gotPlugins, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("producing priority framework configs: %v.", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	wantPlugins := config.Plugins{
 | 
			
		||||
		Filter: config.PluginSet{
 | 
			
		||||
			Enabled: []config.Plugin{
 | 
			
		||||
				{Name: nodeunschedulable.Name},
 | 
			
		||||
				{Name: tainttoleration.Name},
 | 
			
		||||
				{Name: testFilterName1},
 | 
			
		||||
				{Name: testFilterName2},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		Score: config.PluginSet{
 | 
			
		||||
			Enabled: []config.Plugin{
 | 
			
		||||
				{Name: testScoreName1, Weight: 1},
 | 
			
		||||
				{Name: testScoreName2, Weight: 1},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if diff := cmp.Diff(wantPlugins, gotPlugins); diff != "" {
 | 
			
		||||
		t.Errorf("unexpected plugin configuration (-want, +got): %s", diff)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestAppendPriorityConfigs(t *testing.T) {
 | 
			
		||||
	cases := []struct {
 | 
			
		||||
		name             string
 | 
			
		||||
		features         map[featuregate.Feature]bool
 | 
			
		||||
		keys             map[string]int64
 | 
			
		||||
		args             ConfigProducerArgs
 | 
			
		||||
		wantPlugins      config.Plugins
 | 
			
		||||
		wantPluginConfig []config.PluginConfig
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			name: "default priorities",
 | 
			
		||||
			wantPlugins: config.Plugins{
 | 
			
		||||
				PreScore: config.PluginSet{
 | 
			
		||||
					Enabled: []config.Plugin{
 | 
			
		||||
						{Name: podtopologyspread.Name},
 | 
			
		||||
						{Name: interpodaffinity.Name},
 | 
			
		||||
						{Name: nodeaffinity.Name},
 | 
			
		||||
						{Name: tainttoleration.Name},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Score: config.PluginSet{
 | 
			
		||||
					Enabled: []config.Plugin{
 | 
			
		||||
						{Name: noderesources.BalancedAllocationName, Weight: 1},
 | 
			
		||||
						{Name: podtopologyspread.Name, Weight: 2},
 | 
			
		||||
						{Name: imagelocality.Name, Weight: 1},
 | 
			
		||||
						{Name: interpodaffinity.Name, Weight: 1},
 | 
			
		||||
						{Name: noderesources.LeastAllocatedName, Weight: 1},
 | 
			
		||||
						{Name: nodeaffinity.Name, Weight: 1},
 | 
			
		||||
						{Name: nodepreferavoidpods.Name, Weight: 10000},
 | 
			
		||||
						{Name: tainttoleration.Name, Weight: 1},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantPluginConfig: []config.PluginConfig{
 | 
			
		||||
				{
 | 
			
		||||
					Name: podtopologyspread.Name,
 | 
			
		||||
					Args: &config.PodTopologySpreadArgs{
 | 
			
		||||
						DefaultingType: config.SystemDefaulting,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name: noderesources.LeastAllocatedName,
 | 
			
		||||
					Args: &config.NodeResourcesLeastAllocatedArgs{
 | 
			
		||||
						Resources: []config.ResourceSpec{
 | 
			
		||||
							{Name: string(v1.ResourceCPU), Weight: 1},
 | 
			
		||||
							{Name: string(v1.ResourceMemory), Weight: 1},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "DefaultPodTopologySpread enabled, SelectorSpreadPriority only",
 | 
			
		||||
			keys: map[string]int64{
 | 
			
		||||
				SelectorSpreadPriority: 3,
 | 
			
		||||
			},
 | 
			
		||||
			wantPlugins: config.Plugins{
 | 
			
		||||
				PreScore: config.PluginSet{
 | 
			
		||||
					Enabled: []config.Plugin{
 | 
			
		||||
						{Name: podtopologyspread.Name},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Score: config.PluginSet{
 | 
			
		||||
					Enabled: []config.Plugin{
 | 
			
		||||
						{Name: podtopologyspread.Name, Weight: 3},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantPluginConfig: []config.PluginConfig{
 | 
			
		||||
				{
 | 
			
		||||
					Name: podtopologyspread.Name,
 | 
			
		||||
					Args: &config.PodTopologySpreadArgs{
 | 
			
		||||
						DefaultingType: config.SystemDefaulting,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "DefaultPodTopologySpread enabled, EvenPodsSpreadPriority only",
 | 
			
		||||
			keys: map[string]int64{
 | 
			
		||||
				EvenPodsSpreadPriority: 4,
 | 
			
		||||
			},
 | 
			
		||||
			wantPlugins: config.Plugins{
 | 
			
		||||
				PreScore: config.PluginSet{
 | 
			
		||||
					Enabled: []config.Plugin{
 | 
			
		||||
						{Name: podtopologyspread.Name},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Score: config.PluginSet{
 | 
			
		||||
					Enabled: []config.Plugin{
 | 
			
		||||
						{Name: podtopologyspread.Name, Weight: 4},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantPluginConfig: []config.PluginConfig{
 | 
			
		||||
				{
 | 
			
		||||
					Name: podtopologyspread.Name,
 | 
			
		||||
					Args: &config.PodTopologySpreadArgs{
 | 
			
		||||
						DefaultingType: config.ListDefaulting,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "DefaultPodTopologySpread disabled, SelectorSpreadPriority+EvenPodsSpreadPriority",
 | 
			
		||||
			features: map[featuregate.Feature]bool{
 | 
			
		||||
				features.DefaultPodTopologySpread: false,
 | 
			
		||||
			},
 | 
			
		||||
			keys: map[string]int64{
 | 
			
		||||
				SelectorSpreadPriority: 1,
 | 
			
		||||
				EvenPodsSpreadPriority: 2,
 | 
			
		||||
			},
 | 
			
		||||
			wantPlugins: config.Plugins{
 | 
			
		||||
				PreScore: config.PluginSet{
 | 
			
		||||
					Enabled: []config.Plugin{
 | 
			
		||||
						{Name: podtopologyspread.Name},
 | 
			
		||||
						{Name: selectorspread.Name},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Score: config.PluginSet{
 | 
			
		||||
					Enabled: []config.Plugin{
 | 
			
		||||
						{Name: podtopologyspread.Name, Weight: 2},
 | 
			
		||||
						{Name: selectorspread.Name, Weight: 1},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	for _, tc := range cases {
 | 
			
		||||
		t.Run(tc.name, func(t *testing.T) {
 | 
			
		||||
			for k, v := range tc.features {
 | 
			
		||||
				defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, k, v)()
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			r := NewLegacyRegistry()
 | 
			
		||||
			keys := tc.keys
 | 
			
		||||
			if keys == nil {
 | 
			
		||||
				keys = r.DefaultPriorities
 | 
			
		||||
			}
 | 
			
		||||
			plugins, pluginConfig, err := r.AppendPriorityConfigs(keys, &tc.args, config.Plugins{}, nil)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				t.Fatalf("Appending Priority Configs: %v", err)
 | 
			
		||||
			}
 | 
			
		||||
			if diff := cmp.Diff(tc.wantPlugins, plugins); diff != "" {
 | 
			
		||||
				t.Errorf("Unexpected Plugin (-want,+got):\n%s", diff)
 | 
			
		||||
			}
 | 
			
		||||
			if diff := cmp.Diff(tc.wantPluginConfig, pluginConfig); diff != "" {
 | 
			
		||||
				t.Errorf("Unexpected PluginConfig (-want,+got):\n%s", diff)
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,21 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2016 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 v1 // import "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
@@ -1,45 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2014 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 v1
 | 
			
		||||
 | 
			
		||||
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: "v1"}
 | 
			
		||||
 | 
			
		||||
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,
 | 
			
		||||
		&Policy{},
 | 
			
		||||
	)
 | 
			
		||||
	// also register into the v1 group for API backward compatibility
 | 
			
		||||
	scheme.AddKnownTypes(schema.GroupVersion{Group: "", Version: "v1"}, &Policy{})
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@@ -1,223 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2014 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 v1
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	gojson "encoding/json"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 | 
			
		||||
 | 
			
		||||
// Policy describes a struct for a policy resource used in api.
 | 
			
		||||
type Policy struct {
 | 
			
		||||
	metav1.TypeMeta `json:",inline"`
 | 
			
		||||
	// Holds the information to configure the fit predicate functions
 | 
			
		||||
	Predicates []PredicatePolicy `json:"predicates"`
 | 
			
		||||
	// Holds the information to configure the priority functions
 | 
			
		||||
	Priorities []PriorityPolicy `json:"priorities"`
 | 
			
		||||
	// Holds the information to communicate with the extender(s)
 | 
			
		||||
	Extenders []LegacyExtender `json:"extenders"`
 | 
			
		||||
	// 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 1-100.
 | 
			
		||||
	HardPodAffinitySymmetricWeight int32 `json:"hardPodAffinitySymmetricWeight"`
 | 
			
		||||
 | 
			
		||||
	// When AlwaysCheckAllPredicates is set to true, scheduler checks all
 | 
			
		||||
	// the configured predicates even after one or more of them fails.
 | 
			
		||||
	// When the flag is set to false, scheduler skips checking the rest
 | 
			
		||||
	// of the predicates after it finds one predicate that failed.
 | 
			
		||||
	AlwaysCheckAllPredicates bool `json:"alwaysCheckAllPredicates"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PredicatePolicy describes a struct of a predicate policy.
 | 
			
		||||
type PredicatePolicy struct {
 | 
			
		||||
	// Identifier of the predicate policy
 | 
			
		||||
	// For a custom predicate, the name can be user-defined
 | 
			
		||||
	// For the Kubernetes provided predicates, the name is the identifier of the pre-defined predicate
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
	// Holds the parameters to configure the given predicate
 | 
			
		||||
	Argument *PredicateArgument `json:"argument"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PriorityPolicy describes a struct of a priority policy.
 | 
			
		||||
type PriorityPolicy struct {
 | 
			
		||||
	// Identifier of the priority policy
 | 
			
		||||
	// For a custom priority, the name can be user-defined
 | 
			
		||||
	// For the Kubernetes provided priority functions, the name is the identifier of the pre-defined priority function
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
	// The numeric multiplier for the node scores that the priority function generates
 | 
			
		||||
	// The weight should be non-zero and can be a positive or a negative integer
 | 
			
		||||
	Weight int64 `json:"weight"`
 | 
			
		||||
	// Holds the parameters to configure the given priority function
 | 
			
		||||
	Argument *PriorityArgument `json:"argument"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PredicateArgument represents the arguments to configure predicate functions in scheduler policy configuration.
 | 
			
		||||
// Only one of its members may be specified
 | 
			
		||||
type PredicateArgument struct {
 | 
			
		||||
	// The predicate that checks whether a particular node has a certain label
 | 
			
		||||
	// defined or not, regardless of value
 | 
			
		||||
	LabelsPresence *LabelsPresence `json:"labelsPresence"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PriorityArgument represents the arguments to configure priority functions in scheduler policy configuration.
 | 
			
		||||
// Only one of its members may be specified
 | 
			
		||||
type PriorityArgument struct {
 | 
			
		||||
	// The priority function that checks whether a particular node has a certain label
 | 
			
		||||
	// defined or not, regardless of value
 | 
			
		||||
	LabelPreference *LabelPreference `json:"labelPreference"`
 | 
			
		||||
	// The RequestedToCapacityRatio priority function is parametrized with function shape.
 | 
			
		||||
	RequestedToCapacityRatioArguments *RequestedToCapacityRatioArguments `json:"requestedToCapacityRatioArguments"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LabelsPresence holds the parameters that are used to configure the corresponding predicate in scheduler policy configuration.
 | 
			
		||||
type LabelsPresence struct {
 | 
			
		||||
	// The list of labels that identify node "groups"
 | 
			
		||||
	// All of the labels should be either present (or absent) for the node to be considered a fit for hosting the pod
 | 
			
		||||
	Labels []string `json:"labels"`
 | 
			
		||||
	// The boolean flag that indicates whether the labels should be present or absent from the node
 | 
			
		||||
	Presence bool `json:"presence"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LabelPreference holds the parameters that are used to configure the corresponding priority function
 | 
			
		||||
type LabelPreference struct {
 | 
			
		||||
	// Used to identify node "groups"
 | 
			
		||||
	Label string `json:"label"`
 | 
			
		||||
	// This is a boolean flag
 | 
			
		||||
	// If true, higher priority is given to nodes that have the label
 | 
			
		||||
	// If false, higher priority is given to nodes that do not have the label
 | 
			
		||||
	Presence bool `json:"presence"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RequestedToCapacityRatioArguments holds arguments specific to RequestedToCapacityRatio priority function.
 | 
			
		||||
type RequestedToCapacityRatioArguments struct {
 | 
			
		||||
	// Array of point defining priority function shape.
 | 
			
		||||
	Shape     []UtilizationShapePoint `json:"shape"`
 | 
			
		||||
	Resources []ResourceSpec          `json:"resources,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UtilizationShapePoint represents single point of priority function shape.
 | 
			
		||||
type UtilizationShapePoint struct {
 | 
			
		||||
	// Utilization (x axis). Valid values are 0 to 100. Fully utilized node maps to 100.
 | 
			
		||||
	Utilization int32 `json:"utilization"`
 | 
			
		||||
	// Score assigned to given utilization (y axis). Valid values are 0 to 10.
 | 
			
		||||
	Score int32 `json:"score"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ResourceSpec represents single resource and weight for bin packing of priority RequestedToCapacityRatioArguments.
 | 
			
		||||
type ResourceSpec struct {
 | 
			
		||||
	// Name of the resource to be managed by RequestedToCapacityRatio function.
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
	// Weight of the resource.
 | 
			
		||||
	Weight int64 `json:"weight,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExtenderManagedResource describes the arguments of extended resources
 | 
			
		||||
// managed by an extender.
 | 
			
		||||
type ExtenderManagedResource struct {
 | 
			
		||||
	// Name is the extended resource name.
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
	// IgnoredByScheduler indicates whether kube-scheduler should ignore this
 | 
			
		||||
	// resource when applying predicates.
 | 
			
		||||
	IgnoredByScheduler bool `json:"ignoredByScheduler,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExtenderTLSConfig contains settings to enable TLS with extender
 | 
			
		||||
type ExtenderTLSConfig struct {
 | 
			
		||||
	// Server should be accessed without verifying the TLS certificate. For testing only.
 | 
			
		||||
	Insecure bool `json:"insecure,omitempty"`
 | 
			
		||||
	// ServerName is passed to the server for SNI and is used in the client to check server
 | 
			
		||||
	// certificates against. If ServerName is empty, the hostname used to contact the
 | 
			
		||||
	// server is used.
 | 
			
		||||
	ServerName string `json:"serverName,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// Server requires TLS client certificate authentication
 | 
			
		||||
	CertFile string `json:"certFile,omitempty"`
 | 
			
		||||
	// Server requires TLS client certificate authentication
 | 
			
		||||
	KeyFile string `json:"keyFile,omitempty"`
 | 
			
		||||
	// Trusted root certificates for server
 | 
			
		||||
	CAFile string `json:"caFile,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// CertData holds PEM-encoded bytes (typically read from a client certificate file).
 | 
			
		||||
	// CertData takes precedence over CertFile
 | 
			
		||||
	CertData []byte `json:"certData,omitempty"`
 | 
			
		||||
	// KeyData holds PEM-encoded bytes (typically read from a client certificate key file).
 | 
			
		||||
	// KeyData takes precedence over KeyFile
 | 
			
		||||
	KeyData []byte `json:"keyData,omitempty"`
 | 
			
		||||
	// CAData holds PEM-encoded bytes (typically read from a root certificates bundle).
 | 
			
		||||
	// CAData takes precedence over CAFile
 | 
			
		||||
	CAData []byte `json:"caData,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LegacyExtender holds the parameters used to communicate with the extender. If a verb is unspecified/empty,
 | 
			
		||||
// it is assumed that the extender chose not to provide that extension.
 | 
			
		||||
type LegacyExtender struct {
 | 
			
		||||
	// URLPrefix at which the extender is available
 | 
			
		||||
	URLPrefix string `json:"urlPrefix"`
 | 
			
		||||
	// Verb for the filter call, empty if not supported. This verb is appended to the URLPrefix when issuing the filter call to extender.
 | 
			
		||||
	FilterVerb string `json:"filterVerb,omitempty"`
 | 
			
		||||
	// Verb for the preempt call, empty if not supported. This verb is appended to the URLPrefix when issuing the preempt call to extender.
 | 
			
		||||
	PreemptVerb string `json:"preemptVerb,omitempty"`
 | 
			
		||||
	// Verb for the prioritize call, empty if not supported. This verb is appended to the URLPrefix when issuing the prioritize call to extender.
 | 
			
		||||
	PrioritizeVerb string `json:"prioritizeVerb,omitempty"`
 | 
			
		||||
	// The numeric multiplier for the node scores that the prioritize call generates.
 | 
			
		||||
	// The weight should be a positive integer
 | 
			
		||||
	Weight int64 `json:"weight,omitempty"`
 | 
			
		||||
	// Verb for the bind call, empty if not supported. This verb is appended to the URLPrefix when issuing the bind call to extender.
 | 
			
		||||
	// If this method is implemented by the extender, it is the extender's responsibility to bind the pod to apiserver. Only one extender
 | 
			
		||||
	// can implement this function.
 | 
			
		||||
	BindVerb string `json:"bindVerb,omitempty"`
 | 
			
		||||
	// EnableHTTPS specifies whether https should be used to communicate with the extender
 | 
			
		||||
	EnableHTTPS bool `json:"enableHttps,omitempty"`
 | 
			
		||||
	// TLSConfig specifies the transport layer security config
 | 
			
		||||
	TLSConfig *ExtenderTLSConfig `json:"tlsConfig,omitempty"`
 | 
			
		||||
	// HTTPTimeout specifies the timeout duration for a call to the extender. Filter timeout fails the scheduling of the pod. Prioritize
 | 
			
		||||
	// timeout is ignored, k8s/other extenders priorities are used to select the node.
 | 
			
		||||
	HTTPTimeout time.Duration `json:"httpTimeout,omitempty"`
 | 
			
		||||
	// NodeCacheCapable specifies that the extender is capable of caching node information,
 | 
			
		||||
	// so the scheduler should only send minimal information about the eligible nodes
 | 
			
		||||
	// assuming that the extender already cached full details of all nodes in the cluster
 | 
			
		||||
	NodeCacheCapable bool `json:"nodeCacheCapable,omitempty"`
 | 
			
		||||
	// ManagedResources is a list of extended resources that are managed by
 | 
			
		||||
	// this extender.
 | 
			
		||||
	// - A pod will be sent to the extender on the Filter, Prioritize and Bind
 | 
			
		||||
	//   (if the extender is the binder) phases iff the pod requests at least
 | 
			
		||||
	//   one of the extended resources in this list. If empty or unspecified,
 | 
			
		||||
	//   all pods will be sent to this extender.
 | 
			
		||||
	// - If IgnoredByScheduler is set to true for a resource, kube-scheduler
 | 
			
		||||
	//   will skip checking the resource in predicates.
 | 
			
		||||
	// +optional
 | 
			
		||||
	ManagedResources []ExtenderManagedResource `json:"managedResources,omitempty"`
 | 
			
		||||
	// Ignorable specifies if the extender is ignorable, i.e. scheduling should not
 | 
			
		||||
	// fail when the extender returns an error or is not reachable.
 | 
			
		||||
	Ignorable bool `json:"ignorable,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// caseInsensitiveExtender is a type alias which lets us use the stdlib case-insensitive decoding
 | 
			
		||||
// to preserve compatibility with incorrectly specified scheduler config fields:
 | 
			
		||||
// * BindVerb, which originally did not specify a json tag, and required upper-case serialization in 1.7
 | 
			
		||||
// * TLSConfig, which uses a struct not intended for serialization, and does not include any json tags
 | 
			
		||||
type caseInsensitiveExtender *LegacyExtender
 | 
			
		||||
 | 
			
		||||
// UnmarshalJSON implements the json.Unmarshaller interface.
 | 
			
		||||
// This preserves compatibility with incorrect case-insensitive configuration fields.
 | 
			
		||||
func (t *LegacyExtender) UnmarshalJSON(b []byte) error {
 | 
			
		||||
	return gojson.Unmarshal(b, caseInsensitiveExtender(t))
 | 
			
		||||
}
 | 
			
		||||
@@ -1,329 +0,0 @@
 | 
			
		||||
//go:build !ignore_autogenerated
 | 
			
		||||
// +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 v1
 | 
			
		||||
 | 
			
		||||
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 *ExtenderManagedResource) DeepCopyInto(out *ExtenderManagedResource) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtenderManagedResource.
 | 
			
		||||
func (in *ExtenderManagedResource) DeepCopy() *ExtenderManagedResource {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(ExtenderManagedResource)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *ExtenderTLSConfig) DeepCopyInto(out *ExtenderTLSConfig) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.CertData != nil {
 | 
			
		||||
		in, out := &in.CertData, &out.CertData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	if in.KeyData != nil {
 | 
			
		||||
		in, out := &in.KeyData, &out.KeyData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	if in.CAData != nil {
 | 
			
		||||
		in, out := &in.CAData, &out.CAData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtenderTLSConfig.
 | 
			
		||||
func (in *ExtenderTLSConfig) DeepCopy() *ExtenderTLSConfig {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(ExtenderTLSConfig)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *LabelPreference) DeepCopyInto(out *LabelPreference) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelPreference.
 | 
			
		||||
func (in *LabelPreference) DeepCopy() *LabelPreference {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(LabelPreference)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *LabelsPresence) DeepCopyInto(out *LabelsPresence) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.Labels != nil {
 | 
			
		||||
		in, out := &in.Labels, &out.Labels
 | 
			
		||||
		*out = make([]string, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelsPresence.
 | 
			
		||||
func (in *LabelsPresence) DeepCopy() *LabelsPresence {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(LabelsPresence)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *LegacyExtender) DeepCopyInto(out *LegacyExtender) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.TLSConfig != nil {
 | 
			
		||||
		in, out := &in.TLSConfig, &out.TLSConfig
 | 
			
		||||
		*out = new(ExtenderTLSConfig)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	if in.ManagedResources != nil {
 | 
			
		||||
		in, out := &in.ManagedResources, &out.ManagedResources
 | 
			
		||||
		*out = make([]ExtenderManagedResource, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LegacyExtender.
 | 
			
		||||
func (in *LegacyExtender) DeepCopy() *LegacyExtender {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(LegacyExtender)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *Policy) DeepCopyInto(out *Policy) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	out.TypeMeta = in.TypeMeta
 | 
			
		||||
	if in.Predicates != nil {
 | 
			
		||||
		in, out := &in.Predicates, &out.Predicates
 | 
			
		||||
		*out = make([]PredicatePolicy, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			(*in)[i].DeepCopyInto(&(*out)[i])
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if in.Priorities != nil {
 | 
			
		||||
		in, out := &in.Priorities, &out.Priorities
 | 
			
		||||
		*out = make([]PriorityPolicy, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			(*in)[i].DeepCopyInto(&(*out)[i])
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if in.Extenders != nil {
 | 
			
		||||
		in, out := &in.Extenders, &out.Extenders
 | 
			
		||||
		*out = make([]LegacyExtender, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			(*in)[i].DeepCopyInto(&(*out)[i])
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy.
 | 
			
		||||
func (in *Policy) DeepCopy() *Policy {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(Policy)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
 | 
			
		||||
func (in *Policy) 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 *PredicateArgument) DeepCopyInto(out *PredicateArgument) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.LabelsPresence != nil {
 | 
			
		||||
		in, out := &in.LabelsPresence, &out.LabelsPresence
 | 
			
		||||
		*out = new(LabelsPresence)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PredicateArgument.
 | 
			
		||||
func (in *PredicateArgument) DeepCopy() *PredicateArgument {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(PredicateArgument)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *PredicatePolicy) DeepCopyInto(out *PredicatePolicy) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.Argument != nil {
 | 
			
		||||
		in, out := &in.Argument, &out.Argument
 | 
			
		||||
		*out = new(PredicateArgument)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PredicatePolicy.
 | 
			
		||||
func (in *PredicatePolicy) DeepCopy() *PredicatePolicy {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(PredicatePolicy)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *PriorityArgument) DeepCopyInto(out *PriorityArgument) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.LabelPreference != nil {
 | 
			
		||||
		in, out := &in.LabelPreference, &out.LabelPreference
 | 
			
		||||
		*out = new(LabelPreference)
 | 
			
		||||
		**out = **in
 | 
			
		||||
	}
 | 
			
		||||
	if in.RequestedToCapacityRatioArguments != nil {
 | 
			
		||||
		in, out := &in.RequestedToCapacityRatioArguments, &out.RequestedToCapacityRatioArguments
 | 
			
		||||
		*out = new(RequestedToCapacityRatioArguments)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityArgument.
 | 
			
		||||
func (in *PriorityArgument) DeepCopy() *PriorityArgument {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(PriorityArgument)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *PriorityPolicy) DeepCopyInto(out *PriorityPolicy) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.Argument != nil {
 | 
			
		||||
		in, out := &in.Argument, &out.Argument
 | 
			
		||||
		*out = new(PriorityArgument)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityPolicy.
 | 
			
		||||
func (in *PriorityPolicy) DeepCopy() *PriorityPolicy {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(PriorityPolicy)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *RequestedToCapacityRatioArguments) DeepCopyInto(out *RequestedToCapacityRatioArguments) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.Shape != nil {
 | 
			
		||||
		in, out := &in.Shape, &out.Shape
 | 
			
		||||
		*out = make([]UtilizationShapePoint, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	if in.Resources != nil {
 | 
			
		||||
		in, out := &in.Resources, &out.Resources
 | 
			
		||||
		*out = make([]ResourceSpec, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestedToCapacityRatioArguments.
 | 
			
		||||
func (in *RequestedToCapacityRatioArguments) DeepCopy() *RequestedToCapacityRatioArguments {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(RequestedToCapacityRatioArguments)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *ResourceSpec) DeepCopyInto(out *ResourceSpec) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSpec.
 | 
			
		||||
func (in *ResourceSpec) DeepCopy() *ResourceSpec {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(ResourceSpec)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *UtilizationShapePoint) DeepCopyInto(out *UtilizationShapePoint) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UtilizationShapePoint.
 | 
			
		||||
func (in *UtilizationShapePoint) DeepCopy() *UtilizationShapePoint {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(UtilizationShapePoint)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
@@ -23,7 +23,6 @@ import (
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
 | 
			
		||||
	v1 "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
	"sigs.k8s.io/yaml"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -287,7 +286,7 @@ type Extender struct {
 | 
			
		||||
	// EnableHTTPS specifies whether https should be used to communicate with the extender
 | 
			
		||||
	EnableHTTPS bool `json:"enableHTTPS,omitempty"`
 | 
			
		||||
	// TLSConfig specifies the transport layer security config
 | 
			
		||||
	TLSConfig *v1.ExtenderTLSConfig `json:"tlsConfig,omitempty"`
 | 
			
		||||
	TLSConfig *ExtenderTLSConfig `json:"tlsConfig,omitempty"`
 | 
			
		||||
	// HTTPTimeout specifies the timeout duration for a call to the extender. Filter timeout fails the scheduling of the pod. Prioritize
 | 
			
		||||
	// timeout is ignored, k8s/other extenders priorities are used to select the node.
 | 
			
		||||
	HTTPTimeout metav1.Duration `json:"httpTimeout,omitempty"`
 | 
			
		||||
@@ -305,8 +304,45 @@ type Extender struct {
 | 
			
		||||
	//   will skip checking the resource in predicates.
 | 
			
		||||
	// +optional
 | 
			
		||||
	// +listType=atomic
 | 
			
		||||
	ManagedResources []v1.ExtenderManagedResource `json:"managedResources,omitempty"`
 | 
			
		||||
	ManagedResources []ExtenderManagedResource `json:"managedResources,omitempty"`
 | 
			
		||||
	// Ignorable specifies if the extender is ignorable, i.e. scheduling should not
 | 
			
		||||
	// fail when the extender returns an error or is not reachable.
 | 
			
		||||
	Ignorable bool `json:"ignorable,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExtenderManagedResource describes the arguments of extended resources
 | 
			
		||||
// managed by an extender.
 | 
			
		||||
type ExtenderManagedResource struct {
 | 
			
		||||
	// Name is the extended resource name.
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
	// IgnoredByScheduler indicates whether kube-scheduler should ignore this
 | 
			
		||||
	// resource when applying predicates.
 | 
			
		||||
	IgnoredByScheduler bool `json:"ignoredByScheduler,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExtenderTLSConfig contains settings to enable TLS with extender
 | 
			
		||||
type ExtenderTLSConfig struct {
 | 
			
		||||
	// Server should be accessed without verifying the TLS certificate. For testing only.
 | 
			
		||||
	Insecure bool `json:"insecure,omitempty"`
 | 
			
		||||
	// ServerName is passed to the server for SNI and is used in the client to check server
 | 
			
		||||
	// certificates against. If ServerName is empty, the hostname used to contact the
 | 
			
		||||
	// server is used.
 | 
			
		||||
	ServerName string `json:"serverName,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// Server requires TLS client certificate authentication
 | 
			
		||||
	CertFile string `json:"certFile,omitempty"`
 | 
			
		||||
	// Server requires TLS client certificate authentication
 | 
			
		||||
	KeyFile string `json:"keyFile,omitempty"`
 | 
			
		||||
	// Trusted root certificates for server
 | 
			
		||||
	CAFile string `json:"caFile,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// CertData holds PEM-encoded bytes (typically read from a client certificate file).
 | 
			
		||||
	// CertData takes precedence over CertFile
 | 
			
		||||
	CertData []byte `json:"certData,omitempty"`
 | 
			
		||||
	// KeyData holds PEM-encoded bytes (typically read from a client certificate key file).
 | 
			
		||||
	// KeyData takes precedence over KeyFile
 | 
			
		||||
	KeyData []byte `json:"keyData,omitempty"`
 | 
			
		||||
	// CAData holds PEM-encoded bytes (typically read from a root certificates bundle).
 | 
			
		||||
	// CAData takes precedence over CAFile
 | 
			
		||||
	CAData []byte `json:"caData,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,9 +22,8 @@ limitations under the License.
 | 
			
		||||
package v1beta2
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	corev1 "k8s.io/api/core/v1"
 | 
			
		||||
	v1 "k8s.io/api/core/v1"
 | 
			
		||||
	runtime "k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	v1 "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
@@ -67,13 +66,13 @@ func (in *Extender) DeepCopyInto(out *Extender) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.TLSConfig != nil {
 | 
			
		||||
		in, out := &in.TLSConfig, &out.TLSConfig
 | 
			
		||||
		*out = new(v1.ExtenderTLSConfig)
 | 
			
		||||
		*out = new(ExtenderTLSConfig)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	out.HTTPTimeout = in.HTTPTimeout
 | 
			
		||||
	if in.ManagedResources != nil {
 | 
			
		||||
		in, out := &in.ManagedResources, &out.ManagedResources
 | 
			
		||||
		*out = make([]v1.ExtenderManagedResource, len(*in))
 | 
			
		||||
		*out = make([]ExtenderManagedResource, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
@@ -89,6 +88,53 @@ func (in *Extender) DeepCopy() *Extender {
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *ExtenderManagedResource) DeepCopyInto(out *ExtenderManagedResource) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtenderManagedResource.
 | 
			
		||||
func (in *ExtenderManagedResource) DeepCopy() *ExtenderManagedResource {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(ExtenderManagedResource)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *ExtenderTLSConfig) DeepCopyInto(out *ExtenderTLSConfig) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.CertData != nil {
 | 
			
		||||
		in, out := &in.CertData, &out.CertData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	if in.KeyData != nil {
 | 
			
		||||
		in, out := &in.KeyData, &out.KeyData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	if in.CAData != nil {
 | 
			
		||||
		in, out := &in.CAData, &out.CAData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtenderTLSConfig.
 | 
			
		||||
func (in *ExtenderTLSConfig) DeepCopy() *ExtenderTLSConfig {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(ExtenderTLSConfig)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *InterPodAffinityArgs) DeepCopyInto(out *InterPodAffinityArgs) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
@@ -230,7 +276,7 @@ func (in *NodeAffinityArgs) DeepCopyInto(out *NodeAffinityArgs) {
 | 
			
		||||
	out.TypeMeta = in.TypeMeta
 | 
			
		||||
	if in.AddedAffinity != nil {
 | 
			
		||||
		in, out := &in.AddedAffinity, &out.AddedAffinity
 | 
			
		||||
		*out = new(corev1.NodeAffinity)
 | 
			
		||||
		*out = new(v1.NodeAffinity)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
@@ -425,7 +471,7 @@ func (in *PodTopologySpreadArgs) DeepCopyInto(out *PodTopologySpreadArgs) {
 | 
			
		||||
	out.TypeMeta = in.TypeMeta
 | 
			
		||||
	if in.DefaultConstraints != nil {
 | 
			
		||||
		in, out := &in.DefaultConstraints, &out.DefaultConstraints
 | 
			
		||||
		*out = make([]corev1.TopologySpreadConstraint, len(*in))
 | 
			
		||||
		*out = make([]v1.TopologySpreadConstraint, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			(*in)[i].DeepCopyInto(&(*out)[i])
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,6 @@ import (
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
 | 
			
		||||
	v1 "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
	"sigs.k8s.io/yaml"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -280,7 +279,7 @@ type Extender struct {
 | 
			
		||||
	// EnableHTTPS specifies whether https should be used to communicate with the extender
 | 
			
		||||
	EnableHTTPS bool `json:"enableHTTPS,omitempty"`
 | 
			
		||||
	// TLSConfig specifies the transport layer security config
 | 
			
		||||
	TLSConfig *v1.ExtenderTLSConfig `json:"tlsConfig,omitempty"`
 | 
			
		||||
	TLSConfig *ExtenderTLSConfig `json:"tlsConfig,omitempty"`
 | 
			
		||||
	// HTTPTimeout specifies the timeout duration for a call to the extender. Filter timeout fails the scheduling of the pod. Prioritize
 | 
			
		||||
	// timeout is ignored, k8s/other extenders priorities are used to select the node.
 | 
			
		||||
	HTTPTimeout metav1.Duration `json:"httpTimeout,omitempty"`
 | 
			
		||||
@@ -298,8 +297,45 @@ type Extender struct {
 | 
			
		||||
	//   will skip checking the resource in predicates.
 | 
			
		||||
	// +optional
 | 
			
		||||
	// +listType=atomic
 | 
			
		||||
	ManagedResources []v1.ExtenderManagedResource `json:"managedResources,omitempty"`
 | 
			
		||||
	ManagedResources []ExtenderManagedResource `json:"managedResources,omitempty"`
 | 
			
		||||
	// Ignorable specifies if the extender is ignorable, i.e. scheduling should not
 | 
			
		||||
	// fail when the extender returns an error or is not reachable.
 | 
			
		||||
	Ignorable bool `json:"ignorable,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExtenderManagedResource describes the arguments of extended resources
 | 
			
		||||
// managed by an extender.
 | 
			
		||||
type ExtenderManagedResource struct {
 | 
			
		||||
	// Name is the extended resource name.
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
	// IgnoredByScheduler indicates whether kube-scheduler should ignore this
 | 
			
		||||
	// resource when applying predicates.
 | 
			
		||||
	IgnoredByScheduler bool `json:"ignoredByScheduler,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExtenderTLSConfig contains settings to enable TLS with extender
 | 
			
		||||
type ExtenderTLSConfig struct {
 | 
			
		||||
	// Server should be accessed without verifying the TLS certificate. For testing only.
 | 
			
		||||
	Insecure bool `json:"insecure,omitempty"`
 | 
			
		||||
	// ServerName is passed to the server for SNI and is used in the client to check server
 | 
			
		||||
	// certificates against. If ServerName is empty, the hostname used to contact the
 | 
			
		||||
	// server is used.
 | 
			
		||||
	ServerName string `json:"serverName,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// Server requires TLS client certificate authentication
 | 
			
		||||
	CertFile string `json:"certFile,omitempty"`
 | 
			
		||||
	// Server requires TLS client certificate authentication
 | 
			
		||||
	KeyFile string `json:"keyFile,omitempty"`
 | 
			
		||||
	// Trusted root certificates for server
 | 
			
		||||
	CAFile string `json:"caFile,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// CertData holds PEM-encoded bytes (typically read from a client certificate file).
 | 
			
		||||
	// CertData takes precedence over CertFile
 | 
			
		||||
	CertData []byte `json:"certData,omitempty"`
 | 
			
		||||
	// KeyData holds PEM-encoded bytes (typically read from a client certificate key file).
 | 
			
		||||
	// KeyData takes precedence over KeyFile
 | 
			
		||||
	KeyData []byte `json:"keyData,omitempty"`
 | 
			
		||||
	// CAData holds PEM-encoded bytes (typically read from a root certificates bundle).
 | 
			
		||||
	// CAData takes precedence over CAFile
 | 
			
		||||
	CAData []byte `json:"caData,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,9 +22,8 @@ limitations under the License.
 | 
			
		||||
package v1beta3
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	corev1 "k8s.io/api/core/v1"
 | 
			
		||||
	v1 "k8s.io/api/core/v1"
 | 
			
		||||
	runtime "k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	v1 "k8s.io/kube-scheduler/config/v1"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
@@ -67,13 +66,13 @@ func (in *Extender) DeepCopyInto(out *Extender) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.TLSConfig != nil {
 | 
			
		||||
		in, out := &in.TLSConfig, &out.TLSConfig
 | 
			
		||||
		*out = new(v1.ExtenderTLSConfig)
 | 
			
		||||
		*out = new(ExtenderTLSConfig)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	out.HTTPTimeout = in.HTTPTimeout
 | 
			
		||||
	if in.ManagedResources != nil {
 | 
			
		||||
		in, out := &in.ManagedResources, &out.ManagedResources
 | 
			
		||||
		*out = make([]v1.ExtenderManagedResource, len(*in))
 | 
			
		||||
		*out = make([]ExtenderManagedResource, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
@@ -89,6 +88,53 @@ func (in *Extender) DeepCopy() *Extender {
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *ExtenderManagedResource) DeepCopyInto(out *ExtenderManagedResource) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtenderManagedResource.
 | 
			
		||||
func (in *ExtenderManagedResource) DeepCopy() *ExtenderManagedResource {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(ExtenderManagedResource)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *ExtenderTLSConfig) DeepCopyInto(out *ExtenderTLSConfig) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
	if in.CertData != nil {
 | 
			
		||||
		in, out := &in.CertData, &out.CertData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	if in.KeyData != nil {
 | 
			
		||||
		in, out := &in.KeyData, &out.KeyData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	if in.CAData != nil {
 | 
			
		||||
		in, out := &in.CAData, &out.CAData
 | 
			
		||||
		*out = make([]byte, len(*in))
 | 
			
		||||
		copy(*out, *in)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtenderTLSConfig.
 | 
			
		||||
func (in *ExtenderTLSConfig) DeepCopy() *ExtenderTLSConfig {
 | 
			
		||||
	if in == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	out := new(ExtenderTLSConfig)
 | 
			
		||||
	in.DeepCopyInto(out)
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 | 
			
		||||
func (in *InterPodAffinityArgs) DeepCopyInto(out *InterPodAffinityArgs) {
 | 
			
		||||
	*out = *in
 | 
			
		||||
@@ -220,7 +266,7 @@ func (in *NodeAffinityArgs) DeepCopyInto(out *NodeAffinityArgs) {
 | 
			
		||||
	out.TypeMeta = in.TypeMeta
 | 
			
		||||
	if in.AddedAffinity != nil {
 | 
			
		||||
		in, out := &in.AddedAffinity, &out.AddedAffinity
 | 
			
		||||
		*out = new(corev1.NodeAffinity)
 | 
			
		||||
		*out = new(v1.NodeAffinity)
 | 
			
		||||
		(*in).DeepCopyInto(*out)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
@@ -415,7 +461,7 @@ func (in *PodTopologySpreadArgs) DeepCopyInto(out *PodTopologySpreadArgs) {
 | 
			
		||||
	out.TypeMeta = in.TypeMeta
 | 
			
		||||
	if in.DefaultConstraints != nil {
 | 
			
		||||
		in, out := &in.DefaultConstraints, &out.DefaultConstraints
 | 
			
		||||
		*out = make([]corev1.TopologySpreadConstraint, len(*in))
 | 
			
		||||
		*out = make([]v1.TopologySpreadConstraint, len(*in))
 | 
			
		||||
		for i := range *in {
 | 
			
		||||
			(*in)[i].DeepCopyInto(&(*out)[i])
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							@@ -2079,7 +2079,6 @@ k8s.io/kube-openapi/pkg/validation/validate
 | 
			
		||||
k8s.io/kube-proxy/config/v1alpha1
 | 
			
		||||
# k8s.io/kube-scheduler v0.0.0 => ./staging/src/k8s.io/kube-scheduler
 | 
			
		||||
## explicit
 | 
			
		||||
k8s.io/kube-scheduler/config/v1
 | 
			
		||||
k8s.io/kube-scheduler/config/v1beta2
 | 
			
		||||
k8s.io/kube-scheduler/config/v1beta3
 | 
			
		||||
k8s.io/kube-scheduler/extender/v1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user