Merge pull request #39469 from kevin-wangzefeng/forgiveness-API-changes

Automatic merge from submit-queue (batch tested with PRs 39469, 40557)

Forgiveness api changes

**What this PR does / why we need it**:
Splited from #34825 , contains api changes that are needed to implement forgiveness:
1. update toleration api types to support forgiveness, added a new field forgivenessSeconds to indicate the duration of time it tolerates a taint.
2. update taint api types, added a new field to indicate the time the taint is added.

**Which issue this PR fixes** : 
Related issue: #1574
Related PR: #34825 

**Special notes for your reviewer**:

**Release note**:

```release-note
forgiveness alpha version api definition
```
This commit is contained in:
Kubernetes Submit Queue 2017-01-27 10:38:31 -08:00 committed by GitHub
commit 760a51f03a
15 changed files with 1298 additions and 882 deletions

View File

@ -1783,8 +1783,12 @@ type Taint struct {
Value string Value string
// Required. The effect of the taint on pods // Required. The effect of the taint on pods
// that do not tolerate the taint. // that do not tolerate the taint.
// Valid effects are NoSchedule and PreferNoSchedule. // Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
Effect TaintEffect Effect TaintEffect
// TimeAdded represents the time at which the taint was added.
// It is only written for NoExecute taints.
// +optional
TimeAdded metav1.Time
} }
type TaintEffect string type TaintEffect string
@ -1800,26 +1804,23 @@ const (
// onto the node entirely. Enforced by the scheduler. // onto the node entirely. Enforced by the scheduler.
TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule" TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule"
// NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented.
// Do not allow new pods to schedule onto the node unless they tolerate the taint, // Like TaintEffectNoSchedule, but additionally do not allow pods submitted to
// do not allow pods to start on Kubelet unless they tolerate the taint, // Kubelet without going through the scheduler to start.
// but allow all already-running pods to continue running. // Enforced by Kubelet and the scheduler.
// Enforced by the scheduler and Kubelet.
// TaintEffectNoScheduleNoAdmit TaintEffect = "NoScheduleNoAdmit" // TaintEffectNoScheduleNoAdmit TaintEffect = "NoScheduleNoAdmit"
// NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. // Evict any already-running pods that do not tolerate the taint.
// Do not allow new pods to schedule onto the node unless they tolerate the taint, // Currently enforced by NodeController.
// do not allow pods to start on Kubelet unless they tolerate the taint, TaintEffectNoExecute TaintEffect = "NoExecute"
// and evict any already-running pods that do not tolerate the taint.
// Enforced by the scheduler and Kubelet.
// TaintEffectNoScheduleNoAdmitNoExecute = "NoScheduleNoAdmitNoExecute"
) )
// The pod this Toleration is attached to tolerates any taint that matches // The pod this Toleration is attached to tolerates any taint that matches
// the triple <key,value,effect> using the matching operator <operator>. // the triple <key,value,effect> using the matching operator <operator>.
type Toleration struct { type Toleration struct {
// Required. Key is the taint key that the toleration applies to. // Key is the taint key that the toleration applies to. Empty means match all taint keys.
// If the key is empty, operator must be Exists; this combination means to match all values and all keys.
// +optional // +optional
Key string Key string
// operator represents a key's relationship to the value. // Operator represents a key's relationship to the value.
// Valid operators are Exists and Equal. Defaults to Equal. // Valid operators are Exists and Equal. Defaults to Equal.
// Exists is equivalent to wildcard for value, so that a pod can // Exists is equivalent to wildcard for value, so that a pod can
// tolerate all taints of a particular category. // tolerate all taints of a particular category.
@ -1830,11 +1831,15 @@ type Toleration struct {
// +optional // +optional
Value string Value string
// Effect indicates the taint effect to match. Empty means match all taint effects. // Effect indicates the taint effect to match. Empty means match all taint effects.
// When specified, allowed values are NoSchedule and PreferNoSchedule. // When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
// +optional // +optional
Effect TaintEffect Effect TaintEffect
// TODO: For forgiveness (#1574), we'd eventually add at least a grace period // TolerationSeconds represents the period of time the toleration (which must be
// here, and possibly an occurrence threshold and period. // of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
// it is not set, which means tolerate the taint forever (do not evict). Zero and
// negative values will be treated as 0 (evict immediately) by the system.
// +optional
TolerationSeconds *int64
} }
// A toleration operator is the set of operators that can be used in a toleration. // A toleration operator is the set of operators that can be used in a toleration.

File diff suppressed because it is too large Load Diff

View File

@ -3480,18 +3480,24 @@ message Taint {
// Required. The effect of the taint on pods // Required. The effect of the taint on pods
// that do not tolerate the taint. // that do not tolerate the taint.
// Valid effects are NoSchedule and PreferNoSchedule. // Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
optional string effect = 3; optional string effect = 3;
// TimeAdded represents the time at which the taint was added.
// It is only written for NoExecute taints.
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time timeAdded = 4;
} }
// The pod this Toleration is attached to tolerates any taint that matches // The pod this Toleration is attached to tolerates any taint that matches
// the triple <key,value,effect> using the matching operator <operator>. // the triple <key,value,effect> using the matching operator <operator>.
message Toleration { message Toleration {
// Required. Key is the taint key that the toleration applies to. // Key is the taint key that the toleration applies to. Empty means match all taint keys.
// If the key is empty, operator must be Exists; this combination means to match all values and all keys.
// +optional // +optional
optional string key = 1; optional string key = 1;
// operator represents a key's relationship to the value. // Operator represents a key's relationship to the value.
// Valid operators are Exists and Equal. Defaults to Equal. // Valid operators are Exists and Equal. Defaults to Equal.
// Exists is equivalent to wildcard for value, so that a pod can // Exists is equivalent to wildcard for value, so that a pod can
// tolerate all taints of a particular category. // tolerate all taints of a particular category.
@ -3504,9 +3510,16 @@ message Toleration {
optional string value = 3; optional string value = 3;
// Effect indicates the taint effect to match. Empty means match all taint effects. // Effect indicates the taint effect to match. Empty means match all taint effects.
// When specified, allowed values are NoSchedule and PreferNoSchedule. // When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
// +optional // +optional
optional string effect = 4; optional string effect = 4;
// TolerationSeconds represents the period of time the toleration (which must be
// of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
// it is not set, which means tolerate the taint forever (do not evict). Zero and
// negative values will be treated as 0 (evict immediately) by the system.
// +optional
optional int64 tolerationSeconds = 5;
} }
// Volume represents a named volume in a pod that may be accessed by any container in the pod. // Volume represents a named volume in a pod that may be accessed by any container in the pod.

View File

@ -29903,13 +29903,14 @@ func (x *Taint) 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 [4]bool
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[1] = x.Value != "" yyq2[1] = x.Value != ""
yyq2[3] = true
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(3) r.EncodeArrayStart(4)
} else { } else {
yynn2 = 2 yynn2 = 2
for _, b := range yyq2 { for _, b := range yyq2 {
@ -29973,6 +29974,43 @@ func (x *Taint) CodecEncodeSelf(e *codec1978.Encoder) {
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
x.Effect.CodecEncodeSelf(e) x.Effect.CodecEncodeSelf(e)
} }
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
yy13 := &x.TimeAdded
yym14 := z.EncBinary()
_ = yym14
if false {
} else if z.HasExtensions() && z.EncExt(yy13) {
} else if yym14 {
z.EncBinaryMarshal(yy13)
} else if !yym14 && z.IsJSONHandle() {
z.EncJSONMarshal(yy13)
} else {
z.EncFallback(yy13)
}
} else {
r.EncodeNil()
}
} else {
if yyq2[3] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("timeAdded"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy15 := &x.TimeAdded
yym16 := z.EncBinary()
_ = yym16
if false {
} else if z.HasExtensions() && z.EncExt(yy15) {
} else if yym16 {
z.EncBinaryMarshal(yy15)
} else if !yym16 && z.IsJSONHandle() {
z.EncJSONMarshal(yy15)
} else {
z.EncFallback(yy15)
}
}
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234) z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else { } else {
@ -30065,6 +30103,23 @@ func (x *Taint) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
yyv8 := &x.Effect yyv8 := &x.Effect
yyv8.CodecDecodeSelf(d) yyv8.CodecDecodeSelf(d)
} }
case "timeAdded":
if r.TryDecodeAsNil() {
x.TimeAdded = pkg2_v1.Time{}
} else {
yyv9 := &x.TimeAdded
yym10 := z.DecBinary()
_ = yym10
if false {
} else if z.HasExtensions() && z.DecExt(yyv9) {
} else if yym10 {
z.DecBinaryUnmarshal(yyv9)
} else if !yym10 && z.IsJSONHandle() {
z.DecJSONUnmarshal(yyv9)
} else {
z.DecFallback(yyv9, false)
}
}
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3 } // end switch yys3
@ -30076,16 +30131,16 @@ func (x *Taint) 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 yyj9 int var yyj11 int
var yyb9 bool var yyb11 bool
var yyhl9 bool = l >= 0 var yyhl11 bool = l >= 0
yyj9++ yyj11++
if yyhl9 { if yyhl11 {
yyb9 = yyj9 > l yyb11 = yyj11 > l
} else { } else {
yyb9 = r.CheckBreak() yyb11 = r.CheckBreak()
} }
if yyb9 { if yyb11 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -30093,29 +30148,7 @@ func (x *Taint) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Key = "" x.Key = ""
} else { } else {
yyv10 := &x.Key yyv12 := &x.Key
yym11 := z.DecBinary()
_ = yym11
if false {
} else {
*((*string)(yyv10)) = r.DecodeString()
}
}
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb9 = r.CheckBreak()
}
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Value = ""
} else {
yyv12 := &x.Value
yym13 := z.DecBinary() yym13 := z.DecBinary()
_ = yym13 _ = yym13
if false { if false {
@ -30123,13 +30156,35 @@ func (x *Taint) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
*((*string)(yyv12)) = r.DecodeString() *((*string)(yyv12)) = r.DecodeString()
} }
} }
yyj9++ yyj11++
if yyhl9 { if yyhl11 {
yyb9 = yyj9 > l yyb11 = yyj11 > l
} else { } else {
yyb9 = r.CheckBreak() yyb11 = r.CheckBreak()
} }
if yyb9 { if yyb11 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Value = ""
} else {
yyv14 := &x.Value
yym15 := z.DecBinary()
_ = yym15
if false {
} else {
*((*string)(yyv14)) = r.DecodeString()
}
}
yyj11++
if yyhl11 {
yyb11 = yyj11 > l
} else {
yyb11 = r.CheckBreak()
}
if yyb11 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -30137,21 +30192,48 @@ func (x *Taint) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Effect = "" x.Effect = ""
} else { } else {
yyv14 := &x.Effect yyv16 := &x.Effect
yyv14.CodecDecodeSelf(d) yyv16.CodecDecodeSelf(d)
}
yyj11++
if yyhl11 {
yyb11 = yyj11 > l
} else {
yyb11 = r.CheckBreak()
}
if yyb11 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.TimeAdded = pkg2_v1.Time{}
} else {
yyv17 := &x.TimeAdded
yym18 := z.DecBinary()
_ = yym18
if false {
} else if z.HasExtensions() && z.DecExt(yyv17) {
} else if yym18 {
z.DecBinaryUnmarshal(yyv17)
} else if !yym18 && z.IsJSONHandle() {
z.DecJSONUnmarshal(yyv17)
} else {
z.DecFallback(yyv17, false)
}
} }
for { for {
yyj9++ yyj11++
if yyhl9 { if yyhl11 {
yyb9 = yyj9 > l yyb11 = yyj11 > l
} else { } else {
yyb9 = r.CheckBreak() yyb11 = r.CheckBreak()
} }
if yyb9 { if yyb11 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj9-1, "") z.DecStructFieldNotFound(yyj11-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }
@ -30196,16 +30278,17 @@ func (x *Toleration) CodecEncodeSelf(e *codec1978.Encoder) {
} else { } else {
yysep2 := !z.EncBinary() yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [4]bool var yyq2 [5]bool
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[0] = x.Key != "" yyq2[0] = x.Key != ""
yyq2[1] = x.Operator != "" yyq2[1] = x.Operator != ""
yyq2[2] = x.Value != "" yyq2[2] = x.Value != ""
yyq2[3] = x.Effect != "" yyq2[3] = x.Effect != ""
yyq2[4] = x.TolerationSeconds != nil
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(4) r.EncodeArrayStart(5)
} else { } else {
yynn2 = 0 yynn2 = 0
for _, b := range yyq2 { for _, b := range yyq2 {
@ -30296,6 +30379,41 @@ func (x *Toleration) CodecEncodeSelf(e *codec1978.Encoder) {
x.Effect.CodecEncodeSelf(e) x.Effect.CodecEncodeSelf(e)
} }
} }
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
if x.TolerationSeconds == nil {
r.EncodeNil()
} else {
yy16 := *x.TolerationSeconds
yym17 := z.EncBinary()
_ = yym17
if false {
} else {
r.EncodeInt(int64(yy16))
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("tolerationSeconds"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.TolerationSeconds == nil {
r.EncodeNil()
} else {
yy18 := *x.TolerationSeconds
yym19 := z.EncBinary()
_ = yym19
if false {
} else {
r.EncodeInt(int64(yy18))
}
}
}
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234) z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else { } else {
@ -30395,6 +30513,22 @@ func (x *Toleration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
yyv9 := &x.Effect yyv9 := &x.Effect
yyv9.CodecDecodeSelf(d) yyv9.CodecDecodeSelf(d)
} }
case "tolerationSeconds":
if r.TryDecodeAsNil() {
if x.TolerationSeconds != nil {
x.TolerationSeconds = nil
}
} else {
if x.TolerationSeconds == nil {
x.TolerationSeconds = new(int64)
}
yym11 := z.DecBinary()
_ = yym11
if false {
} else {
*((*int64)(x.TolerationSeconds)) = int64(r.DecodeInt(64))
}
}
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3 } // end switch yys3
@ -30406,16 +30540,16 @@ func (x *Toleration) 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 yyj10 int var yyj12 int
var yyb10 bool var yyb12 bool
var yyhl10 bool = l >= 0 var yyhl12 bool = l >= 0
yyj10++ yyj12++
if yyhl10 { if yyhl12 {
yyb10 = yyj10 > l yyb12 = yyj12 > l
} else { } else {
yyb10 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb10 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -30423,21 +30557,21 @@ func (x *Toleration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Key = "" x.Key = ""
} else { } else {
yyv11 := &x.Key yyv13 := &x.Key
yym12 := z.DecBinary() yym14 := z.DecBinary()
_ = yym12 _ = yym14
if false { if false {
} else { } else {
*((*string)(yyv11)) = r.DecodeString() *((*string)(yyv13)) = r.DecodeString()
} }
} }
yyj10++ yyj12++
if yyhl10 { if yyhl12 {
yyb10 = yyj10 > l yyb12 = yyj12 > l
} else { } else {
yyb10 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb10 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -30445,16 +30579,16 @@ func (x *Toleration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Operator = "" x.Operator = ""
} else { } else {
yyv13 := &x.Operator yyv15 := &x.Operator
yyv13.CodecDecodeSelf(d) yyv15.CodecDecodeSelf(d)
} }
yyj10++ yyj12++
if yyhl10 { if yyhl12 {
yyb10 = yyj10 > l yyb12 = yyj12 > l
} else { } else {
yyb10 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb10 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -30462,21 +30596,21 @@ func (x *Toleration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Value = "" x.Value = ""
} else { } else {
yyv14 := &x.Value yyv16 := &x.Value
yym15 := z.DecBinary() yym17 := z.DecBinary()
_ = yym15 _ = yym17
if false { if false {
} else { } else {
*((*string)(yyv14)) = r.DecodeString() *((*string)(yyv16)) = r.DecodeString()
} }
} }
yyj10++ yyj12++
if yyhl10 { if yyhl12 {
yyb10 = yyj10 > l yyb12 = yyj12 > l
} else { } else {
yyb10 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb10 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -30484,21 +30618,47 @@ func (x *Toleration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Effect = "" x.Effect = ""
} else { } else {
yyv16 := &x.Effect yyv18 := &x.Effect
yyv16.CodecDecodeSelf(d) yyv18.CodecDecodeSelf(d)
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
} else {
yyb12 = r.CheckBreak()
}
if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
if x.TolerationSeconds != nil {
x.TolerationSeconds = nil
}
} else {
if x.TolerationSeconds == nil {
x.TolerationSeconds = new(int64)
}
yym20 := z.DecBinary()
_ = yym20
if false {
} else {
*((*int64)(x.TolerationSeconds)) = int64(r.DecodeInt(64))
}
} }
for { for {
yyj10++ yyj12++
if yyhl10 { if yyhl12 {
yyb10 = yyj10 > l yyb12 = yyj12 > l
} else { } else {
yyb10 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb10 { if yyb12 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj10-1, "") z.DecStructFieldNotFound(yyj12-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }

View File

@ -2002,8 +2002,12 @@ type Taint struct {
Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
// Required. The effect of the taint on pods // Required. The effect of the taint on pods
// that do not tolerate the taint. // that do not tolerate the taint.
// Valid effects are NoSchedule and PreferNoSchedule. // Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
Effect TaintEffect `json:"effect" protobuf:"bytes,3,opt,name=effect,casttype=TaintEffect"` Effect TaintEffect `json:"effect" protobuf:"bytes,3,opt,name=effect,casttype=TaintEffect"`
// TimeAdded represents the time at which the taint was added.
// It is only written for NoExecute taints.
// +optional
TimeAdded metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"`
} }
type TaintEffect string type TaintEffect string
@ -2019,26 +2023,23 @@ const (
// onto the node entirely. Enforced by the scheduler. // onto the node entirely. Enforced by the scheduler.
TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule" TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule"
// NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented.
// Do not allow new pods to schedule onto the node unless they tolerate the taint, // Like TaintEffectNoSchedule, but additionally do not allow pods submitted to
// do not allow pods to start on Kubelet unless they tolerate the taint, // Kubelet without going through the scheduler to start.
// but allow all already-running pods to continue running. // Enforced by Kubelet and the scheduler.
// Enforced by the scheduler and Kubelet.
// TaintEffectNoScheduleNoAdmit TaintEffect = "NoScheduleNoAdmit" // TaintEffectNoScheduleNoAdmit TaintEffect = "NoScheduleNoAdmit"
// NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. // Evict any already-running pods that do not tolerate the taint.
// Do not allow new pods to schedule onto the node unless they tolerate the taint, // Currently enforced by NodeController.
// do not allow pods to start on Kubelet unless they tolerate the taint, TaintEffectNoExecute TaintEffect = "NoExecute"
// and evict any already-running pods that do not tolerate the taint.
// Enforced by the scheduler and Kubelet.
// TaintEffectNoScheduleNoAdmitNoExecute = "NoScheduleNoAdmitNoExecute"
) )
// The pod this Toleration is attached to tolerates any taint that matches // The pod this Toleration is attached to tolerates any taint that matches
// the triple <key,value,effect> using the matching operator <operator>. // the triple <key,value,effect> using the matching operator <operator>.
type Toleration struct { type Toleration struct {
// Required. Key is the taint key that the toleration applies to. // Key is the taint key that the toleration applies to. Empty means match all taint keys.
// If the key is empty, operator must be Exists; this combination means to match all values and all keys.
// +optional // +optional
Key string `json:"key,omitempty" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"` Key string `json:"key,omitempty" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
// operator represents a key's relationship to the value. // Operator represents a key's relationship to the value.
// Valid operators are Exists and Equal. Defaults to Equal. // Valid operators are Exists and Equal. Defaults to Equal.
// Exists is equivalent to wildcard for value, so that a pod can // Exists is equivalent to wildcard for value, so that a pod can
// tolerate all taints of a particular category. // tolerate all taints of a particular category.
@ -2049,11 +2050,15 @@ type Toleration struct {
// +optional // +optional
Value string `json:"value,omitempty" protobuf:"bytes,3,opt,name=value"` Value string `json:"value,omitempty" protobuf:"bytes,3,opt,name=value"`
// Effect indicates the taint effect to match. Empty means match all taint effects. // Effect indicates the taint effect to match. Empty means match all taint effects.
// When specified, allowed values are NoSchedule and PreferNoSchedule. // When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
// +optional // +optional
Effect TaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=TaintEffect"` Effect TaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=TaintEffect"`
// TODO: For forgiveness (#1574), we'd eventually add at least a grace period // TolerationSeconds represents the period of time the toleration (which must be
// here, and possibly an occurrence threshold and period. // of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
// it is not set, which means tolerate the taint forever (do not evict). Zero and
// negative values will be treated as 0 (evict immediately) by the system.
// +optional
TolerationSeconds *int64 `json:"tolerationSeconds,omitempty" protobuf:"varint,5,opt,name=tolerationSeconds"`
} }
// A toleration operator is the set of operators that can be used in a toleration. // A toleration operator is the set of operators that can be used in a toleration.

View File

@ -1767,10 +1767,11 @@ func (TCPSocketAction) SwaggerDoc() map[string]string {
} }
var map_Taint = map[string]string{ var map_Taint = map[string]string{
"": "The node this Taint is attached to has the effect \"effect\" on any pod that that does not tolerate the Taint.", "": "The node this Taint is attached to has the effect \"effect\" on any pod that that does not tolerate the Taint.",
"key": "Required. The taint key to be applied to a node.", "key": "Required. The taint key to be applied to a node.",
"value": "Required. The taint value corresponding to the taint key.", "value": "Required. The taint value corresponding to the taint key.",
"effect": "Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule and PreferNoSchedule.", "effect": "Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute.",
"timeAdded": "TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints.",
} }
func (Taint) SwaggerDoc() map[string]string { func (Taint) SwaggerDoc() map[string]string {
@ -1778,11 +1779,12 @@ func (Taint) SwaggerDoc() map[string]string {
} }
var map_Toleration = map[string]string{ var map_Toleration = map[string]string{
"": "The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator <operator>.", "": "The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator <operator>.",
"key": "Required. Key is the taint key that the toleration applies to.", "key": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.",
"operator": "operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.", "operator": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.",
"value": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.", "value": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.",
"effect": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule and PreferNoSchedule.", "effect": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.",
"tolerationSeconds": "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.",
} }
func (Toleration) SwaggerDoc() map[string]string { func (Toleration) SwaggerDoc() map[string]string {

View File

@ -4203,6 +4203,7 @@ func autoConvert_v1_Taint_To_api_Taint(in *Taint, out *api.Taint, s conversion.S
out.Key = in.Key out.Key = in.Key
out.Value = in.Value out.Value = in.Value
out.Effect = api.TaintEffect(in.Effect) out.Effect = api.TaintEffect(in.Effect)
out.TimeAdded = in.TimeAdded
return nil return nil
} }
@ -4214,6 +4215,7 @@ func autoConvert_api_Taint_To_v1_Taint(in *api.Taint, out *Taint, s conversion.S
out.Key = in.Key out.Key = in.Key
out.Value = in.Value out.Value = in.Value
out.Effect = TaintEffect(in.Effect) out.Effect = TaintEffect(in.Effect)
out.TimeAdded = in.TimeAdded
return nil return nil
} }
@ -4226,6 +4228,7 @@ func autoConvert_v1_Toleration_To_api_Toleration(in *Toleration, out *api.Tolera
out.Operator = api.TolerationOperator(in.Operator) out.Operator = api.TolerationOperator(in.Operator)
out.Value = in.Value out.Value = in.Value
out.Effect = api.TaintEffect(in.Effect) out.Effect = api.TaintEffect(in.Effect)
out.TolerationSeconds = (*int64)(unsafe.Pointer(in.TolerationSeconds))
return nil return nil
} }
@ -4238,6 +4241,7 @@ func autoConvert_api_Toleration_To_v1_Toleration(in *api.Toleration, out *Tolera
out.Operator = TolerationOperator(in.Operator) out.Operator = TolerationOperator(in.Operator)
out.Value = in.Value out.Value = in.Value
out.Effect = TaintEffect(in.Effect) out.Effect = TaintEffect(in.Effect)
out.TolerationSeconds = (*int64)(unsafe.Pointer(in.TolerationSeconds))
return nil return nil
} }

View File

@ -3070,6 +3070,7 @@ func DeepCopy_v1_Taint(in interface{}, out interface{}, c *conversion.Cloner) er
in := in.(*Taint) in := in.(*Taint)
out := out.(*Taint) out := out.(*Taint)
*out = *in *out = *in
out.TimeAdded = in.TimeAdded.DeepCopy()
return nil return nil
} }
} }
@ -3079,6 +3080,11 @@ func DeepCopy_v1_Toleration(in interface{}, out interface{}, c *conversion.Clone
in := in.(*Toleration) in := in.(*Toleration)
out := out.(*Toleration) out := out.(*Toleration)
*out = *in *out = *in
if in.TolerationSeconds != nil {
in, out := &in.TolerationSeconds, &out.TolerationSeconds
*out = new(int64)
**out = **in
}
return nil return nil
} }
} }

View File

@ -1718,16 +1718,16 @@ func validateTaintEffect(effect *api.TaintEffect, allowEmpty bool, fldPath *fiel
allErrors := field.ErrorList{} allErrors := field.ErrorList{}
switch *effect { switch *effect {
// TODO: Replace next line with subsequent commented-out line when implement TaintEffectNoScheduleNoAdmit, TaintEffectNoScheduleNoAdmitNoExecute. // TODO: Replace next line with subsequent commented-out line when implement TaintEffectNoScheduleNoAdmit.
case api.TaintEffectNoSchedule, api.TaintEffectPreferNoSchedule: case api.TaintEffectNoSchedule, api.TaintEffectPreferNoSchedule, api.TaintEffectNoExecute:
// case api.TaintEffectNoSchedule, api.TaintEffectPreferNoSchedule, api.TaintEffectNoScheduleNoAdmit, api.TaintEffectNoScheduleNoAdmitNoExecute: // case api.TaintEffectNoSchedule, api.TaintEffectPreferNoSchedule, api.TaintEffectNoScheduleNoAdmit, api.TaintEffectNoExecute:
default: default:
validValues := []string{ validValues := []string{
string(api.TaintEffectNoSchedule), string(api.TaintEffectNoSchedule),
string(api.TaintEffectPreferNoSchedule), string(api.TaintEffectPreferNoSchedule),
// TODO: Uncomment this block when implement TaintEffectNoScheduleNoAdmit, TaintEffectNoScheduleNoAdmitNoExecute. string(api.TaintEffectNoExecute),
// TODO: Uncomment this block when implement TaintEffectNoScheduleNoAdmit.
// string(api.TaintEffectNoScheduleNoAdmit), // string(api.TaintEffectNoScheduleNoAdmit),
// string(api.TaintEffectNoScheduleNoAdmitNoExecute),
} }
allErrors = append(allErrors, field.NotSupported(fldPath, effect, validValues)) allErrors = append(allErrors, field.NotSupported(fldPath, effect, validValues))
} }
@ -1740,10 +1740,24 @@ func validateTolerations(tolerations []api.Toleration, fldPath *field.Path) fiel
for i, toleration := range tolerations { for i, toleration := range tolerations {
idxPath := fldPath.Index(i) idxPath := fldPath.Index(i)
// validate the toleration key // validate the toleration key
allErrors = append(allErrors, unversionedvalidation.ValidateLabelName(toleration.Key, idxPath.Child("key"))...) if len(toleration.Key) > 0 {
allErrors = append(allErrors, unversionedvalidation.ValidateLabelName(toleration.Key, idxPath.Child("key"))...)
}
// empty toleration key with Exists operator and empty value means match all taints
if len(toleration.Key) == 0 && toleration.Operator != api.TolerationOpExists {
allErrors = append(allErrors, field.Invalid(idxPath.Child("operator"), toleration.Operator,
"operator must be Exists when `key` is empty, which means \"match all values and all keys\""))
}
if toleration.TolerationSeconds != nil && toleration.Effect != api.TaintEffectNoExecute {
allErrors = append(allErrors, field.Invalid(idxPath.Child("effect"), toleration.Effect,
"effect must be 'NoExecute' when `tolerationSeconds` is set"))
}
// validate toleration operator and value // validate toleration operator and value
switch toleration.Operator { switch toleration.Operator {
// empty operator means Equal
case api.TolerationOpEqual, "": case api.TolerationOpEqual, "":
if errs := validation.IsValidLabelValue(toleration.Value); len(errs) != 0 { if errs := validation.IsValidLabelValue(toleration.Value); len(errs) != 0 {
allErrors = append(allErrors, field.Invalid(idxPath.Child("operator"), toleration.Value, strings.Join(errs, ";"))) allErrors = append(allErrors, field.Invalid(idxPath.Child("operator"), toleration.Value, strings.Join(errs, ";")))
@ -1757,7 +1771,7 @@ func validateTolerations(tolerations []api.Toleration, fldPath *field.Path) fiel
allErrors = append(allErrors, field.NotSupported(idxPath.Child("operator"), toleration.Operator, validValues)) allErrors = append(allErrors, field.NotSupported(idxPath.Child("operator"), toleration.Operator, validValues))
} }
// validate toleration effect // validate toleration effect, empty toleration effect means match all taint effects
if len(toleration.Effect) > 0 { if len(toleration.Effect) > 0 {
allErrors = append(allErrors, validateTaintEffect(&toleration.Effect, true, idxPath.Child("effect"))...) allErrors = append(allErrors, validateTaintEffect(&toleration.Effect, true, idxPath.Child("effect"))...)
} }

View File

@ -3378,6 +3378,40 @@ func TestValidatePod(t *testing.T) {
}, },
}), }),
}, },
{ // populate forgiveness tolerations with exists operator in annotations.
ObjectMeta: metav1.ObjectMeta{
Name: "123",
Namespace: "ns",
Annotations: map[string]string{
api.TolerationsAnnotationKey: `
[{
"key": "foo",
"operator": "Exists",
"value": "",
"effect": "NoExecute",
"tolerationSeconds": 60
}]`,
},
},
Spec: validPodSpec(nil),
},
{ // populate forgiveness tolerations with equal operator in annotations.
ObjectMeta: metav1.ObjectMeta{
Name: "123",
Namespace: "ns",
Annotations: map[string]string{
api.TolerationsAnnotationKey: `
[{
"key": "foo",
"operator": "Equal",
"value": "bar",
"effect": "NoExecute",
"tolerationSeconds": 60
}]`,
},
},
Spec: validPodSpec(nil),
},
{ // populate tolerations equal operator in annotations. { // populate tolerations equal operator in annotations.
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "123", Name: "123",
@ -3409,7 +3443,21 @@ func TestValidatePod(t *testing.T) {
}, },
Spec: validPodSpec(nil), Spec: validPodSpec(nil),
}, },
{ // empty operator is ok for toleration { // empty key with Exists operator is OK for toleration, empty toleration key means match all taint keys.
ObjectMeta: metav1.ObjectMeta{
Name: "123",
Namespace: "ns",
Annotations: map[string]string{
api.TolerationsAnnotationKey: `
[{
"operator": "Exists",
"effect": "NoSchedule"
}]`,
},
},
Spec: validPodSpec(nil),
},
{ // empty operator is OK for toleration, defaults to Equal.
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "123", Name: "123",
Namespace: "ns", Namespace: "ns",
@ -3424,7 +3472,7 @@ func TestValidatePod(t *testing.T) {
}, },
Spec: validPodSpec(nil), Spec: validPodSpec(nil),
}, },
{ // empty efffect is ok for toleration { // empty effect is OK for toleration, empty toleration effect means match all taint effects.
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "123", Name: "123",
Namespace: "ns", Namespace: "ns",
@ -3439,6 +3487,22 @@ func TestValidatePod(t *testing.T) {
}, },
Spec: validPodSpec(nil), Spec: validPodSpec(nil),
}, },
{ // negative tolerationSeconds is OK for toleration.
ObjectMeta: metav1.ObjectMeta{
Name: "pod-forgiveness-invalid",
Namespace: "ns",
Annotations: map[string]string{
api.TolerationsAnnotationKey: `
[{
"key": "node.alpha.kubernetes.io/notReady",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": -2
}]`,
},
},
Spec: validPodSpec(nil),
},
{ // docker default seccomp profile { // docker default seccomp profile
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "123", Name: "123",
@ -3898,6 +3962,38 @@ func TestValidatePod(t *testing.T) {
}, },
Spec: validPodSpec(nil), Spec: validPodSpec(nil),
}, },
"operator must be 'Exists' when `key` is empty": {
ObjectMeta: metav1.ObjectMeta{
Name: "123",
Namespace: "ns",
Annotations: map[string]string{
api.TolerationsAnnotationKey: `
[{
"operator": "Equal",
"value": "bar",
"effect": "NoSchedule"
}]`,
},
},
Spec: validPodSpec(nil),
},
"effect must be 'NoExecute' when `TolerationSeconds` is set": {
ObjectMeta: metav1.ObjectMeta{
Name: "pod-forgiveness-invalid",
Namespace: "ns",
Annotations: map[string]string{
api.TolerationsAnnotationKey: `
[{
"key": "node.alpha.kubernetes.io/notReady",
"operator": "Exists",
"effect": "NoSchedule",
"tolerationSeconds": 20
}]`,
},
},
Spec: validPodSpec(nil),
},
"must be a valid pod seccomp profile": { "must be a valid pod seccomp profile": {
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "123", Name: "123",
@ -5927,7 +6023,7 @@ func TestValidateNode(t *testing.T) {
ExternalID: "external", ExternalID: "external",
}, },
}, },
"invalide-taint-effect": { "invalid-taint-effect": {
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "dedicated-node3", Name: "dedicated-node3",
// Add a taint with an empty effect to a node // Add a taint with an empty effect to a node
@ -5936,7 +6032,7 @@ func TestValidateNode(t *testing.T) {
[{ [{
"key": "dedicated", "key": "dedicated",
"value": "special-user-3", "value": "special-user-3",
"effect": "NoExecute" "effect": "NoScheduleNoAdmit"
}]`, }]`,
}, },
}, },

View File

@ -3097,6 +3097,7 @@ func DeepCopy_api_Taint(in interface{}, out interface{}, c *conversion.Cloner) e
in := in.(*Taint) in := in.(*Taint)
out := out.(*Taint) out := out.(*Taint)
*out = *in *out = *in
out.TimeAdded = in.TimeAdded.DeepCopy()
return nil return nil
} }
} }
@ -3106,6 +3107,11 @@ func DeepCopy_api_Toleration(in interface{}, out interface{}, c *conversion.Clon
in := in.(*Toleration) in := in.(*Toleration)
out := out.(*Toleration) out := out.(*Toleration)
*out = *in *out = *in
if in.TolerationSeconds != nil {
in, out := &in.TolerationSeconds, &out.TolerationSeconds
*out = new(int64)
**out = **in
}
return nil return nil
} }
} }

View File

@ -257,7 +257,11 @@ func DeepCopy_v1alpha1_KubeletConfiguration(in interface{}, out interface{}, c *
if in.RegisterWithTaints != nil { if in.RegisterWithTaints != nil {
in, out := &in.RegisterWithTaints, &out.RegisterWithTaints in, out := &in.RegisterWithTaints, &out.RegisterWithTaints
*out = make([]v1.Taint, len(*in)) *out = make([]v1.Taint, len(*in))
copy(*out, *in) for i := range *in {
if err := v1.DeepCopy_v1_Taint(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} }
if in.KubeAPIQPS != nil { if in.KubeAPIQPS != nil {
in, out := &in.KubeAPIQPS, &out.KubeAPIQPS in, out := &in.KubeAPIQPS, &out.KubeAPIQPS

View File

@ -196,7 +196,11 @@ func DeepCopy_componentconfig_KubeletConfiguration(in interface{}, out interface
if in.RegisterWithTaints != nil { if in.RegisterWithTaints != nil {
in, out := &in.RegisterWithTaints, &out.RegisterWithTaints in, out := &in.RegisterWithTaints, &out.RegisterWithTaints
*out = make([]api.Taint, len(*in)) *out = make([]api.Taint, len(*in))
copy(*out, *in) for i := range *in {
if err := api.DeepCopy_api_Taint(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} }
if in.NodeLabels != nil { if in.NodeLabels != nil {
in, out := &in.NodeLabels, &out.NodeLabels in, out := &in.NodeLabels, &out.NodeLabels

View File

@ -8314,16 +8314,23 @@ var OpenAPIDefinitions *openapi.OpenAPIDefinitions = &openapi.OpenAPIDefinitions
}, },
"effect": { "effect": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule and PreferNoSchedule.", Description: "Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute.",
Type: []string{"string"}, Type: []string{"string"},
Format: "", Format: "",
}, },
}, },
"timeAdded": {
SchemaProps: spec.SchemaProps{
Description: "TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints.",
Ref: spec.MustCreateRef("#/definitions/v1.Time"),
},
},
}, },
Required: []string{"key", "effect"}, Required: []string{"key", "effect"},
}, },
}, },
Dependencies: []string{}, Dependencies: []string{
"v1.Time"},
}, },
"v1.TestType": { "v1.TestType": {
Schema: spec.Schema{ Schema: spec.Schema{
@ -8444,14 +8451,14 @@ var OpenAPIDefinitions *openapi.OpenAPIDefinitions = &openapi.OpenAPIDefinitions
Properties: map[string]spec.Schema{ Properties: map[string]spec.Schema{
"key": { "key": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Required. Key is the taint key that the toleration applies to.", Description: "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.",
Type: []string{"string"}, Type: []string{"string"},
Format: "", Format: "",
}, },
}, },
"operator": { "operator": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.", Description: "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.",
Type: []string{"string"}, Type: []string{"string"},
Format: "", Format: "",
}, },
@ -8465,11 +8472,18 @@ var OpenAPIDefinitions *openapi.OpenAPIDefinitions = &openapi.OpenAPIDefinitions
}, },
"effect": { "effect": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule and PreferNoSchedule.", Description: "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.",
Type: []string{"string"}, Type: []string{"string"},
Format: "", Format: "",
}, },
}, },
"tolerationSeconds": {
SchemaProps: spec.SchemaProps{
Description: "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.",
Type: []string{"integer"},
Format: "int64",
},
},
}, },
}, },
}, },

View File

@ -33,6 +33,17 @@ const (
// of fluentd running on a node, kubelet need to mark node on which // of fluentd running on a node, kubelet need to mark node on which
// fluentd in not running as a manifest pod with LabelFluentdDsReady. // fluentd in not running as a manifest pod with LabelFluentdDsReady.
LabelFluentdDsReady = "alpha.kubernetes.io/fluentd-ds-ready" LabelFluentdDsReady = "alpha.kubernetes.io/fluentd-ds-ready"
// When the --use-taint-based-evictions flag is enabled,
// TaintNodeNotReady would be automatically added by node controller
// when node is not ready, and removed when node becomes ready.
TaintNodeNotReady = "node.alpha.kubernetes.io/notReady"
// When the --use-taint-based-evictions flag is enabled,
// TaintNodeUnreachable would be automatically added by node controller
// when node becomes unreachable (corresponding to NodeReady status ConditionUnknown)
// and removed when node becomes reachable (NodeReady status ConditionTrue).
TaintNodeUnreachable = "node.alpha.kubernetes.io/unreachable"
) )
// Role labels are applied to Nodes to mark their purpose. In particular, we // Role labels are applied to Nodes to mark their purpose. In particular, we