mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #91142 from cofyc/fix91139
Add versioned counterparts for VolumeBindingArgs
This commit is contained in:
commit
2f38e1b130
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -190,6 +190,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.VolumeBindingArgs)(nil), (*config.VolumeBindingArgs)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_VolumeBindingArgs_To_config_VolumeBindingArgs(a.(*v1alpha2.VolumeBindingArgs), b.(*config.VolumeBindingArgs), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*config.VolumeBindingArgs)(nil), (*v1alpha2.VolumeBindingArgs)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_config_VolumeBindingArgs_To_v1alpha2_VolumeBindingArgs(a.(*config.VolumeBindingArgs), b.(*v1alpha2.VolumeBindingArgs), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.AddConversionFunc((*config.KubeSchedulerConfiguration)(nil), (*v1alpha2.KubeSchedulerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
if err := s.AddConversionFunc((*config.KubeSchedulerConfiguration)(nil), (*v1alpha2.KubeSchedulerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
return Convert_config_KubeSchedulerConfiguration_To_v1alpha2_KubeSchedulerConfiguration(a.(*config.KubeSchedulerConfiguration), b.(*v1alpha2.KubeSchedulerConfiguration), scope)
|
return Convert_config_KubeSchedulerConfiguration_To_v1alpha2_KubeSchedulerConfiguration(a.(*config.KubeSchedulerConfiguration), b.(*v1alpha2.KubeSchedulerConfiguration), scope)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@ -907,3 +917,27 @@ func autoConvert_config_UtilizationShapePoint_To_v1alpha2_UtilizationShapePoint(
|
|||||||
func Convert_config_UtilizationShapePoint_To_v1alpha2_UtilizationShapePoint(in *config.UtilizationShapePoint, out *v1alpha2.UtilizationShapePoint, s conversion.Scope) error {
|
func Convert_config_UtilizationShapePoint_To_v1alpha2_UtilizationShapePoint(in *config.UtilizationShapePoint, out *v1alpha2.UtilizationShapePoint, s conversion.Scope) error {
|
||||||
return autoConvert_config_UtilizationShapePoint_To_v1alpha2_UtilizationShapePoint(in, out, s)
|
return autoConvert_config_UtilizationShapePoint_To_v1alpha2_UtilizationShapePoint(in, out, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_VolumeBindingArgs_To_config_VolumeBindingArgs(in *v1alpha2.VolumeBindingArgs, out *config.VolumeBindingArgs, s conversion.Scope) error {
|
||||||
|
if err := v1.Convert_Pointer_int64_To_int64(&in.BindTimeoutSeconds, &out.BindTimeoutSeconds, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_VolumeBindingArgs_To_config_VolumeBindingArgs is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_VolumeBindingArgs_To_config_VolumeBindingArgs(in *v1alpha2.VolumeBindingArgs, out *config.VolumeBindingArgs, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_VolumeBindingArgs_To_config_VolumeBindingArgs(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_config_VolumeBindingArgs_To_v1alpha2_VolumeBindingArgs(in *config.VolumeBindingArgs, out *v1alpha2.VolumeBindingArgs, s conversion.Scope) error {
|
||||||
|
if err := v1.Convert_int64_To_Pointer_int64(&in.BindTimeoutSeconds, &out.BindTimeoutSeconds, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_config_VolumeBindingArgs_To_v1alpha2_VolumeBindingArgs is an autogenerated conversion function.
|
||||||
|
func Convert_config_VolumeBindingArgs_To_v1alpha2_VolumeBindingArgs(in *config.VolumeBindingArgs, out *v1alpha2.VolumeBindingArgs, s conversion.Scope) error {
|
||||||
|
return autoConvert_config_VolumeBindingArgs_To_v1alpha2_VolumeBindingArgs(in, out, s)
|
||||||
|
}
|
||||||
|
@ -42,6 +42,7 @@ func RegisterDefaults(scheme *runtime.Scheme) error {
|
|||||||
scheme.AddTypeDefaultingFunc(&v1alpha2.RequestedToCapacityRatioArgs{}, func(obj interface{}) {
|
scheme.AddTypeDefaultingFunc(&v1alpha2.RequestedToCapacityRatioArgs{}, func(obj interface{}) {
|
||||||
SetObjectDefaults_RequestedToCapacityRatioArgs(obj.(*v1alpha2.RequestedToCapacityRatioArgs))
|
SetObjectDefaults_RequestedToCapacityRatioArgs(obj.(*v1alpha2.RequestedToCapacityRatioArgs))
|
||||||
})
|
})
|
||||||
|
scheme.AddTypeDefaultingFunc(&v1alpha2.VolumeBindingArgs{}, func(obj interface{}) { SetObjectDefaults_VolumeBindingArgs(obj.(*v1alpha2.VolumeBindingArgs)) })
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,3 +65,7 @@ func SetObjectDefaults_NodeResourcesMostAllocatedArgs(in *v1alpha2.NodeResources
|
|||||||
func SetObjectDefaults_RequestedToCapacityRatioArgs(in *v1alpha2.RequestedToCapacityRatioArgs) {
|
func SetObjectDefaults_RequestedToCapacityRatioArgs(in *v1alpha2.RequestedToCapacityRatioArgs) {
|
||||||
SetDefaults_RequestedToCapacityRatioArgs(in)
|
SetDefaults_RequestedToCapacityRatioArgs(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetObjectDefaults_VolumeBindingArgs(in *v1alpha2.VolumeBindingArgs) {
|
||||||
|
SetDefaults_VolumeBindingArgs(in)
|
||||||
|
}
|
||||||
|
@ -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"`
|
||||||
|
}
|
||||||
|
@ -573,3 +573,33 @@ func (in *UtilizationShapePoint) DeepCopy() *UtilizationShapePoint {
|
|||||||
in.DeepCopyInto(out)
|
in.DeepCopyInto(out)
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *VolumeBindingArgs) DeepCopyInto(out *VolumeBindingArgs) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
if in.BindTimeoutSeconds != nil {
|
||||||
|
in, out := &in.BindTimeoutSeconds, &out.BindTimeoutSeconds
|
||||||
|
*out = new(int64)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBindingArgs.
|
||||||
|
func (in *VolumeBindingArgs) DeepCopy() *VolumeBindingArgs {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(VolumeBindingArgs)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *VolumeBindingArgs) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user