diff --git a/pkg/api/deep_copy_generated.go b/pkg/api/deep_copy_generated.go index 6299959ef53..a63ef92caa1 100644 --- a/pkg/api/deep_copy_generated.go +++ b/pkg/api/deep_copy_generated.go @@ -1332,15 +1332,6 @@ func DeepCopy_api_NodeAddress(in NodeAddress, out *NodeAddress, c *conversion.Cl } func DeepCopy_api_NodeAffinity(in NodeAffinity, out *NodeAffinity, c *conversion.Cloner) error { - if in.RequiredDuringSchedulingRequiredDuringExecution != nil { - in, out := in.RequiredDuringSchedulingRequiredDuringExecution, &out.RequiredDuringSchedulingRequiredDuringExecution - *out = new(NodeSelector) - if err := DeepCopy_api_NodeSelector(*in, *out, c); err != nil { - return err - } - } else { - out.RequiredDuringSchedulingRequiredDuringExecution = nil - } if in.RequiredDuringSchedulingIgnoredDuringExecution != nil { in, out := in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution *out = new(NodeSelector) diff --git a/pkg/api/types.generated.go b/pkg/api/types.generated.go index 18bc655d14a..5cd4a3883c4 100644 --- a/pkg/api/types.generated.go +++ b/pkg/api/types.generated.go @@ -22776,15 +22776,14 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [3]bool + var yyq2 [2]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false - yyq2[0] = x.RequiredDuringSchedulingRequiredDuringExecution != nil - yyq2[1] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil - yyq2[2] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0 + yyq2[0] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil + yyq2[1] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0 var yynn2 int if yyr2 || yy2arr2 { - r.EncodeArrayStart(3) + r.EncodeArrayStart(2) } else { yynn2 = 0 for _, b := range yyq2 { @@ -22798,29 +22797,6 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[0] { - if x.RequiredDuringSchedulingRequiredDuringExecution == nil { - r.EncodeNil() - } else { - x.RequiredDuringSchedulingRequiredDuringExecution.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } else { - if yyq2[0] { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingRequiredDuringExecution")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - if x.RequiredDuringSchedulingRequiredDuringExecution == nil { - r.EncodeNil() - } else { - x.RequiredDuringSchedulingRequiredDuringExecution.CodecEncodeSelf(e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if yyq2[1] { if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { r.EncodeNil() } else { @@ -22830,7 +22806,7 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2[1] { + if yyq2[0] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingIgnoredDuringExecution")) z.EncSendContainerState(codecSelfer_containerMapValue1234) @@ -22843,12 +22819,12 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if yyq2[2] { + if yyq2[1] { if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { r.EncodeNil() } else { - yym10 := z.EncBinary() - _ = yym10 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) @@ -22858,15 +22834,15 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2[2] { + if yyq2[1] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("preferredDuringSchedulingIgnoredDuringExecution")) z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { r.EncodeNil() } else { - yym11 := z.EncBinary() - _ = yym11 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) @@ -22935,17 +22911,6 @@ func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { yys3 := string(yys3Slc) z.DecSendContainerState(codecSelfer_containerMapValue1234) switch yys3 { - case "requiredDuringSchedulingRequiredDuringExecution": - if r.TryDecodeAsNil() { - if x.RequiredDuringSchedulingRequiredDuringExecution != nil { - x.RequiredDuringSchedulingRequiredDuringExecution = nil - } - } else { - if x.RequiredDuringSchedulingRequiredDuringExecution == nil { - x.RequiredDuringSchedulingRequiredDuringExecution = new(NodeSelector) - } - x.RequiredDuringSchedulingRequiredDuringExecution.CodecDecodeSelf(d) - } case "requiredDuringSchedulingIgnoredDuringExecution": if r.TryDecodeAsNil() { if x.RequiredDuringSchedulingIgnoredDuringExecution != nil { @@ -22961,12 +22926,12 @@ func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.PreferredDuringSchedulingIgnoredDuringExecution = nil } else { - yyv6 := &x.PreferredDuringSchedulingIgnoredDuringExecution - yym7 := z.DecBinary() - _ = yym7 + yyv5 := &x.PreferredDuringSchedulingIgnoredDuringExecution + yym6 := z.DecBinary() + _ = yym6 if false { } else { - h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv6), d) + h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv5), d) } } default: @@ -22980,37 +22945,16 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj8 int - var yyb8 bool - var yyhl8 bool = l >= 0 - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb8 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1234) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem1234) - if r.TryDecodeAsNil() { - if x.RequiredDuringSchedulingRequiredDuringExecution != nil { - x.RequiredDuringSchedulingRequiredDuringExecution = nil - } - } else { - if x.RequiredDuringSchedulingRequiredDuringExecution == nil { - x.RequiredDuringSchedulingRequiredDuringExecution = new(NodeSelector) - } - x.RequiredDuringSchedulingRequiredDuringExecution.CodecDecodeSelf(d) - } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { + if yyb7 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -23025,13 +22969,13 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d) } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb8 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb8 { + if yyb7 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -23039,26 +22983,26 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.PreferredDuringSchedulingIgnoredDuringExecution = nil } else { - yyv11 := &x.PreferredDuringSchedulingIgnoredDuringExecution - yym12 := z.DecBinary() - _ = yym12 + yyv9 := &x.PreferredDuringSchedulingIgnoredDuringExecution + yym10 := z.DecBinary() + _ = yym10 if false { } else { - h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv11), d) + h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv9), d) } } for { - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb8 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb8 { + if yyb7 { break } z.DecSendContainerState(codecSelfer_containerArrayElem1234) - z.DecStructFieldNotFound(yyj8-1, "") + z.DecStructFieldNotFound(yyj7-1, "") } z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } diff --git a/pkg/api/types.go b/pkg/api/types.go index 99e9bb4ae06..97ae4be2008 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -1145,23 +1145,23 @@ const ( NodeSelectorOpLt NodeSelectorOperator = "Lt" ) -// Affinity is a group of affinity scheduling requirements. +// Affinity is a group of affinity scheduling rules, currently +// only node affinity, but in the future also inter-pod affinity. type Affinity struct { - // Describes node affinity scheduling requirements for the pod. + // Describes node affinity scheduling rules for the pod. NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"` } -// Node affinity is a group of node affinity scheduling requirements. -// If RequiredDuringSchedulingRequiredDuringExecution and -// RequiredDuringSchedulingIgnoredDuringExecution are both set, -// then both node selectors must be satisfied. +// Node affinity is a group of node affinity scheduling rules. type NodeAffinity struct { + // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. // If the affinity requirements specified by this field are not met at // scheduling time, the pod will not be scheduled onto the node. // If the affinity requirements specified by this field cease to be met // at some point during pod execution (e.g. due to an update), the system // will try to eventually evict the pod from its node. - RequiredDuringSchedulingRequiredDuringExecution *NodeSelector `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` + // RequiredDuringSchedulingRequiredDuringExecution *NodeSelector `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` + // If the affinity requirements specified by this field are not met at // scheduling time, the pod will not be scheduled onto the node. // If the affinity requirements specified by this field cease to be met diff --git a/pkg/api/v1/types.generated.go b/pkg/api/v1/types.generated.go index 2e4b12727a4..64344ff42b1 100644 --- a/pkg/api/v1/types.generated.go +++ b/pkg/api/v1/types.generated.go @@ -22056,15 +22056,14 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [3]bool + var yyq2 [2]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false - yyq2[0] = x.RequiredDuringSchedulingRequiredDuringExecution != nil - yyq2[1] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil - yyq2[2] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0 + yyq2[0] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil + yyq2[1] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0 var yynn2 int if yyr2 || yy2arr2 { - r.EncodeArrayStart(3) + r.EncodeArrayStart(2) } else { yynn2 = 0 for _, b := range yyq2 { @@ -22078,29 +22077,6 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[0] { - if x.RequiredDuringSchedulingRequiredDuringExecution == nil { - r.EncodeNil() - } else { - x.RequiredDuringSchedulingRequiredDuringExecution.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } else { - if yyq2[0] { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingRequiredDuringExecution")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - if x.RequiredDuringSchedulingRequiredDuringExecution == nil { - r.EncodeNil() - } else { - x.RequiredDuringSchedulingRequiredDuringExecution.CodecEncodeSelf(e) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if yyq2[1] { if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { r.EncodeNil() } else { @@ -22110,7 +22086,7 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2[1] { + if yyq2[0] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingIgnoredDuringExecution")) z.EncSendContainerState(codecSelfer_containerMapValue1234) @@ -22123,12 +22099,12 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if yyq2[2] { + if yyq2[1] { if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { r.EncodeNil() } else { - yym10 := z.EncBinary() - _ = yym10 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) @@ -22138,15 +22114,15 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2[2] { + if yyq2[1] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("preferredDuringSchedulingIgnoredDuringExecution")) z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { r.EncodeNil() } else { - yym11 := z.EncBinary() - _ = yym11 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) @@ -22215,17 +22191,6 @@ func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { yys3 := string(yys3Slc) z.DecSendContainerState(codecSelfer_containerMapValue1234) switch yys3 { - case "requiredDuringSchedulingRequiredDuringExecution": - if r.TryDecodeAsNil() { - if x.RequiredDuringSchedulingRequiredDuringExecution != nil { - x.RequiredDuringSchedulingRequiredDuringExecution = nil - } - } else { - if x.RequiredDuringSchedulingRequiredDuringExecution == nil { - x.RequiredDuringSchedulingRequiredDuringExecution = new(NodeSelector) - } - x.RequiredDuringSchedulingRequiredDuringExecution.CodecDecodeSelf(d) - } case "requiredDuringSchedulingIgnoredDuringExecution": if r.TryDecodeAsNil() { if x.RequiredDuringSchedulingIgnoredDuringExecution != nil { @@ -22241,12 +22206,12 @@ func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.PreferredDuringSchedulingIgnoredDuringExecution = nil } else { - yyv6 := &x.PreferredDuringSchedulingIgnoredDuringExecution - yym7 := z.DecBinary() - _ = yym7 + yyv5 := &x.PreferredDuringSchedulingIgnoredDuringExecution + yym6 := z.DecBinary() + _ = yym6 if false { } else { - h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv6), d) + h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv5), d) } } default: @@ -22260,37 +22225,16 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj8 int - var yyb8 bool - var yyhl8 bool = l >= 0 - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb8 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1234) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem1234) - if r.TryDecodeAsNil() { - if x.RequiredDuringSchedulingRequiredDuringExecution != nil { - x.RequiredDuringSchedulingRequiredDuringExecution = nil - } - } else { - if x.RequiredDuringSchedulingRequiredDuringExecution == nil { - x.RequiredDuringSchedulingRequiredDuringExecution = new(NodeSelector) - } - x.RequiredDuringSchedulingRequiredDuringExecution.CodecDecodeSelf(d) - } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { + if yyb7 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -22305,13 +22249,13 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d) } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb8 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb8 { + if yyb7 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -22319,26 +22263,26 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.PreferredDuringSchedulingIgnoredDuringExecution = nil } else { - yyv11 := &x.PreferredDuringSchedulingIgnoredDuringExecution - yym12 := z.DecBinary() - _ = yym12 + yyv9 := &x.PreferredDuringSchedulingIgnoredDuringExecution + yym10 := z.DecBinary() + _ = yym10 if false { } else { - h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv11), d) + h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv9), d) } } for { - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb8 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb8 { + if yyb7 { break } z.DecSendContainerState(codecSelfer_containerArrayElem1234) - z.DecStructFieldNotFound(yyj8-1, "") + z.DecStructFieldNotFound(yyj7-1, "") } z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index a8d1771e338..753e8756e68 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -1381,24 +1381,23 @@ const ( NodeSelectorOpLt NodeSelectorOperator = "Lt" ) -// Affinity is a group of affinity scheduling requirements, -// including node affinity and inter pod affinity. +// Affinity is a group of affinity scheduling rules, currently +// only node affinity, but in the future also inter-pod affinity. type Affinity struct { - // Describes node affinity scheduling requirements for the pod. + // Describes node affinity scheduling rules for the pod. NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"` } -// Node affinity is a group of node affinity scheduling requirements. -// If RequiredDuringSchedulingRequiredDuringExecution and -// RequiredDuringSchedulingIgnoredDuringExecution are both set, -// then both node selectors must be satisfied. +// Node affinity is a group of node affinity scheduling rules. type NodeAffinity struct { + // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. // If the affinity requirements specified by this field are not met at // scheduling time, the pod will not be scheduled onto the node. // If the affinity requirements specified by this field cease to be met // at some point during pod execution (e.g. due to an update), the system // will try to eventually evict the pod from its node. - RequiredDuringSchedulingRequiredDuringExecution *NodeSelector `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` + // RequiredDuringSchedulingRequiredDuringExecution *NodeSelector `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` + // If the affinity requirements specified by this field are not met at // scheduling time, the pod will not be scheduled onto the node. // If the affinity requirements specified by this field cease to be met diff --git a/pkg/api/v1/types_swagger_doc_generated.go b/pkg/api/v1/types_swagger_doc_generated.go index 85269d6b1ed..2ca06ac0ff3 100644 --- a/pkg/api/v1/types_swagger_doc_generated.go +++ b/pkg/api/v1/types_swagger_doc_generated.go @@ -40,8 +40,8 @@ func (AWSElasticBlockStoreVolumeSource) SwaggerDoc() map[string]string { } var map_Affinity = map[string]string{ - "": "Affinity is a group of affinity scheduling requirements, including node affinity and inter pod affinity.", - "nodeAffinity": "Describes node affinity scheduling requirements for the pod.", + "": "Affinity is a group of affinity scheduling rules, currently only node affinity, but in the future also inter-pod affinity.", + "nodeAffinity": "Describes node affinity scheduling rules for the pod.", } func (Affinity) SwaggerDoc() map[string]string { @@ -771,8 +771,7 @@ func (NodeAddress) SwaggerDoc() map[string]string { } var map_NodeAffinity = map[string]string{ - "": "Node affinity is a group of node affinity scheduling requirements. If RequiredDuringSchedulingRequiredDuringExecution and RequiredDuringSchedulingIgnoredDuringExecution are both set, then both node selectors must be satisfied.", - "requiredDuringSchedulingRequiredDuringExecution": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system will try to eventually evict the pod from its node.", + "": "Node affinity is a group of node affinity scheduling rules.", "requiredDuringSchedulingIgnoredDuringExecution": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.", "preferredDuringSchedulingIgnoredDuringExecution": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.", } diff --git a/pkg/api/validation/validation.go b/pkg/api/validation/validation.go index 20af1c5a78b..85aa728071a 100644 --- a/pkg/api/validation/validation.go +++ b/pkg/api/validation/validation.go @@ -1451,9 +1451,11 @@ func ValidateAffinityInPodAnnotations(annotations map[string]string, fldPath *fi if affinity.NodeAffinity != nil { na := affinity.NodeAffinity - if na.RequiredDuringSchedulingRequiredDuringExecution != nil { - allErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingRequiredDuringExecution, fldPath.Child("requiredDuringSchedulingRequiredDuringExecution"))...) - } + + // TODO: Uncomment the next three lines once RequiredDuringSchedulingRequiredDuringExecution is implemented. + // if na.RequiredDuringSchedulingRequiredDuringExecution != nil { + // allErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingRequiredDuringExecution, fldPath.Child("requiredDuringSchedulingRequiredDuringExecution"))...) + // } if na.RequiredDuringSchedulingIgnoredDuringExecution != nil { allErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingIgnoredDuringExecution, fldPath.Child("requiredDuringSchedulingIgnoredDuringExecution"))...) diff --git a/pkg/api/validation/validation_test.go b/pkg/api/validation/validation_test.go index 7094cbb7359..19a1b702838 100644 --- a/pkg/api/validation/validation_test.go +++ b/pkg/api/validation/validation_test.go @@ -1739,17 +1739,19 @@ func TestValidatePod(t *testing.T) { ObjectMeta: api.ObjectMeta{ Name: "123", Namespace: "ns", + // TODO: Uncomment and move this block into Annotations map once + // RequiredDuringSchedulingRequiredDuringExecution is implemented + // "requiredDuringSchedulingRequiredDuringExecution": { + // "nodeSelectorTerms": [{ + // "matchExpressions": [{ + // "key": "key1", + // "operator": "Exists" + // }] + // }] + // }, Annotations: map[string]string{ api.AffinityAnnotationKey: ` {"nodeAffinity": { - "requiredDuringSchedulingRequiredDuringExecution": { - "nodeSelectorTerms": [{ - "matchExpressions": [{ - "key": "key1", - "operator": "Exists" - }] - }] - }, "requiredDuringSchedulingIgnoredDuringExecution": { "nodeSelectorTerms": [{ "matchExpressions": [{ @@ -1830,7 +1832,7 @@ func TestValidatePod(t *testing.T) { Annotations: map[string]string{ api.AffinityAnnotationKey: ` {"nodeAffinity": { - "requiredDuringSchedulingRequiredDuringExecution": { + "requiredDuringSchedulingIgnoredDuringExecution": { "nodeSelectorTerms": [{ `, }, @@ -1847,7 +1849,7 @@ func TestValidatePod(t *testing.T) { Namespace: "ns", Annotations: map[string]string{ api.AffinityAnnotationKey: ` - {"nodeAffinity": {"requiredDuringSchedulingRequiredDuringExecution": { + {"nodeAffinity": {"requiredDuringSchedulingIgnoredDuringExecution": { "nodeSelectorTerms": [{ "matchExpressions": [{ "key": "key1", @@ -1888,14 +1890,14 @@ func TestValidatePod(t *testing.T) { DNSPolicy: api.DNSClusterFirst, }, }, - "invalid requiredDuringSchedulingRequiredDuringExecution node selector, nodeSelectorTerms must have at least one term": { + "invalid requiredDuringSchedulingIgnoredDuringExecution node selector, nodeSelectorTerms must have at least one term": { ObjectMeta: api.ObjectMeta{ Name: "123", Namespace: "ns", Annotations: map[string]string{ api.AffinityAnnotationKey: ` {"nodeAffinity": { - "requiredDuringSchedulingRequiredDuringExecution": { + "requiredDuringSchedulingIgnoredDuringExecution": { "nodeSelectorTerms": [] }, }}`, @@ -1907,14 +1909,14 @@ func TestValidatePod(t *testing.T) { DNSPolicy: api.DNSClusterFirst, }, }, - "invalid requiredDuringSchedulingRequiredDuringExecution node selector term, matchExpressions must have at least one node selector requirement": { + "invalid requiredDuringSchedulingIgnoredDuringExecution node selector term, matchExpressions must have at least one node selector requirement": { ObjectMeta: api.ObjectMeta{ Name: "123", Namespace: "ns", Annotations: map[string]string{ api.AffinityAnnotationKey: ` {"nodeAffinity": { - "requiredDuringSchedulingRequiredDuringExecution": { + "requiredDuringSchedulingIgnoredDuringExecution": { "nodeSelectorTerms": [{ "matchExpressions": [] }] diff --git a/plugin/pkg/scheduler/algorithm/predicates/predicates.go b/plugin/pkg/scheduler/algorithm/predicates/predicates.go index c0d52815208..cbf99341837 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/predicates.go +++ b/plugin/pkg/scheduler/algorithm/predicates/predicates.go @@ -513,18 +513,21 @@ func PodMatchesNodeLabels(pod *api.Pod, node *api.Node) bool { if affinity.NodeAffinity != nil { nodeAffinity := affinity.NodeAffinity // if no required NodeAffinity requirements, will do no-op, means select all nodes. - if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution == nil && nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution == nil { + // TODO: Replace next line with subsequent commented-out line when implement RequiredDuringSchedulingRequiredDuringExecution. + if nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution == nil { + // if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution == nil && nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution == nil { return true } // Match node selector for requiredDuringSchedulingRequiredDuringExecution. - if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution != nil { - nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution.NodeSelectorTerms - glog.V(10).Infof("Match for RequiredDuringSchedulingRequiredDuringExecution node selector terms %+v", nodeSelectorTerms) - nodeAffinityMatches = NodeMatchesNodeSelectorTerms(node, nodeSelectorTerms) - } + // TODO: Uncomment this block when implement RequiredDuringSchedulingRequiredDuringExecution. + // if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution != nil { + // nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution.NodeSelectorTerms + // glog.V(10).Infof("Match for RequiredDuringSchedulingRequiredDuringExecution node selector terms %+v", nodeSelectorTerms) + // nodeAffinityMatches = NodeMatchesNodeSelectorTerms(node, nodeSelectorTerms) + // } - // Match node selector for requiredDuringSchedulingRequiredDuringExecution. + // Match node selector for requiredDuringSchedulingIgnoredDuringExecution. if nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution != nil { nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms glog.V(10).Infof("Match for RequiredDuringSchedulingIgnoredDuringExecution node selector terms %+v", nodeSelectorTerms) diff --git a/plugin/pkg/scheduler/algorithm/predicates/predicates_test.go b/plugin/pkg/scheduler/algorithm/predicates/predicates_test.go index 4ac7191f873..4126eafe998 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/predicates_test.go +++ b/plugin/pkg/scheduler/algorithm/predicates/predicates_test.go @@ -881,41 +881,42 @@ func TestPodFitsSelector(t *testing.T) { fits: true, test: "Pod with multiple NodeSelectorTerms ORed in affinity, matches the node's labels and will schedule onto the node", }, - { - pod: &api.Pod{ - ObjectMeta: api.ObjectMeta{ - Annotations: map[string]string{ - api.AffinityAnnotationKey: ` - {"nodeAffinity": { - "requiredDuringSchedulingRequiredDuringExecution": { - "nodeSelectorTerms": [{ - "matchExpressions": [{ - "key": "foo", - "operator": "In", - "values": ["bar", "value2"] - }] - }] - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "nodeSelectorTerms": [{ - "matchExpressions": [{ - "key": "foo", - "operator": "NotIn", - "values": ["bar", "value2"] - }] - }] - } - }}`, - }, - }, - }, - labels: map[string]string{ - "foo": "bar", - }, - fits: false, - test: "Pod with an Affinity both requiredDuringSchedulingRequiredDuringExecution and " + - "requiredDuringSchedulingIgnoredDuringExecution indicated that don't match node's labels and won't schedule onto the node", - }, + // TODO: Uncomment this test when implement RequiredDuringSchedulingRequiredDuringExecution + // { + // pod: &api.Pod{ + // ObjectMeta: api.ObjectMeta{ + // Annotations: map[string]string{ + // api.AffinityAnnotationKey: ` + // {"nodeAffinity": { + // "requiredDuringSchedulingRequiredDuringExecution": { + // "nodeSelectorTerms": [{ + // "matchExpressions": [{ + // "key": "foo", + // "operator": "In", + // "values": ["bar", "value2"] + // }] + // }] + // }, + // "requiredDuringSchedulingIgnoredDuringExecution": { + // "nodeSelectorTerms": [{ + // "matchExpressions": [{ + // "key": "foo", + // "operator": "NotIn", + // "values": ["bar", "value2"] + // }] + // }] + // } + // }}`, + // }, + // }, + // }, + // labels: map[string]string{ + // "foo": "bar", + // }, + // fits: false, + // test: "Pod with an Affinity both requiredDuringSchedulingRequiredDuringExecution and " + + // "requiredDuringSchedulingIgnoredDuringExecution indicated that don't match node's labels and won't schedule onto the node", + // }, { pod: &api.Pod{ ObjectMeta: api.ObjectMeta{ diff --git a/test/e2e/scheduler_predicates.go b/test/e2e/scheduler_predicates.go index 607b5125b69..cf824655f0c 100644 --- a/test/e2e/scheduler_predicates.go +++ b/test/e2e/scheduler_predicates.go @@ -419,7 +419,7 @@ var _ = Describe("SchedulerPredicates [Serial]", func() { Annotations: map[string]string{ api.AffinityAnnotationKey: ` {"nodeAffinity": { - "requiredDuringSchedulingRequiredDuringExecution": { + "requiredDuringSchedulingIgnoredDuringExecution": { "nodeSelectorTerms": [{ "matchExpressions": [] }]