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