Commit 48d76edc authored by Anirudh's avatar Anirudh

PDB MaxUnavailable: Generated

parent 63e51dc6
...@@ -50491,6 +50491,10 @@ ...@@ -50491,6 +50491,10 @@
"io.k8s.kubernetes.pkg.apis.policy.v1beta1.PodDisruptionBudgetSpec": { "io.k8s.kubernetes.pkg.apis.policy.v1beta1.PodDisruptionBudgetSpec": {
"description": "PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.", "description": "PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.",
"properties": { "properties": {
"maxUnavailable": {
"description": "An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
},
"minAvailable": { "minAvailable": {
"description": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".", "description": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
...@@ -1373,6 +1373,10 @@ ...@@ -1373,6 +1373,10 @@
"selector": { "selector": {
"$ref": "v1.LabelSelector", "$ref": "v1.LabelSelector",
"description": "Label query over pods whose evictions are managed by the disruption budget." "description": "Label query over pods whose evictions are managed by the disruption budget."
},
"maxUnavailable": {
"type": "string",
"description": "An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\"."
} }
} }
}, },
......
...@@ -1517,6 +1517,13 @@ Examples:<br> ...@@ -1517,6 +1517,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_labelselector">v1.LabelSelector</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_labelselector">v1.LabelSelector</a></p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">maxUnavailable</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">An eviction is allowed if at most "maxUnavailable" pods selected by "selector" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with "minAvailable".</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody> </tbody>
</table> </table>
...@@ -1532,7 +1539,7 @@ Examples:<br> ...@@ -1532,7 +1539,7 @@ Examples:<br>
</div> </div>
<div id="footer"> <div id="footer">
<div id="footer-text"> <div id="footer-text">
Last updated 2017-05-17 22:25:27 UTC Last updated 2017-05-23 14:28:21 UTC
</div> </div>
</div> </div>
</body> </body>
......
...@@ -27,7 +27,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; ...@@ -27,7 +27,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto"; import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto"; import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto"; import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/apis/extensions/v1beta1/generated.proto"; import "k8s.io/kubernetes/pkg/apis/policy/v1beta1/generated.proto";
// Package-wide variables from generator "generated". // Package-wide variables from generator "generated".
option go_package = "v1beta1"; option go_package = "v1beta1";
......
...@@ -28,6 +28,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; ...@@ -28,6 +28,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto"; import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto"; import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto"; import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/apis/policy/v1beta1/generated.proto";
// Package-wide variables from generator "generated". // Package-wide variables from generator "generated".
option go_package = "v1beta1"; option go_package = "v1beta1";
......
...@@ -71,6 +71,12 @@ message PodDisruptionBudgetSpec { ...@@ -71,6 +71,12 @@ message PodDisruptionBudgetSpec {
// Label query over pods whose evictions are managed by the disruption // Label query over pods whose evictions are managed by the disruption
// budget. // budget.
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2;
// An eviction is allowed if at most "maxUnavailable" pods selected by
// "selector" are unavailable after the eviction, i.e. even in absence of
// the evicted pod. For example, one can prevent all voluntary evictions
// by specifying 0. This is a mutually exclusive setting with "minAvailable".
optional k8s.io.apimachinery.pkg.util.intstr.IntOrString maxUnavailable = 3;
} }
// PodDisruptionBudgetStatus represents information about the status of a // PodDisruptionBudgetStatus represents information about the status of a
......
...@@ -85,14 +85,15 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -85,14 +85,15 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
} else { } else {
yysep2 := !z.EncBinary() yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [2]bool var yyq2 [3]bool
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[0] = true yyq2[0] = x.MinAvailable != nil
yyq2[1] = x.Selector != nil yyq2[1] = x.Selector != nil
yyq2[2] = x.MaxUnavailable != nil
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(2) r.EncodeArrayStart(3)
} else { } else {
yynn2 = 0 yynn2 = 0
for _, b := range yyq2 { for _, b := range yyq2 {
...@@ -106,15 +107,18 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -106,15 +107,18 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[0] { if yyq2[0] {
yy4 := &x.MinAvailable if x.MinAvailable == nil {
yym5 := z.EncBinary() r.EncodeNil()
_ = yym5
if false {
} else if z.HasExtensions() && z.EncExt(yy4) {
} else if !yym5 && z.IsJSONHandle() {
z.EncJSONMarshal(yy4)
} else { } else {
z.EncFallback(yy4) yym4 := z.EncBinary()
_ = yym4
if false {
} else if z.HasExtensions() && z.EncExt(x.MinAvailable) {
} else if !yym4 && z.IsJSONHandle() {
z.EncJSONMarshal(x.MinAvailable)
} else {
z.EncFallback(x.MinAvailable)
}
} }
} else { } else {
r.EncodeNil() r.EncodeNil()
...@@ -124,15 +128,18 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -124,15 +128,18 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("minAvailable")) r.EncodeString(codecSelferC_UTF81234, string("minAvailable"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy6 := &x.MinAvailable if x.MinAvailable == nil {
yym7 := z.EncBinary() r.EncodeNil()
_ = yym7
if false {
} else if z.HasExtensions() && z.EncExt(yy6) {
} else if !yym7 && z.IsJSONHandle() {
z.EncJSONMarshal(yy6)
} else { } else {
z.EncFallback(yy6) yym5 := z.EncBinary()
_ = yym5
if false {
} else if z.HasExtensions() && z.EncExt(x.MinAvailable) {
} else if !yym5 && z.IsJSONHandle() {
z.EncJSONMarshal(x.MinAvailable)
} else {
z.EncFallback(x.MinAvailable)
}
} }
} }
} }
...@@ -142,8 +149,8 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -142,8 +149,8 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
if x.Selector == nil { if x.Selector == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
yym9 := z.EncBinary() yym7 := z.EncBinary()
_ = yym9 _ = yym7
if false { if false {
} else if z.HasExtensions() && z.EncExt(x.Selector) { } else if z.HasExtensions() && z.EncExt(x.Selector) {
} else { } else {
...@@ -161,8 +168,8 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -161,8 +168,8 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
if x.Selector == nil { if x.Selector == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
yym10 := z.EncBinary() yym8 := z.EncBinary()
_ = yym10 _ = yym8
if false { if false {
} else if z.HasExtensions() && z.EncExt(x.Selector) { } else if z.HasExtensions() && z.EncExt(x.Selector) {
} else { } else {
...@@ -172,6 +179,45 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -172,6 +179,45 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
} }
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] {
if x.MaxUnavailable == nil {
r.EncodeNil()
} else {
yym10 := z.EncBinary()
_ = yym10
if false {
} else if z.HasExtensions() && z.EncExt(x.MaxUnavailable) {
} else if !yym10 && z.IsJSONHandle() {
z.EncJSONMarshal(x.MaxUnavailable)
} else {
z.EncFallback(x.MaxUnavailable)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("maxUnavailable"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.MaxUnavailable == nil {
r.EncodeNil()
} else {
yym11 := z.EncBinary()
_ = yym11
if false {
} else if z.HasExtensions() && z.EncExt(x.MaxUnavailable) {
} else if !yym11 && z.IsJSONHandle() {
z.EncJSONMarshal(x.MaxUnavailable)
} else {
z.EncFallback(x.MaxUnavailable)
}
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234) z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else { } else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234) z.EncSendContainerState(codecSelfer_containerMapEnd1234)
...@@ -234,17 +280,21 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Dec ...@@ -234,17 +280,21 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Dec
switch yys3 { switch yys3 {
case "minAvailable": case "minAvailable":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.MinAvailable = pkg1_intstr.IntOrString{} if x.MinAvailable != nil {
x.MinAvailable = nil
}
} else { } else {
yyv4 := &x.MinAvailable if x.MinAvailable == nil {
x.MinAvailable = new(pkg1_intstr.IntOrString)
}
yym5 := z.DecBinary() yym5 := z.DecBinary()
_ = yym5 _ = yym5
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv4) { } else if z.HasExtensions() && z.DecExt(x.MinAvailable) {
} else if !yym5 && z.IsJSONHandle() { } else if !yym5 && z.IsJSONHandle() {
z.DecJSONUnmarshal(yyv4) z.DecJSONUnmarshal(x.MinAvailable)
} else { } else {
z.DecFallback(yyv4, false) z.DecFallback(x.MinAvailable, false)
} }
} }
case "selector": case "selector":
...@@ -264,6 +314,25 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Dec ...@@ -264,6 +314,25 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Dec
z.DecFallback(x.Selector, false) z.DecFallback(x.Selector, false)
} }
} }
case "maxUnavailable":
if r.TryDecodeAsNil() {
if x.MaxUnavailable != nil {
x.MaxUnavailable = nil
}
} else {
if x.MaxUnavailable == nil {
x.MaxUnavailable = new(pkg1_intstr.IntOrString)
}
yym9 := z.DecBinary()
_ = yym9
if false {
} else if z.HasExtensions() && z.DecExt(x.MaxUnavailable) {
} else if !yym9 && z.IsJSONHandle() {
z.DecJSONUnmarshal(x.MaxUnavailable)
} else {
z.DecFallback(x.MaxUnavailable, false)
}
}
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3 } // end switch yys3
...@@ -275,41 +344,45 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromArray(l int, d *codec1978.D ...@@ -275,41 +344,45 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromArray(l int, d *codec1978.D
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 yyj10 int
var yyb8 bool var yyb10 bool
var yyhl8 bool = l >= 0 var yyhl10 bool = l >= 0
yyj8++ yyj10++
if yyhl8 { if yyhl10 {
yyb8 = yyj8 > l yyb10 = yyj10 > l
} else { } else {
yyb8 = r.CheckBreak() yyb10 = r.CheckBreak()
} }
if yyb8 { if yyb10 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.MinAvailable = pkg1_intstr.IntOrString{} if x.MinAvailable != nil {
x.MinAvailable = nil
}
} else { } else {
yyv9 := &x.MinAvailable if x.MinAvailable == nil {
yym10 := z.DecBinary() x.MinAvailable = new(pkg1_intstr.IntOrString)
_ = yym10 }
yym12 := z.DecBinary()
_ = yym12
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv9) { } else if z.HasExtensions() && z.DecExt(x.MinAvailable) {
} else if !yym10 && z.IsJSONHandle() { } else if !yym12 && z.IsJSONHandle() {
z.DecJSONUnmarshal(yyv9) z.DecJSONUnmarshal(x.MinAvailable)
} else { } else {
z.DecFallback(yyv9, false) z.DecFallback(x.MinAvailable, false)
} }
} }
yyj8++ yyj10++
if yyhl8 { if yyhl10 {
yyb8 = yyj8 > l yyb10 = yyj10 > l
} else { } else {
yyb8 = r.CheckBreak() yyb10 = r.CheckBreak()
} }
if yyb8 { if yyb10 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
...@@ -322,26 +395,55 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromArray(l int, d *codec1978.D ...@@ -322,26 +395,55 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromArray(l int, d *codec1978.D
if x.Selector == nil { if x.Selector == nil {
x.Selector = new(pkg2_v1.LabelSelector) x.Selector = new(pkg2_v1.LabelSelector)
} }
yym12 := z.DecBinary() yym14 := z.DecBinary()
_ = yym12 _ = yym14
if false { if false {
} else if z.HasExtensions() && z.DecExt(x.Selector) { } else if z.HasExtensions() && z.DecExt(x.Selector) {
} else { } else {
z.DecFallback(x.Selector, false) z.DecFallback(x.Selector, false)
} }
} }
yyj10++
if yyhl10 {
yyb10 = yyj10 > l
} else {
yyb10 = r.CheckBreak()
}
if yyb10 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
if x.MaxUnavailable != nil {
x.MaxUnavailable = nil
}
} else {
if x.MaxUnavailable == nil {
x.MaxUnavailable = new(pkg1_intstr.IntOrString)
}
yym16 := z.DecBinary()
_ = yym16
if false {
} else if z.HasExtensions() && z.DecExt(x.MaxUnavailable) {
} else if !yym16 && z.IsJSONHandle() {
z.DecJSONUnmarshal(x.MaxUnavailable)
} else {
z.DecFallback(x.MaxUnavailable, false)
}
}
for { for {
yyj8++ yyj10++
if yyhl8 { if yyhl10 {
yyb8 = yyj8 > l yyb10 = yyj10 > l
} else { } else {
yyb8 = r.CheckBreak() yyb10 = r.CheckBreak()
} }
if yyb8 { if yyb10 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj8-1, "") z.DecStructFieldNotFound(yyj10-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }
...@@ -2122,7 +2224,7 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d ...@@ -2122,7 +2224,7 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d
yyrg1 := len(yyv1) > 0 yyrg1 := len(yyv1) > 0
yyv21 := yyv1 yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 336) yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 320)
if yyrt1 { if yyrt1 {
if yyrl1 <= cap(yyv1) { if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1] yyv1 = yyv1[:yyrl1]
......
...@@ -56,9 +56,10 @@ func (PodDisruptionBudgetList) SwaggerDoc() map[string]string { ...@@ -56,9 +56,10 @@ func (PodDisruptionBudgetList) SwaggerDoc() map[string]string {
} }
var map_PodDisruptionBudgetSpec = map[string]string{ var map_PodDisruptionBudgetSpec = map[string]string{
"": "PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.", "": "PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.",
"minAvailable": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".", "minAvailable": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".",
"selector": "Label query over pods whose evictions are managed by the disruption budget.", "selector": "Label query over pods whose evictions are managed by the disruption budget.",
"maxUnavailable": "An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".",
} }
func (PodDisruptionBudgetSpec) SwaggerDoc() map[string]string { func (PodDisruptionBudgetSpec) SwaggerDoc() map[string]string {
......
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
policy "k8s.io/kubernetes/pkg/apis/policy" policy "k8s.io/kubernetes/pkg/apis/policy"
unsafe "unsafe" unsafe "unsafe"
) )
...@@ -130,8 +131,9 @@ func Convert_policy_PodDisruptionBudgetList_To_v1beta1_PodDisruptionBudgetList(i ...@@ -130,8 +131,9 @@ func Convert_policy_PodDisruptionBudgetList_To_v1beta1_PodDisruptionBudgetList(i
} }
func autoConvert_v1beta1_PodDisruptionBudgetSpec_To_policy_PodDisruptionBudgetSpec(in *PodDisruptionBudgetSpec, out *policy.PodDisruptionBudgetSpec, s conversion.Scope) error { func autoConvert_v1beta1_PodDisruptionBudgetSpec_To_policy_PodDisruptionBudgetSpec(in *PodDisruptionBudgetSpec, out *policy.PodDisruptionBudgetSpec, s conversion.Scope) error {
out.MinAvailable = in.MinAvailable out.MinAvailable = (*intstr.IntOrString)(unsafe.Pointer(in.MinAvailable))
out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector))
out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable))
return nil return nil
} }
...@@ -141,8 +143,9 @@ func Convert_v1beta1_PodDisruptionBudgetSpec_To_policy_PodDisruptionBudgetSpec(i ...@@ -141,8 +143,9 @@ func Convert_v1beta1_PodDisruptionBudgetSpec_To_policy_PodDisruptionBudgetSpec(i
} }
func autoConvert_policy_PodDisruptionBudgetSpec_To_v1beta1_PodDisruptionBudgetSpec(in *policy.PodDisruptionBudgetSpec, out *PodDisruptionBudgetSpec, s conversion.Scope) error { func autoConvert_policy_PodDisruptionBudgetSpec_To_v1beta1_PodDisruptionBudgetSpec(in *policy.PodDisruptionBudgetSpec, out *PodDisruptionBudgetSpec, s conversion.Scope) error {
out.MinAvailable = in.MinAvailable out.MinAvailable = (*intstr.IntOrString)(unsafe.Pointer(in.MinAvailable))
out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector))
out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable))
return nil return nil
} }
......
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
reflect "reflect" reflect "reflect"
) )
...@@ -112,6 +113,11 @@ func DeepCopy_v1beta1_PodDisruptionBudgetSpec(in interface{}, out interface{}, c ...@@ -112,6 +113,11 @@ func DeepCopy_v1beta1_PodDisruptionBudgetSpec(in interface{}, out interface{}, c
in := in.(*PodDisruptionBudgetSpec) in := in.(*PodDisruptionBudgetSpec)
out := out.(*PodDisruptionBudgetSpec) out := out.(*PodDisruptionBudgetSpec)
*out = *in *out = *in
if in.MinAvailable != nil {
in, out := &in.MinAvailable, &out.MinAvailable
*out = new(intstr.IntOrString)
**out = **in
}
if in.Selector != nil { if in.Selector != nil {
in, out := &in.Selector, &out.Selector in, out := &in.Selector, &out.Selector
if newVal, err := c.DeepCopy(*in); err != nil { if newVal, err := c.DeepCopy(*in); err != nil {
...@@ -120,6 +126,11 @@ func DeepCopy_v1beta1_PodDisruptionBudgetSpec(in interface{}, out interface{}, c ...@@ -120,6 +126,11 @@ func DeepCopy_v1beta1_PodDisruptionBudgetSpec(in interface{}, out interface{}, c
*out = newVal.(*v1.LabelSelector) *out = newVal.(*v1.LabelSelector)
} }
} }
if in.MaxUnavailable != nil {
in, out := &in.MaxUnavailable, &out.MaxUnavailable
*out = new(intstr.IntOrString)
**out = **in
}
return nil return nil
} }
} }
......
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
reflect "reflect" reflect "reflect"
) )
...@@ -112,6 +113,11 @@ func DeepCopy_policy_PodDisruptionBudgetSpec(in interface{}, out interface{}, c ...@@ -112,6 +113,11 @@ func DeepCopy_policy_PodDisruptionBudgetSpec(in interface{}, out interface{}, c
in := in.(*PodDisruptionBudgetSpec) in := in.(*PodDisruptionBudgetSpec)
out := out.(*PodDisruptionBudgetSpec) out := out.(*PodDisruptionBudgetSpec)
*out = *in *out = *in
if in.MinAvailable != nil {
in, out := &in.MinAvailable, &out.MinAvailable
*out = new(intstr.IntOrString)
**out = **in
}
if in.Selector != nil { if in.Selector != nil {
in, out := &in.Selector, &out.Selector in, out := &in.Selector, &out.Selector
if newVal, err := c.DeepCopy(*in); err != nil { if newVal, err := c.DeepCopy(*in); err != nil {
...@@ -120,6 +126,11 @@ func DeepCopy_policy_PodDisruptionBudgetSpec(in interface{}, out interface{}, c ...@@ -120,6 +126,11 @@ func DeepCopy_policy_PodDisruptionBudgetSpec(in interface{}, out interface{}, c
*out = newVal.(*v1.LabelSelector) *out = newVal.(*v1.LabelSelector)
} }
} }
if in.MaxUnavailable != nil {
in, out := &in.MaxUnavailable, &out.MaxUnavailable
*out = new(intstr.IntOrString)
**out = **in
}
return nil return nil
} }
} }
......
...@@ -56,6 +56,7 @@ go_test( ...@@ -56,6 +56,7 @@ go_test(
"//pkg/apis/policy/v1beta1:go_default_library", "//pkg/apis/policy/v1beta1:go_default_library",
"//pkg/client/informers/informers_generated/externalversions:go_default_library", "//pkg/client/informers/informers_generated/externalversions:go_default_library",
"//pkg/controller:go_default_library", "//pkg/controller:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/to:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/uuid:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
......
...@@ -27,7 +27,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; ...@@ -27,7 +27,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto"; import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto"; import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto"; import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/apis/extensions/v1beta1/generated.proto"; import "k8s.io/kubernetes/pkg/apis/policy/v1beta1/generated.proto";
// Package-wide variables from generator "generated". // Package-wide variables from generator "generated".
option go_package = "v1beta1"; option go_package = "v1beta1";
......
...@@ -28,6 +28,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; ...@@ -28,6 +28,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto"; import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto"; import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto"; import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/apis/policy/v1beta1/generated.proto";
// Package-wide variables from generator "generated". // Package-wide variables from generator "generated".
option go_package = "v1beta1"; option go_package = "v1beta1";
......
...@@ -28,12 +28,19 @@ type PodDisruptionBudgetSpec struct { ...@@ -28,12 +28,19 @@ type PodDisruptionBudgetSpec struct {
// absence of the evicted pod. So for example you can prevent all voluntary // absence of the evicted pod. So for example you can prevent all voluntary
// evictions by specifying "100%". // evictions by specifying "100%".
// +optional // +optional
MinAvailable intstr.IntOrString MinAvailable *intstr.IntOrString
// Label query over pods whose evictions are managed by the disruption // Label query over pods whose evictions are managed by the disruption
// budget. // budget.
// +optional // +optional
Selector *metav1.LabelSelector Selector *metav1.LabelSelector
// An eviction is allowed if at most "maxUnavailable" pods selected by
// "selector" are unavailable after the eviction, i.e. even in absence of
// the evicted pod. For example, one can prevent all voluntary evictions
// by specifying 0. This is a mutually exclusive setting with "minAvailable".
// +optional
MaxUnavailable *intstr.IntOrString
} }
// PodDisruptionBudgetStatus represents information about the status of a // PodDisruptionBudgetStatus represents information about the status of a
......
...@@ -71,6 +71,12 @@ message PodDisruptionBudgetSpec { ...@@ -71,6 +71,12 @@ message PodDisruptionBudgetSpec {
// Label query over pods whose evictions are managed by the disruption // Label query over pods whose evictions are managed by the disruption
// budget. // budget.
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2;
// An eviction is allowed if at most "maxUnavailable" pods selected by
// "selector" are unavailable after the eviction, i.e. even in absence of
// the evicted pod. For example, one can prevent all voluntary evictions
// by specifying 0. This is a mutually exclusive setting with "minAvailable".
optional k8s.io.apimachinery.pkg.util.intstr.IntOrString maxUnavailable = 3;
} }
// PodDisruptionBudgetStatus represents information about the status of a // PodDisruptionBudgetStatus represents information about the status of a
......
...@@ -85,14 +85,15 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -85,14 +85,15 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
} else { } else {
yysep2 := !z.EncBinary() yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [2]bool var yyq2 [3]bool
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[0] = true yyq2[0] = x.MinAvailable != nil
yyq2[1] = x.Selector != nil yyq2[1] = x.Selector != nil
yyq2[2] = x.MaxUnavailable != nil
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(2) r.EncodeArrayStart(3)
} else { } else {
yynn2 = 0 yynn2 = 0
for _, b := range yyq2 { for _, b := range yyq2 {
...@@ -106,15 +107,18 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -106,15 +107,18 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[0] { if yyq2[0] {
yy4 := &x.MinAvailable if x.MinAvailable == nil {
yym5 := z.EncBinary() r.EncodeNil()
_ = yym5
if false {
} else if z.HasExtensions() && z.EncExt(yy4) {
} else if !yym5 && z.IsJSONHandle() {
z.EncJSONMarshal(yy4)
} else { } else {
z.EncFallback(yy4) yym4 := z.EncBinary()
_ = yym4
if false {
} else if z.HasExtensions() && z.EncExt(x.MinAvailable) {
} else if !yym4 && z.IsJSONHandle() {
z.EncJSONMarshal(x.MinAvailable)
} else {
z.EncFallback(x.MinAvailable)
}
} }
} else { } else {
r.EncodeNil() r.EncodeNil()
...@@ -124,15 +128,18 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -124,15 +128,18 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("minAvailable")) r.EncodeString(codecSelferC_UTF81234, string("minAvailable"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy6 := &x.MinAvailable if x.MinAvailable == nil {
yym7 := z.EncBinary() r.EncodeNil()
_ = yym7
if false {
} else if z.HasExtensions() && z.EncExt(yy6) {
} else if !yym7 && z.IsJSONHandle() {
z.EncJSONMarshal(yy6)
} else { } else {
z.EncFallback(yy6) yym5 := z.EncBinary()
_ = yym5
if false {
} else if z.HasExtensions() && z.EncExt(x.MinAvailable) {
} else if !yym5 && z.IsJSONHandle() {
z.EncJSONMarshal(x.MinAvailable)
} else {
z.EncFallback(x.MinAvailable)
}
} }
} }
} }
...@@ -142,8 +149,8 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -142,8 +149,8 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
if x.Selector == nil { if x.Selector == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
yym9 := z.EncBinary() yym7 := z.EncBinary()
_ = yym9 _ = yym7
if false { if false {
} else if z.HasExtensions() && z.EncExt(x.Selector) { } else if z.HasExtensions() && z.EncExt(x.Selector) {
} else { } else {
...@@ -161,8 +168,8 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -161,8 +168,8 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
if x.Selector == nil { if x.Selector == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
yym10 := z.EncBinary() yym8 := z.EncBinary()
_ = yym10 _ = yym8
if false { if false {
} else if z.HasExtensions() && z.EncExt(x.Selector) { } else if z.HasExtensions() && z.EncExt(x.Selector) {
} else { } else {
...@@ -172,6 +179,45 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) { ...@@ -172,6 +179,45 @@ func (x *PodDisruptionBudgetSpec) CodecEncodeSelf(e *codec1978.Encoder) {
} }
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] {
if x.MaxUnavailable == nil {
r.EncodeNil()
} else {
yym10 := z.EncBinary()
_ = yym10
if false {
} else if z.HasExtensions() && z.EncExt(x.MaxUnavailable) {
} else if !yym10 && z.IsJSONHandle() {
z.EncJSONMarshal(x.MaxUnavailable)
} else {
z.EncFallback(x.MaxUnavailable)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("maxUnavailable"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.MaxUnavailable == nil {
r.EncodeNil()
} else {
yym11 := z.EncBinary()
_ = yym11
if false {
} else if z.HasExtensions() && z.EncExt(x.MaxUnavailable) {
} else if !yym11 && z.IsJSONHandle() {
z.EncJSONMarshal(x.MaxUnavailable)
} else {
z.EncFallback(x.MaxUnavailable)
}
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234) z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else { } else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234) z.EncSendContainerState(codecSelfer_containerMapEnd1234)
...@@ -234,17 +280,21 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Dec ...@@ -234,17 +280,21 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Dec
switch yys3 { switch yys3 {
case "minAvailable": case "minAvailable":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.MinAvailable = pkg1_intstr.IntOrString{} if x.MinAvailable != nil {
x.MinAvailable = nil
}
} else { } else {
yyv4 := &x.MinAvailable if x.MinAvailable == nil {
x.MinAvailable = new(pkg1_intstr.IntOrString)
}
yym5 := z.DecBinary() yym5 := z.DecBinary()
_ = yym5 _ = yym5
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv4) { } else if z.HasExtensions() && z.DecExt(x.MinAvailable) {
} else if !yym5 && z.IsJSONHandle() { } else if !yym5 && z.IsJSONHandle() {
z.DecJSONUnmarshal(yyv4) z.DecJSONUnmarshal(x.MinAvailable)
} else { } else {
z.DecFallback(yyv4, false) z.DecFallback(x.MinAvailable, false)
} }
} }
case "selector": case "selector":
...@@ -264,6 +314,25 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Dec ...@@ -264,6 +314,25 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Dec
z.DecFallback(x.Selector, false) z.DecFallback(x.Selector, false)
} }
} }
case "maxUnavailable":
if r.TryDecodeAsNil() {
if x.MaxUnavailable != nil {
x.MaxUnavailable = nil
}
} else {
if x.MaxUnavailable == nil {
x.MaxUnavailable = new(pkg1_intstr.IntOrString)
}
yym9 := z.DecBinary()
_ = yym9
if false {
} else if z.HasExtensions() && z.DecExt(x.MaxUnavailable) {
} else if !yym9 && z.IsJSONHandle() {
z.DecJSONUnmarshal(x.MaxUnavailable)
} else {
z.DecFallback(x.MaxUnavailable, false)
}
}
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3 } // end switch yys3
...@@ -275,41 +344,45 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromArray(l int, d *codec1978.D ...@@ -275,41 +344,45 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromArray(l int, d *codec1978.D
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 yyj10 int
var yyb8 bool var yyb10 bool
var yyhl8 bool = l >= 0 var yyhl10 bool = l >= 0
yyj8++ yyj10++
if yyhl8 { if yyhl10 {
yyb8 = yyj8 > l yyb10 = yyj10 > l
} else { } else {
yyb8 = r.CheckBreak() yyb10 = r.CheckBreak()
} }
if yyb8 { if yyb10 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.MinAvailable = pkg1_intstr.IntOrString{} if x.MinAvailable != nil {
x.MinAvailable = nil
}
} else { } else {
yyv9 := &x.MinAvailable if x.MinAvailable == nil {
yym10 := z.DecBinary() x.MinAvailable = new(pkg1_intstr.IntOrString)
_ = yym10 }
yym12 := z.DecBinary()
_ = yym12
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv9) { } else if z.HasExtensions() && z.DecExt(x.MinAvailable) {
} else if !yym10 && z.IsJSONHandle() { } else if !yym12 && z.IsJSONHandle() {
z.DecJSONUnmarshal(yyv9) z.DecJSONUnmarshal(x.MinAvailable)
} else { } else {
z.DecFallback(yyv9, false) z.DecFallback(x.MinAvailable, false)
} }
} }
yyj8++ yyj10++
if yyhl8 { if yyhl10 {
yyb8 = yyj8 > l yyb10 = yyj10 > l
} else { } else {
yyb8 = r.CheckBreak() yyb10 = r.CheckBreak()
} }
if yyb8 { if yyb10 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
...@@ -322,26 +395,55 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromArray(l int, d *codec1978.D ...@@ -322,26 +395,55 @@ func (x *PodDisruptionBudgetSpec) codecDecodeSelfFromArray(l int, d *codec1978.D
if x.Selector == nil { if x.Selector == nil {
x.Selector = new(pkg2_v1.LabelSelector) x.Selector = new(pkg2_v1.LabelSelector)
} }
yym12 := z.DecBinary() yym14 := z.DecBinary()
_ = yym12 _ = yym14
if false { if false {
} else if z.HasExtensions() && z.DecExt(x.Selector) { } else if z.HasExtensions() && z.DecExt(x.Selector) {
} else { } else {
z.DecFallback(x.Selector, false) z.DecFallback(x.Selector, false)
} }
} }
yyj10++
if yyhl10 {
yyb10 = yyj10 > l
} else {
yyb10 = r.CheckBreak()
}
if yyb10 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
if x.MaxUnavailable != nil {
x.MaxUnavailable = nil
}
} else {
if x.MaxUnavailable == nil {
x.MaxUnavailable = new(pkg1_intstr.IntOrString)
}
yym16 := z.DecBinary()
_ = yym16
if false {
} else if z.HasExtensions() && z.DecExt(x.MaxUnavailable) {
} else if !yym16 && z.IsJSONHandle() {
z.DecJSONUnmarshal(x.MaxUnavailable)
} else {
z.DecFallback(x.MaxUnavailable, false)
}
}
for { for {
yyj8++ yyj10++
if yyhl8 { if yyhl10 {
yyb8 = yyj8 > l yyb10 = yyj10 > l
} else { } else {
yyb8 = r.CheckBreak() yyb10 = r.CheckBreak()
} }
if yyb8 { if yyb10 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj8-1, "") z.DecStructFieldNotFound(yyj10-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }
...@@ -2122,7 +2224,7 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d ...@@ -2122,7 +2224,7 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d
yyrg1 := len(yyv1) > 0 yyrg1 := len(yyv1) > 0
yyv21 := yyv1 yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 336) yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 320)
if yyrt1 { if yyrt1 {
if yyrl1 <= cap(yyv1) { if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1] yyv1 = yyv1[:yyrl1]
......
...@@ -27,11 +27,17 @@ type PodDisruptionBudgetSpec struct { ...@@ -27,11 +27,17 @@ type PodDisruptionBudgetSpec struct {
// "selector" will still be available after the eviction, i.e. even in the // "selector" will still be available after the eviction, i.e. even in the
// absence of the evicted pod. So for example you can prevent all voluntary // absence of the evicted pod. So for example you can prevent all voluntary
// evictions by specifying "100%". // evictions by specifying "100%".
MinAvailable intstr.IntOrString `json:"minAvailable,omitempty" protobuf:"bytes,1,opt,name=minAvailable"` MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty" protobuf:"bytes,1,opt,name=minAvailable"`
// Label query over pods whose evictions are managed by the disruption // Label query over pods whose evictions are managed by the disruption
// budget. // budget.
Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"`
// An eviction is allowed if at most "maxUnavailable" pods selected by
// "selector" are unavailable after the eviction, i.e. even in absence of
// the evicted pod. For example, one can prevent all voluntary evictions
// by specifying 0. This is a mutually exclusive setting with "minAvailable".
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,3,opt,name=maxUnavailable"`
} }
// PodDisruptionBudgetStatus represents information about the status of a // PodDisruptionBudgetStatus represents information about the status of a
......
...@@ -56,9 +56,10 @@ func (PodDisruptionBudgetList) SwaggerDoc() map[string]string { ...@@ -56,9 +56,10 @@ func (PodDisruptionBudgetList) SwaggerDoc() map[string]string {
} }
var map_PodDisruptionBudgetSpec = map[string]string{ var map_PodDisruptionBudgetSpec = map[string]string{
"": "PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.", "": "PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.",
"minAvailable": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".", "minAvailable": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".",
"selector": "Label query over pods whose evictions are managed by the disruption budget.", "selector": "Label query over pods whose evictions are managed by the disruption budget.",
"maxUnavailable": "An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".",
} }
func (PodDisruptionBudgetSpec) SwaggerDoc() map[string]string { func (PodDisruptionBudgetSpec) SwaggerDoc() map[string]string {
......
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
policy "k8s.io/client-go/pkg/apis/policy" policy "k8s.io/client-go/pkg/apis/policy"
unsafe "unsafe" unsafe "unsafe"
) )
...@@ -130,8 +131,9 @@ func Convert_policy_PodDisruptionBudgetList_To_v1beta1_PodDisruptionBudgetList(i ...@@ -130,8 +131,9 @@ func Convert_policy_PodDisruptionBudgetList_To_v1beta1_PodDisruptionBudgetList(i
} }
func autoConvert_v1beta1_PodDisruptionBudgetSpec_To_policy_PodDisruptionBudgetSpec(in *PodDisruptionBudgetSpec, out *policy.PodDisruptionBudgetSpec, s conversion.Scope) error { func autoConvert_v1beta1_PodDisruptionBudgetSpec_To_policy_PodDisruptionBudgetSpec(in *PodDisruptionBudgetSpec, out *policy.PodDisruptionBudgetSpec, s conversion.Scope) error {
out.MinAvailable = in.MinAvailable out.MinAvailable = (*intstr.IntOrString)(unsafe.Pointer(in.MinAvailable))
out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector))
out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable))
return nil return nil
} }
...@@ -141,8 +143,9 @@ func Convert_v1beta1_PodDisruptionBudgetSpec_To_policy_PodDisruptionBudgetSpec(i ...@@ -141,8 +143,9 @@ func Convert_v1beta1_PodDisruptionBudgetSpec_To_policy_PodDisruptionBudgetSpec(i
} }
func autoConvert_policy_PodDisruptionBudgetSpec_To_v1beta1_PodDisruptionBudgetSpec(in *policy.PodDisruptionBudgetSpec, out *PodDisruptionBudgetSpec, s conversion.Scope) error { func autoConvert_policy_PodDisruptionBudgetSpec_To_v1beta1_PodDisruptionBudgetSpec(in *policy.PodDisruptionBudgetSpec, out *PodDisruptionBudgetSpec, s conversion.Scope) error {
out.MinAvailable = in.MinAvailable out.MinAvailable = (*intstr.IntOrString)(unsafe.Pointer(in.MinAvailable))
out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector))
out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable))
return nil return nil
} }
......
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
reflect "reflect" reflect "reflect"
) )
...@@ -112,6 +113,11 @@ func DeepCopy_v1beta1_PodDisruptionBudgetSpec(in interface{}, out interface{}, c ...@@ -112,6 +113,11 @@ func DeepCopy_v1beta1_PodDisruptionBudgetSpec(in interface{}, out interface{}, c
in := in.(*PodDisruptionBudgetSpec) in := in.(*PodDisruptionBudgetSpec)
out := out.(*PodDisruptionBudgetSpec) out := out.(*PodDisruptionBudgetSpec)
*out = *in *out = *in
if in.MinAvailable != nil {
in, out := &in.MinAvailable, &out.MinAvailable
*out = new(intstr.IntOrString)
**out = **in
}
if in.Selector != nil { if in.Selector != nil {
in, out := &in.Selector, &out.Selector in, out := &in.Selector, &out.Selector
if newVal, err := c.DeepCopy(*in); err != nil { if newVal, err := c.DeepCopy(*in); err != nil {
...@@ -120,6 +126,11 @@ func DeepCopy_v1beta1_PodDisruptionBudgetSpec(in interface{}, out interface{}, c ...@@ -120,6 +126,11 @@ func DeepCopy_v1beta1_PodDisruptionBudgetSpec(in interface{}, out interface{}, c
*out = newVal.(*v1.LabelSelector) *out = newVal.(*v1.LabelSelector)
} }
} }
if in.MaxUnavailable != nil {
in, out := &in.MaxUnavailable, &out.MaxUnavailable
*out = new(intstr.IntOrString)
**out = **in
}
return nil return nil
} }
} }
......
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
reflect "reflect" reflect "reflect"
) )
...@@ -112,6 +113,11 @@ func DeepCopy_policy_PodDisruptionBudgetSpec(in interface{}, out interface{}, c ...@@ -112,6 +113,11 @@ func DeepCopy_policy_PodDisruptionBudgetSpec(in interface{}, out interface{}, c
in := in.(*PodDisruptionBudgetSpec) in := in.(*PodDisruptionBudgetSpec)
out := out.(*PodDisruptionBudgetSpec) out := out.(*PodDisruptionBudgetSpec)
*out = *in *out = *in
if in.MinAvailable != nil {
in, out := &in.MinAvailable, &out.MinAvailable
*out = new(intstr.IntOrString)
**out = **in
}
if in.Selector != nil { if in.Selector != nil {
in, out := &in.Selector, &out.Selector in, out := &in.Selector, &out.Selector
if newVal, err := c.DeepCopy(*in); err != nil { if newVal, err := c.DeepCopy(*in); err != nil {
...@@ -120,6 +126,11 @@ func DeepCopy_policy_PodDisruptionBudgetSpec(in interface{}, out interface{}, c ...@@ -120,6 +126,11 @@ func DeepCopy_policy_PodDisruptionBudgetSpec(in interface{}, out interface{}, c
*out = newVal.(*v1.LabelSelector) *out = newVal.(*v1.LabelSelector)
} }
} }
if in.MaxUnavailable != nil {
in, out := &in.MaxUnavailable, &out.MaxUnavailable
*out = new(intstr.IntOrString)
**out = **in
}
return nil return nil
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment