Merge pull request #21057 from davidopp/work1

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2016-02-14 20:48:17 -08:00
commit 4ff418ca50
11 changed files with 161 additions and 276 deletions

View File

@ -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 { 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 { if in.RequiredDuringSchedulingIgnoredDuringExecution != nil {
in, out := in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution in, out := in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution
*out = new(NodeSelector) *out = new(NodeSelector)

View File

@ -22776,15 +22776,14 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
} else { } else {
yysep2 := !z.EncBinary() yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [3]bool var yyq2 [2]bool
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[0] = x.RequiredDuringSchedulingRequiredDuringExecution != nil yyq2[0] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil
yyq2[1] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil yyq2[1] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0
yyq2[2] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(3) r.EncodeArrayStart(2)
} else { } else {
yynn2 = 0 yynn2 = 0
for _, b := range yyq2 { for _, b := range yyq2 {
@ -22798,29 +22797,6 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[0] { 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 { if x.RequiredDuringSchedulingIgnoredDuringExecution == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
@ -22830,7 +22806,7 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeNil() r.EncodeNil()
} }
} else { } else {
if yyq2[1] { if yyq2[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingIgnoredDuringExecution")) r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingIgnoredDuringExecution"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -22843,12 +22819,12 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] { if yyq2[1] {
if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { if x.PreferredDuringSchedulingIgnoredDuringExecution == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
yym10 := z.EncBinary() yym7 := z.EncBinary()
_ = yym10 _ = yym7
if false { if false {
} else { } else {
h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e)
@ -22858,15 +22834,15 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeNil() r.EncodeNil()
} }
} else { } else {
if yyq2[2] { if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("preferredDuringSchedulingIgnoredDuringExecution")) r.EncodeString(codecSelferC_UTF81234, string("preferredDuringSchedulingIgnoredDuringExecution"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { if x.PreferredDuringSchedulingIgnoredDuringExecution == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
yym11 := z.EncBinary() yym8 := z.EncBinary()
_ = yym11 _ = yym8
if false { if false {
} else { } else {
h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e)
@ -22935,17 +22911,6 @@ func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
yys3 := string(yys3Slc) yys3 := string(yys3Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234) z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys3 { 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": case "requiredDuringSchedulingIgnoredDuringExecution":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
if x.RequiredDuringSchedulingIgnoredDuringExecution != nil { if x.RequiredDuringSchedulingIgnoredDuringExecution != nil {
@ -22961,12 +22926,12 @@ func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.PreferredDuringSchedulingIgnoredDuringExecution = nil x.PreferredDuringSchedulingIgnoredDuringExecution = nil
} else { } else {
yyv6 := &x.PreferredDuringSchedulingIgnoredDuringExecution yyv5 := &x.PreferredDuringSchedulingIgnoredDuringExecution
yym7 := z.DecBinary() yym6 := z.DecBinary()
_ = yym7 _ = yym6
if false { if false {
} else { } else {
h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv6), d) h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv5), d)
} }
} }
default: default:
@ -22980,37 +22945,16 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234 var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d) z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r _, _, _ = h, z, r
var yyj8 int var yyj7 int
var yyb8 bool var yyb7 bool
var yyhl8 bool = l >= 0 var yyhl7 bool = l >= 0
yyj8++ yyj7++
if yyhl8 { if yyhl7 {
yyb8 = yyj8 > l yyb7 = yyj7 > l
} else { } else {
yyb8 = r.CheckBreak() yyb7 = r.CheckBreak()
} }
if yyb8 { if yyb7 {
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 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -23025,13 +22969,13 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} }
x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d) x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d)
} }
yyj8++ yyj7++
if yyhl8 { if yyhl7 {
yyb8 = yyj8 > l yyb7 = yyj7 > l
} else { } else {
yyb8 = r.CheckBreak() yyb7 = r.CheckBreak()
} }
if yyb8 { if yyb7 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -23039,26 +22983,26 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.PreferredDuringSchedulingIgnoredDuringExecution = nil x.PreferredDuringSchedulingIgnoredDuringExecution = nil
} else { } else {
yyv11 := &x.PreferredDuringSchedulingIgnoredDuringExecution yyv9 := &x.PreferredDuringSchedulingIgnoredDuringExecution
yym12 := z.DecBinary() yym10 := z.DecBinary()
_ = yym12 _ = yym10
if false { if false {
} else { } else {
h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv11), d) h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv9), d)
} }
} }
for { for {
yyj8++ yyj7++
if yyhl8 { if yyhl7 {
yyb8 = yyj8 > l yyb7 = yyj7 > l
} else { } else {
yyb8 = r.CheckBreak() yyb7 = r.CheckBreak()
} }
if yyb8 { if yyb7 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj8-1, "") z.DecStructFieldNotFound(yyj7-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }

View File

@ -1145,23 +1145,23 @@ const (
NodeSelectorOpLt NodeSelectorOperator = "Lt" 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 { type Affinity struct {
// Describes node affinity scheduling requirements for the pod. // Describes node affinity scheduling rules for the pod.
NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"` NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"`
} }
// Node affinity is a group of node affinity scheduling requirements. // Node affinity is a group of node affinity scheduling rules.
// If RequiredDuringSchedulingRequiredDuringExecution and
// RequiredDuringSchedulingIgnoredDuringExecution are both set,
// then both node selectors must be satisfied.
type NodeAffinity struct { 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 // If the affinity requirements specified by this field are not met at
// scheduling time, the pod will not be scheduled onto the node. // scheduling time, the pod will not be scheduled onto the node.
// If the affinity requirements specified by this field cease to be met // 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 // at some point during pod execution (e.g. due to an update), the system
// will try to eventually evict the pod from its node. // 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 // If the affinity requirements specified by this field are not met at
// scheduling time, the pod will not be scheduled onto the node. // scheduling time, the pod will not be scheduled onto the node.
// If the affinity requirements specified by this field cease to be met // If the affinity requirements specified by this field cease to be met

View File

@ -22056,15 +22056,14 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
} else { } else {
yysep2 := !z.EncBinary() yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [3]bool var yyq2 [2]bool
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[0] = x.RequiredDuringSchedulingRequiredDuringExecution != nil yyq2[0] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil
yyq2[1] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil yyq2[1] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0
yyq2[2] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(3) r.EncodeArrayStart(2)
} else { } else {
yynn2 = 0 yynn2 = 0
for _, b := range yyq2 { for _, b := range yyq2 {
@ -22078,29 +22077,6 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[0] { 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 { if x.RequiredDuringSchedulingIgnoredDuringExecution == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
@ -22110,7 +22086,7 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeNil() r.EncodeNil()
} }
} else { } else {
if yyq2[1] { if yyq2[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingIgnoredDuringExecution")) r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingIgnoredDuringExecution"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -22123,12 +22099,12 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] { if yyq2[1] {
if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { if x.PreferredDuringSchedulingIgnoredDuringExecution == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
yym10 := z.EncBinary() yym7 := z.EncBinary()
_ = yym10 _ = yym7
if false { if false {
} else { } else {
h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e)
@ -22138,15 +22114,15 @@ func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeNil() r.EncodeNil()
} }
} else { } else {
if yyq2[2] { if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("preferredDuringSchedulingIgnoredDuringExecution")) r.EncodeString(codecSelferC_UTF81234, string("preferredDuringSchedulingIgnoredDuringExecution"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { if x.PreferredDuringSchedulingIgnoredDuringExecution == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
yym11 := z.EncBinary() yym8 := z.EncBinary()
_ = yym11 _ = yym8
if false { if false {
} else { } else {
h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e)
@ -22215,17 +22191,6 @@ func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
yys3 := string(yys3Slc) yys3 := string(yys3Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234) z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys3 { 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": case "requiredDuringSchedulingIgnoredDuringExecution":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
if x.RequiredDuringSchedulingIgnoredDuringExecution != nil { if x.RequiredDuringSchedulingIgnoredDuringExecution != nil {
@ -22241,12 +22206,12 @@ func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.PreferredDuringSchedulingIgnoredDuringExecution = nil x.PreferredDuringSchedulingIgnoredDuringExecution = nil
} else { } else {
yyv6 := &x.PreferredDuringSchedulingIgnoredDuringExecution yyv5 := &x.PreferredDuringSchedulingIgnoredDuringExecution
yym7 := z.DecBinary() yym6 := z.DecBinary()
_ = yym7 _ = yym6
if false { if false {
} else { } else {
h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv6), d) h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv5), d)
} }
} }
default: default:
@ -22260,37 +22225,16 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234 var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d) z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r _, _, _ = h, z, r
var yyj8 int var yyj7 int
var yyb8 bool var yyb7 bool
var yyhl8 bool = l >= 0 var yyhl7 bool = l >= 0
yyj8++ yyj7++
if yyhl8 { if yyhl7 {
yyb8 = yyj8 > l yyb7 = yyj7 > l
} else { } else {
yyb8 = r.CheckBreak() yyb7 = r.CheckBreak()
} }
if yyb8 { if yyb7 {
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 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -22305,13 +22249,13 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} }
x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d) x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d)
} }
yyj8++ yyj7++
if yyhl8 { if yyhl7 {
yyb8 = yyj8 > l yyb7 = yyj7 > l
} else { } else {
yyb8 = r.CheckBreak() yyb7 = r.CheckBreak()
} }
if yyb8 { if yyb7 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -22319,26 +22263,26 @@ func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.PreferredDuringSchedulingIgnoredDuringExecution = nil x.PreferredDuringSchedulingIgnoredDuringExecution = nil
} else { } else {
yyv11 := &x.PreferredDuringSchedulingIgnoredDuringExecution yyv9 := &x.PreferredDuringSchedulingIgnoredDuringExecution
yym12 := z.DecBinary() yym10 := z.DecBinary()
_ = yym12 _ = yym10
if false { if false {
} else { } else {
h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv11), d) h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv9), d)
} }
} }
for { for {
yyj8++ yyj7++
if yyhl8 { if yyhl7 {
yyb8 = yyj8 > l yyb7 = yyj7 > l
} else { } else {
yyb8 = r.CheckBreak() yyb7 = r.CheckBreak()
} }
if yyb8 { if yyb7 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj8-1, "") z.DecStructFieldNotFound(yyj7-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }

View File

@ -1381,24 +1381,23 @@ const (
NodeSelectorOpLt NodeSelectorOperator = "Lt" NodeSelectorOpLt NodeSelectorOperator = "Lt"
) )
// Affinity is a group of affinity scheduling requirements, // Affinity is a group of affinity scheduling rules, currently
// including node affinity and inter pod affinity. // only node affinity, but in the future also inter-pod affinity.
type Affinity struct { type Affinity struct {
// Describes node affinity scheduling requirements for the pod. // Describes node affinity scheduling rules for the pod.
NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"` NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"`
} }
// Node affinity is a group of node affinity scheduling requirements. // Node affinity is a group of node affinity scheduling rules.
// If RequiredDuringSchedulingRequiredDuringExecution and
// RequiredDuringSchedulingIgnoredDuringExecution are both set,
// then both node selectors must be satisfied.
type NodeAffinity struct { 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 // If the affinity requirements specified by this field are not met at
// scheduling time, the pod will not be scheduled onto the node. // scheduling time, the pod will not be scheduled onto the node.
// If the affinity requirements specified by this field cease to be met // 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 // at some point during pod execution (e.g. due to an update), the system
// will try to eventually evict the pod from its node. // 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 // If the affinity requirements specified by this field are not met at
// scheduling time, the pod will not be scheduled onto the node. // scheduling time, the pod will not be scheduled onto the node.
// If the affinity requirements specified by this field cease to be met // If the affinity requirements specified by this field cease to be met

View File

@ -40,8 +40,8 @@ func (AWSElasticBlockStoreVolumeSource) SwaggerDoc() map[string]string {
} }
var map_Affinity = map[string]string{ var map_Affinity = map[string]string{
"": "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.",
"nodeAffinity": "Describes node affinity scheduling requirements for the pod.", "nodeAffinity": "Describes node affinity scheduling rules for the pod.",
} }
func (Affinity) SwaggerDoc() map[string]string { func (Affinity) SwaggerDoc() map[string]string {
@ -771,8 +771,7 @@ func (NodeAddress) SwaggerDoc() map[string]string {
} }
var map_NodeAffinity = 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.", "": "Node affinity is a group of node affinity scheduling rules.",
"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.",
"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.", "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.", "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.",
} }

View File

@ -1451,9 +1451,11 @@ func ValidateAffinityInPodAnnotations(annotations map[string]string, fldPath *fi
if affinity.NodeAffinity != nil { if affinity.NodeAffinity != nil {
na := affinity.NodeAffinity 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 { if na.RequiredDuringSchedulingIgnoredDuringExecution != nil {
allErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingIgnoredDuringExecution, fldPath.Child("requiredDuringSchedulingIgnoredDuringExecution"))...) allErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingIgnoredDuringExecution, fldPath.Child("requiredDuringSchedulingIgnoredDuringExecution"))...)

View File

@ -1739,17 +1739,19 @@ func TestValidatePod(t *testing.T) {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "123", Name: "123",
Namespace: "ns", 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{ Annotations: map[string]string{
api.AffinityAnnotationKey: ` api.AffinityAnnotationKey: `
{"nodeAffinity": { {"nodeAffinity": {
"requiredDuringSchedulingRequiredDuringExecution": {
"nodeSelectorTerms": [{
"matchExpressions": [{
"key": "key1",
"operator": "Exists"
}]
}]
},
"requiredDuringSchedulingIgnoredDuringExecution": { "requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [{ "nodeSelectorTerms": [{
"matchExpressions": [{ "matchExpressions": [{
@ -1830,7 +1832,7 @@ func TestValidatePod(t *testing.T) {
Annotations: map[string]string{ Annotations: map[string]string{
api.AffinityAnnotationKey: ` api.AffinityAnnotationKey: `
{"nodeAffinity": { {"nodeAffinity": {
"requiredDuringSchedulingRequiredDuringExecution": { "requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [{ "nodeSelectorTerms": [{
`, `,
}, },
@ -1847,7 +1849,7 @@ func TestValidatePod(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Annotations: map[string]string{ Annotations: map[string]string{
api.AffinityAnnotationKey: ` api.AffinityAnnotationKey: `
{"nodeAffinity": {"requiredDuringSchedulingRequiredDuringExecution": { {"nodeAffinity": {"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [{ "nodeSelectorTerms": [{
"matchExpressions": [{ "matchExpressions": [{
"key": "key1", "key": "key1",
@ -1888,14 +1890,14 @@ func TestValidatePod(t *testing.T) {
DNSPolicy: api.DNSClusterFirst, 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{ ObjectMeta: api.ObjectMeta{
Name: "123", Name: "123",
Namespace: "ns", Namespace: "ns",
Annotations: map[string]string{ Annotations: map[string]string{
api.AffinityAnnotationKey: ` api.AffinityAnnotationKey: `
{"nodeAffinity": { {"nodeAffinity": {
"requiredDuringSchedulingRequiredDuringExecution": { "requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [] "nodeSelectorTerms": []
}, },
}}`, }}`,
@ -1907,14 +1909,14 @@ func TestValidatePod(t *testing.T) {
DNSPolicy: api.DNSClusterFirst, 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{ ObjectMeta: api.ObjectMeta{
Name: "123", Name: "123",
Namespace: "ns", Namespace: "ns",
Annotations: map[string]string{ Annotations: map[string]string{
api.AffinityAnnotationKey: ` api.AffinityAnnotationKey: `
{"nodeAffinity": { {"nodeAffinity": {
"requiredDuringSchedulingRequiredDuringExecution": { "requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [{ "nodeSelectorTerms": [{
"matchExpressions": [] "matchExpressions": []
}] }]

View File

@ -513,18 +513,21 @@ func PodMatchesNodeLabels(pod *api.Pod, node *api.Node) bool {
if affinity.NodeAffinity != nil { if affinity.NodeAffinity != nil {
nodeAffinity := affinity.NodeAffinity nodeAffinity := affinity.NodeAffinity
// if no required NodeAffinity requirements, will do no-op, means select all nodes. // 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 return true
} }
// Match node selector for requiredDuringSchedulingRequiredDuringExecution. // Match node selector for requiredDuringSchedulingRequiredDuringExecution.
if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution != nil { // TODO: Uncomment this block when implement RequiredDuringSchedulingRequiredDuringExecution.
nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution.NodeSelectorTerms // if nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution != nil {
glog.V(10).Infof("Match for RequiredDuringSchedulingRequiredDuringExecution node selector terms %+v", nodeSelectorTerms) // nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingRequiredDuringExecution.NodeSelectorTerms
nodeAffinityMatches = NodeMatchesNodeSelectorTerms(node, 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 { if nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution != nil {
nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms nodeSelectorTerms := nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms
glog.V(10).Infof("Match for RequiredDuringSchedulingIgnoredDuringExecution node selector terms %+v", nodeSelectorTerms) glog.V(10).Infof("Match for RequiredDuringSchedulingIgnoredDuringExecution node selector terms %+v", nodeSelectorTerms)

View File

@ -881,41 +881,42 @@ func TestPodFitsSelector(t *testing.T) {
fits: true, fits: true,
test: "Pod with multiple NodeSelectorTerms ORed in affinity, matches the node's labels and will schedule onto the node", test: "Pod with multiple NodeSelectorTerms ORed in affinity, matches the node's labels and will schedule onto the node",
}, },
{ // TODO: Uncomment this test when implement RequiredDuringSchedulingRequiredDuringExecution
pod: &api.Pod{ // {
ObjectMeta: api.ObjectMeta{ // pod: &api.Pod{
Annotations: map[string]string{ // ObjectMeta: api.ObjectMeta{
api.AffinityAnnotationKey: ` // Annotations: map[string]string{
{"nodeAffinity": { // api.AffinityAnnotationKey: `
"requiredDuringSchedulingRequiredDuringExecution": { // {"nodeAffinity": {
"nodeSelectorTerms": [{ // "requiredDuringSchedulingRequiredDuringExecution": {
"matchExpressions": [{ // "nodeSelectorTerms": [{
"key": "foo", // "matchExpressions": [{
"operator": "In", // "key": "foo",
"values": ["bar", "value2"] // "operator": "In",
}] // "values": ["bar", "value2"]
}] // }]
}, // }]
"requiredDuringSchedulingIgnoredDuringExecution": { // },
"nodeSelectorTerms": [{ // "requiredDuringSchedulingIgnoredDuringExecution": {
"matchExpressions": [{ // "nodeSelectorTerms": [{
"key": "foo", // "matchExpressions": [{
"operator": "NotIn", // "key": "foo",
"values": ["bar", "value2"] // "operator": "NotIn",
}] // "values": ["bar", "value2"]
}] // }]
} // }]
}}`, // }
}, // }}`,
}, // },
}, // },
labels: map[string]string{ // },
"foo": "bar", // labels: map[string]string{
}, // "foo": "bar",
fits: false, // },
test: "Pod with an Affinity both requiredDuringSchedulingRequiredDuringExecution and " + // fits: false,
"requiredDuringSchedulingIgnoredDuringExecution indicated that don't match node's labels and won't schedule onto the node", // 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{ pod: &api.Pod{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{

View File

@ -419,7 +419,7 @@ var _ = Describe("SchedulerPredicates [Serial]", func() {
Annotations: map[string]string{ Annotations: map[string]string{
api.AffinityAnnotationKey: ` api.AffinityAnnotationKey: `
{"nodeAffinity": { {"nodeAffinity": {
"requiredDuringSchedulingRequiredDuringExecution": { "requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [{ "nodeSelectorTerms": [{
"matchExpressions": [] "matchExpressions": []
}] }]