mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Add versioned counterparts for VolumeBindingArgs
This commit is contained in:
		@@ -78,6 +78,9 @@ profiles:
 | 
			
		||||
      resources:
 | 
			
		||||
      - name: memory
 | 
			
		||||
        weight: 1
 | 
			
		||||
  - name: VolumeBinding
 | 
			
		||||
    args:
 | 
			
		||||
      bindTimeoutSeconds: 300
 | 
			
		||||
`),
 | 
			
		||||
			wantProfiles: []config.KubeSchedulerProfile{
 | 
			
		||||
				{
 | 
			
		||||
@@ -128,6 +131,12 @@ profiles:
 | 
			
		||||
								Resources: []config.ResourceSpec{{Name: "memory", Weight: 1}},
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							Name: "VolumeBinding",
 | 
			
		||||
							Args: &config.VolumeBindingArgs{
 | 
			
		||||
								BindTimeoutSeconds: 300,
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
@@ -255,6 +264,8 @@ profiles:
 | 
			
		||||
    args:
 | 
			
		||||
  - name: NodeResourcesMostAllocated
 | 
			
		||||
    args:
 | 
			
		||||
  - name: VolumeBinding
 | 
			
		||||
    args:
 | 
			
		||||
`),
 | 
			
		||||
			wantProfiles: []config.KubeSchedulerProfile{
 | 
			
		||||
				{
 | 
			
		||||
@@ -283,6 +294,12 @@ profiles:
 | 
			
		||||
								Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							Name: "VolumeBinding",
 | 
			
		||||
							Args: &config.VolumeBindingArgs{
 | 
			
		||||
								BindTimeoutSeconds: 600,
 | 
			
		||||
							},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
@@ -334,6 +351,14 @@ func TestCodecsEncodePluginConfig(t *testing.T) {
 | 
			
		||||
									},
 | 
			
		||||
								},
 | 
			
		||||
							},
 | 
			
		||||
							{
 | 
			
		||||
								Name: "VolumeBinding",
 | 
			
		||||
								Args: runtime.RawExtension{
 | 
			
		||||
									Object: &v1alpha2.VolumeBindingArgs{
 | 
			
		||||
										BindTimeoutSeconds: pointer.Int64Ptr(300),
 | 
			
		||||
									},
 | 
			
		||||
								},
 | 
			
		||||
							},
 | 
			
		||||
							{
 | 
			
		||||
								Name: "RequestedToCapacityRatio",
 | 
			
		||||
								Args: runtime.RawExtension{
 | 
			
		||||
@@ -390,6 +415,11 @@ profiles:
 | 
			
		||||
      hardPodAffinityWeight: 5
 | 
			
		||||
      kind: InterPodAffinityArgs
 | 
			
		||||
    name: InterPodAffinity
 | 
			
		||||
  - args:
 | 
			
		||||
      apiVersion: kubescheduler.config.k8s.io/v1alpha2
 | 
			
		||||
      bindTimeoutSeconds: 300
 | 
			
		||||
      kind: VolumeBindingArgs
 | 
			
		||||
    name: VolumeBinding
 | 
			
		||||
  - args:
 | 
			
		||||
      apiVersion: kubescheduler.config.k8s.io/v1alpha2
 | 
			
		||||
      kind: RequestedToCapacityRatioArgs
 | 
			
		||||
@@ -431,6 +461,12 @@ profiles:
 | 
			
		||||
									Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}},
 | 
			
		||||
								},
 | 
			
		||||
							},
 | 
			
		||||
							{
 | 
			
		||||
								Name: "VolumeBinding",
 | 
			
		||||
								Args: &config.VolumeBindingArgs{
 | 
			
		||||
									BindTimeoutSeconds: 300,
 | 
			
		||||
								},
 | 
			
		||||
							},
 | 
			
		||||
							{
 | 
			
		||||
								Name: "OutOfTreePlugin",
 | 
			
		||||
								Args: &runtime.Unknown{
 | 
			
		||||
@@ -480,6 +516,11 @@ profiles:
 | 
			
		||||
      - Name: cpu
 | 
			
		||||
        Weight: 1
 | 
			
		||||
    name: NodeResourcesMostAllocated
 | 
			
		||||
  - args:
 | 
			
		||||
      apiVersion: kubescheduler.config.k8s.io/v1alpha2
 | 
			
		||||
      bindTimeoutSeconds: 300
 | 
			
		||||
      kind: VolumeBindingArgs
 | 
			
		||||
    name: VolumeBinding
 | 
			
		||||
  - args:
 | 
			
		||||
      foo: bar
 | 
			
		||||
    name: OutOfTreePlugin
 | 
			
		||||
 
 | 
			
		||||
@@ -90,7 +90,7 @@ type KubeSchedulerConfiguration struct {
 | 
			
		||||
	// nodes will be scored.
 | 
			
		||||
	PercentageOfNodesToScore int32
 | 
			
		||||
 | 
			
		||||
	// Duration to wait for a binding operation to complete before timing out
 | 
			
		||||
	// BindTimeoutSeconds is the timeout in seconds in volume binding operation.
 | 
			
		||||
	// Value must be non-negative integer. The value zero indicates no waiting.
 | 
			
		||||
	// If this value is nil, the default value will be used.
 | 
			
		||||
	// DEPRECATED: BindTimeoutSeconds in deprecated.
 | 
			
		||||
 
 | 
			
		||||
@@ -148,6 +148,8 @@ type ServiceAffinityArgs struct {
 | 
			
		||||
type VolumeBindingArgs struct {
 | 
			
		||||
	metav1.TypeMeta
 | 
			
		||||
 | 
			
		||||
	// BindTimeoutSeconds is the timeout in seconds in volume binding.
 | 
			
		||||
	// BindTimeoutSeconds is the timeout in seconds in volume binding operation.
 | 
			
		||||
	// Value must be non-negative integer. The value zero indicates no waiting.
 | 
			
		||||
	// If this value is nil, the default value will be used.
 | 
			
		||||
	BindTimeoutSeconds int64
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -192,3 +192,9 @@ func SetDefaults_RequestedToCapacityRatioArgs(obj *v1alpha2.RequestedToCapacityR
 | 
			
		||||
		obj.Resources = append(obj.Resources, defaultResourceSpec...)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func SetDefaults_VolumeBindingArgs(obj *v1alpha2.VolumeBindingArgs) {
 | 
			
		||||
	if obj.BindTimeoutSeconds == nil {
 | 
			
		||||
		obj.BindTimeoutSeconds = pointer.Int64Ptr(600)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -470,7 +470,16 @@ func recordingPluginFactory(name string, result map[string]runtime.Object) Plugi
 | 
			
		||||
 | 
			
		||||
func TestNewFrameworkPluginDefaults(t *testing.T) {
 | 
			
		||||
	// In-tree plugins that use args.
 | 
			
		||||
	pluginsWithArgs := []string{"InterPodAffinity", "NodeLabel", "NodeResourcesFit", "NodeResourcesLeastAllocated", "NodeResourcesMostAllocated", "PodTopologySpread", "RequestedToCapacityRatio"}
 | 
			
		||||
	pluginsWithArgs := []string{
 | 
			
		||||
		"InterPodAffinity",
 | 
			
		||||
		"NodeLabel",
 | 
			
		||||
		"NodeResourcesFit",
 | 
			
		||||
		"NodeResourcesLeastAllocated",
 | 
			
		||||
		"NodeResourcesMostAllocated",
 | 
			
		||||
		"PodTopologySpread",
 | 
			
		||||
		"RequestedToCapacityRatio",
 | 
			
		||||
		"VolumeBinding",
 | 
			
		||||
	}
 | 
			
		||||
	plugins := config.Plugins{
 | 
			
		||||
		Filter: &config.PluginSet{},
 | 
			
		||||
	}
 | 
			
		||||
@@ -510,6 +519,9 @@ func TestNewFrameworkPluginDefaults(t *testing.T) {
 | 
			
		||||
					Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
 | 
			
		||||
				},
 | 
			
		||||
				"PodTopologySpread": &config.PodTopologySpreadArgs{},
 | 
			
		||||
				"VolumeBinding": &config.VolumeBindingArgs{
 | 
			
		||||
					BindTimeoutSeconds: 600,
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
@@ -545,6 +557,12 @@ func TestNewFrameworkPluginDefaults(t *testing.T) {
 | 
			
		||||
						Resources: []config.ResourceSpec{{Name: "resource", Weight: 2}},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name: "VolumeBinding",
 | 
			
		||||
					Args: &config.VolumeBindingArgs{
 | 
			
		||||
						BindTimeoutSeconds: 300,
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantCfg: map[string]runtime.Object{
 | 
			
		||||
				"InterPodAffinity": &config.InterPodAffinityArgs{
 | 
			
		||||
@@ -564,6 +582,9 @@ func TestNewFrameworkPluginDefaults(t *testing.T) {
 | 
			
		||||
				"RequestedToCapacityRatio": &config.RequestedToCapacityRatioArgs{
 | 
			
		||||
					Resources: []config.ResourceSpec{{Name: "resource", Weight: 2}},
 | 
			
		||||
				},
 | 
			
		||||
				"VolumeBinding": &config.VolumeBindingArgs{
 | 
			
		||||
					BindTimeoutSeconds: 300,
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -46,6 +46,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
 | 
			
		||||
		&ServiceAffinityArgs{},
 | 
			
		||||
		&NodeResourcesLeastAllocatedArgs{},
 | 
			
		||||
		&NodeResourcesMostAllocatedArgs{},
 | 
			
		||||
		&VolumeBindingArgs{},
 | 
			
		||||
	)
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +77,8 @@ type KubeSchedulerConfiguration struct {
 | 
			
		||||
	// Duration to wait for a binding operation to complete before timing out
 | 
			
		||||
	// Value must be non-negative integer. The value zero indicates no waiting.
 | 
			
		||||
	// If this value is nil, the default value will be used.
 | 
			
		||||
	// DEPRECATED: BindTimeoutSeconds is deprecated. To change volume bind
 | 
			
		||||
	// timeout, configure via plugin args for VolumeBinding.
 | 
			
		||||
	BindTimeoutSeconds *int64 `json:"bindTimeoutSeconds,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// PodInitialBackoffSeconds is the initial backoff for unschedulable pods.
 | 
			
		||||
 
 | 
			
		||||
@@ -173,3 +173,15 @@ type ServiceAffinityArgs struct {
 | 
			
		||||
	// +listType=atomic
 | 
			
		||||
	AntiAffinityLabelsPreference []string `json:"antiAffinityLabelsPreference,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 | 
			
		||||
 | 
			
		||||
// VolumeBindingArgs holds arguments used to configure the VolumeBinding plugin.
 | 
			
		||||
type VolumeBindingArgs struct {
 | 
			
		||||
	metav1.TypeMeta `json:",inline"`
 | 
			
		||||
 | 
			
		||||
	// BindTimeoutSeconds is the timeout in seconds in volume binding operation.
 | 
			
		||||
	// Value must be non-negative integer. The value zero indicates no waiting.
 | 
			
		||||
	// If this value is nil, the default value (600) will be used.
 | 
			
		||||
	BindTimeoutSeconds *int64 `json:"bindTimeoutSeconds,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user