Merge pull request #31033 from mml/evict

Automatic merge from submit-queue

Implementation of the /eviction subresource.
This commit is contained in:
Kubernetes Submit Queue 2016-08-22 20:25:09 -07:00 committed by GitHub
commit df22dd70b8
18 changed files with 5186 additions and 3793 deletions

View File

@ -8552,6 +8552,67 @@
}
]
},
{
"path": "/api/v1/namespaces/{namespace}/pods/{name}/eviction",
"description": "API at /api/v1",
"operations": [
{
"type": "v1alpha1.Eviction",
"method": "POST",
"summary": "create eviction of a Eviction",
"nickname": "createNamespacedEvictionEviction",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "v1alpha1.Eviction",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Eviction",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1alpha1.Eviction"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1/namespaces/{namespace}/pods/{name}/exec",
"description": "API at /api/v1",
@ -18821,6 +18882,28 @@
}
}
},
"v1alpha1.Eviction": {
"id": "v1alpha1.Eviction",
"description": "Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods/foo/evictions.",
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"metadata": {
"$ref": "v1.ObjectMeta",
"description": "ObjectMeta describes the pod that is being evicted."
},
"deleteOptions": {
"$ref": "v1.DeleteOptions",
"description": "DeleteOptions may be provided"
}
}
},
"v1.PodTemplateList": {
"id": "v1.PodTemplateList",
"description": "PodTemplateList is a list of PodTemplates.",

View File

@ -6658,6 +6658,61 @@ The resulting set of endpoints can be viewed as:<br>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1alpha1_eviction">v1alpha1.Eviction</h3>
<div class="paragraph">
<p>Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to &#8230;/pods/foo/evictions.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">kind</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds</a></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>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">apiVersion</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources</a></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>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">metadata</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ObjectMeta describes the pod that is being evicted.</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"><a href="#_v1_objectmeta">v1.ObjectMeta</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">deleteOptions</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">DeleteOptions may be provided</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"><a href="#_v1_deleteoptions">v1.DeleteOptions</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_awselasticblockstorevolumesource">v1.AWSElasticBlockStoreVolumeSource</h3>
@ -8292,7 +8347,7 @@ The resulting set of endpoints can be viewed as:<br>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2016-08-21 13:01:40 UTC
Last updated 2016-08-22 23:33:31 UTC
</div>
</div>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&PodDisruptionBudget{},
&PodDisruptionBudgetList{},
&api.ListOptions{},
&Eviction{},
)
return nil
}

View File

@ -1320,15 +1320,330 @@ func (x *PodDisruptionBudgetList) codecDecodeSelfFromArray(l int, d *codec1978.D
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *Eviction) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
yym112 := z.EncBinary()
_ = yym112
if false {
} else if z.HasExtensions() && z.EncExt(x) {
} else {
yysep113 := !z.EncBinary()
yy2arr113 := z.EncBasicHandle().StructToArray
var yyq113 [4]bool
_, _, _ = yysep113, yyq113, yy2arr113
const yyr113 bool = false
yyq113[0] = x.Kind != ""
yyq113[1] = x.APIVersion != ""
yyq113[2] = true
yyq113[3] = x.DeleteOptions != nil
var yynn113 int
if yyr113 || yy2arr113 {
r.EncodeArrayStart(4)
} else {
yynn113 = 0
for _, b := range yyq113 {
if b {
yynn113++
}
}
r.EncodeMapStart(yynn113)
yynn113 = 0
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq113[0] {
yym115 := z.EncBinary()
_ = yym115
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq113[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("kind"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym116 := z.EncBinary()
_ = yym116
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
}
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq113[1] {
yym118 := z.EncBinary()
_ = yym118
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq113[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym119 := z.EncBinary()
_ = yym119
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
}
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq113[2] {
yy121 := &x.ObjectMeta
yy121.CodecEncodeSelf(e)
} else {
r.EncodeNil()
}
} else {
if yyq113[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy122 := &x.ObjectMeta
yy122.CodecEncodeSelf(e)
}
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq113[3] {
if x.DeleteOptions == nil {
r.EncodeNil()
} else {
x.DeleteOptions.CodecEncodeSelf(e)
}
} else {
r.EncodeNil()
}
} else {
if yyq113[3] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("deleteOptions"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.DeleteOptions == nil {
r.EncodeNil()
} else {
x.DeleteOptions.CodecEncodeSelf(e)
}
}
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *Eviction) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym124 := z.DecBinary()
_ = yym124
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
yyct125 := r.ContainerType()
if yyct125 == codecSelferValueTypeMap1234 {
yyl125 := r.ReadMapStart()
if yyl125 == 0 {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
} else {
x.codecDecodeSelfFromMap(yyl125, d)
}
} else if yyct125 == codecSelferValueTypeArray1234 {
yyl125 := r.ReadArrayStart()
if yyl125 == 0 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
x.codecDecodeSelfFromArray(yyl125, d)
}
} else {
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
}
}
}
func (x *Eviction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yys126Slc = z.DecScratchBuffer() // default slice to decode into
_ = yys126Slc
var yyhl126 bool = l >= 0
for yyj126 := 0; ; yyj126++ {
if yyhl126 {
if yyj126 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
z.DecSendContainerState(codecSelfer_containerMapKey1234)
yys126Slc = r.DecodeBytes(yys126Slc, true, true)
yys126 := string(yys126Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys126 {
case "kind":
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
case "apiVersion":
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
case "metadata":
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg3_api.ObjectMeta{}
} else {
yyv129 := &x.ObjectMeta
yyv129.CodecDecodeSelf(d)
}
case "deleteOptions":
if r.TryDecodeAsNil() {
if x.DeleteOptions != nil {
x.DeleteOptions = nil
}
} else {
if x.DeleteOptions == nil {
x.DeleteOptions = new(pkg3_api.DeleteOptions)
}
x.DeleteOptions.CodecDecodeSelf(d)
}
default:
z.DecStructFieldNotFound(-1, yys126)
} // end switch yys126
} // end for yyj126
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *Eviction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj131 int
var yyb131 bool
var yyhl131 bool = l >= 0
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg3_api.ObjectMeta{}
} else {
yyv134 := &x.ObjectMeta
yyv134.CodecDecodeSelf(d)
}
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
if x.DeleteOptions != nil {
x.DeleteOptions = nil
}
} else {
if x.DeleteOptions == nil {
x.DeleteOptions = new(pkg3_api.DeleteOptions)
}
x.DeleteOptions.CodecDecodeSelf(d)
}
for {
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj131-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) encSlicePodDisruptionBudget(v []PodDisruptionBudget, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
r.EncodeArrayStart(len(v))
for _, yyv112 := range v {
for _, yyv136 := range v {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yy113 := &yyv112
yy113.CodecEncodeSelf(e)
yy137 := &yyv136
yy137.CodecEncodeSelf(e)
}
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
@ -1338,83 +1653,83 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yyv114 := *v
yyh114, yyl114 := z.DecSliceHelperStart()
var yyc114 bool
if yyl114 == 0 {
if yyv114 == nil {
yyv114 = []PodDisruptionBudget{}
yyc114 = true
} else if len(yyv114) != 0 {
yyv114 = yyv114[:0]
yyc114 = true
yyv138 := *v
yyh138, yyl138 := z.DecSliceHelperStart()
var yyc138 bool
if yyl138 == 0 {
if yyv138 == nil {
yyv138 = []PodDisruptionBudget{}
yyc138 = true
} else if len(yyv138) != 0 {
yyv138 = yyv138[:0]
yyc138 = true
}
} else if yyl114 > 0 {
var yyrr114, yyrl114 int
var yyrt114 bool
if yyl114 > cap(yyv114) {
} else if yyl138 > 0 {
var yyrr138, yyrl138 int
var yyrt138 bool
if yyl138 > cap(yyv138) {
yyrg114 := len(yyv114) > 0
yyv2114 := yyv114
yyrl114, yyrt114 = z.DecInferLen(yyl114, z.DecBasicHandle().MaxInitLen, 296)
if yyrt114 {
if yyrl114 <= cap(yyv114) {
yyv114 = yyv114[:yyrl114]
yyrg138 := len(yyv138) > 0
yyv2138 := yyv138
yyrl138, yyrt138 = z.DecInferLen(yyl138, z.DecBasicHandle().MaxInitLen, 296)
if yyrt138 {
if yyrl138 <= cap(yyv138) {
yyv138 = yyv138[:yyrl138]
} else {
yyv114 = make([]PodDisruptionBudget, yyrl114)
yyv138 = make([]PodDisruptionBudget, yyrl138)
}
} else {
yyv114 = make([]PodDisruptionBudget, yyrl114)
yyv138 = make([]PodDisruptionBudget, yyrl138)
}
yyc114 = true
yyrr114 = len(yyv114)
if yyrg114 {
copy(yyv114, yyv2114)
yyc138 = true
yyrr138 = len(yyv138)
if yyrg138 {
copy(yyv138, yyv2138)
}
} else if yyl114 != len(yyv114) {
yyv114 = yyv114[:yyl114]
yyc114 = true
} else if yyl138 != len(yyv138) {
yyv138 = yyv138[:yyl138]
yyc138 = true
}
yyj114 := 0
for ; yyj114 < yyrr114; yyj114++ {
yyh114.ElemContainerState(yyj114)
yyj138 := 0
for ; yyj138 < yyrr138; yyj138++ {
yyh138.ElemContainerState(yyj138)
if r.TryDecodeAsNil() {
yyv114[yyj114] = PodDisruptionBudget{}
yyv138[yyj138] = PodDisruptionBudget{}
} else {
yyv115 := &yyv114[yyj114]
yyv115.CodecDecodeSelf(d)
yyv139 := &yyv138[yyj138]
yyv139.CodecDecodeSelf(d)
}
}
if yyrt114 {
for ; yyj114 < yyl114; yyj114++ {
yyv114 = append(yyv114, PodDisruptionBudget{})
yyh114.ElemContainerState(yyj114)
if yyrt138 {
for ; yyj138 < yyl138; yyj138++ {
yyv138 = append(yyv138, PodDisruptionBudget{})
yyh138.ElemContainerState(yyj138)
if r.TryDecodeAsNil() {
yyv114[yyj114] = PodDisruptionBudget{}
yyv138[yyj138] = PodDisruptionBudget{}
} else {
yyv116 := &yyv114[yyj114]
yyv116.CodecDecodeSelf(d)
yyv140 := &yyv138[yyj138]
yyv140.CodecDecodeSelf(d)
}
}
}
} else {
yyj114 := 0
for ; !r.CheckBreak(); yyj114++ {
yyj138 := 0
for ; !r.CheckBreak(); yyj138++ {
if yyj114 >= len(yyv114) {
yyv114 = append(yyv114, PodDisruptionBudget{}) // var yyz114 PodDisruptionBudget
yyc114 = true
if yyj138 >= len(yyv138) {
yyv138 = append(yyv138, PodDisruptionBudget{}) // var yyz138 PodDisruptionBudget
yyc138 = true
}
yyh114.ElemContainerState(yyj114)
if yyj114 < len(yyv114) {
yyh138.ElemContainerState(yyj138)
if yyj138 < len(yyv138) {
if r.TryDecodeAsNil() {
yyv114[yyj114] = PodDisruptionBudget{}
yyv138[yyj138] = PodDisruptionBudget{}
} else {
yyv117 := &yyv114[yyj114]
yyv117.CodecDecodeSelf(d)
yyv141 := &yyv138[yyj138]
yyv141.CodecDecodeSelf(d)
}
} else {
@ -1422,16 +1737,16 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d
}
}
if yyj114 < len(yyv114) {
yyv114 = yyv114[:yyj114]
yyc114 = true
} else if yyj114 == 0 && yyv114 == nil {
yyv114 = []PodDisruptionBudget{}
yyc114 = true
if yyj138 < len(yyv138) {
yyv138 = yyv138[:yyj138]
yyc138 = true
} else if yyj138 == 0 && yyv138 == nil {
yyv138 = []PodDisruptionBudget{}
yyc138 = true
}
}
yyh114.End()
if yyc114 {
*v = yyv114
yyh138.End()
if yyc138 {
*v = yyv138
}
}

View File

@ -69,3 +69,16 @@ type PodDisruptionBudgetList struct {
unversioned.ListMeta `json:"metadata,omitempty"`
Items []PodDisruptionBudget `json:"items"`
}
// Eviction evicts a pod from its node subject to certain policies and safety constraints.
// This is a subresource of Pod. A request to cause such an eviction is
// created by POSTing to .../pods/foo/evictions.
type Eviction struct {
unversioned.TypeMeta `json:",inline"`
// ObjectMeta describes the pod that is being evicted.
api.ObjectMeta `json:"metadata,omitempty"`
// DeleteOptions may be provided
DeleteOptions *api.DeleteOptions `json:"deleteOptions,omitempty"`
}

View File

@ -25,6 +25,7 @@ limitations under the License.
k8s.io/kubernetes/pkg/apis/policy/v1alpha1/generated.proto
It has these top-level messages:
Eviction
PodDisruptionBudget
PodDisruptionBudgetList
PodDisruptionBudgetSpec
@ -37,6 +38,7 @@ import fmt "fmt"
import math "math"
import k8s_io_kubernetes_pkg_api_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
import k8s_io_kubernetes_pkg_api_v1 "k8s.io/kubernetes/pkg/api/v1"
import strings "strings"
import reflect "reflect"
@ -52,30 +54,71 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
const _ = proto.GoGoProtoPackageIsVersion1
func (m *Eviction) Reset() { *m = Eviction{} }
func (*Eviction) ProtoMessage() {}
func (*Eviction) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
func (m *PodDisruptionBudget) Reset() { *m = PodDisruptionBudget{} }
func (*PodDisruptionBudget) ProtoMessage() {}
func (*PodDisruptionBudget) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
func (*PodDisruptionBudget) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
func (m *PodDisruptionBudgetList) Reset() { *m = PodDisruptionBudgetList{} }
func (*PodDisruptionBudgetList) ProtoMessage() {}
func (*PodDisruptionBudgetList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
func (*PodDisruptionBudgetList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
func (m *PodDisruptionBudgetSpec) Reset() { *m = PodDisruptionBudgetSpec{} }
func (*PodDisruptionBudgetSpec) ProtoMessage() {}
func (*PodDisruptionBudgetSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
func (*PodDisruptionBudgetSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} }
func (m *PodDisruptionBudgetStatus) Reset() { *m = PodDisruptionBudgetStatus{} }
func (*PodDisruptionBudgetStatus) ProtoMessage() {}
func (*PodDisruptionBudgetStatus) Descriptor() ([]byte, []int) {
return fileDescriptorGenerated, []int{3}
return fileDescriptorGenerated, []int{4}
}
func init() {
proto.RegisterType((*Eviction)(nil), "k8s.io.kubernetes.pkg.apis.policy.v1alpha1.Eviction")
proto.RegisterType((*PodDisruptionBudget)(nil), "k8s.io.kubernetes.pkg.apis.policy.v1alpha1.PodDisruptionBudget")
proto.RegisterType((*PodDisruptionBudgetList)(nil), "k8s.io.kubernetes.pkg.apis.policy.v1alpha1.PodDisruptionBudgetList")
proto.RegisterType((*PodDisruptionBudgetSpec)(nil), "k8s.io.kubernetes.pkg.apis.policy.v1alpha1.PodDisruptionBudgetSpec")
proto.RegisterType((*PodDisruptionBudgetStatus)(nil), "k8s.io.kubernetes.pkg.apis.policy.v1alpha1.PodDisruptionBudgetStatus")
}
func (m *Eviction) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
if err != nil {
return nil, err
}
return data[:n], nil
}
func (m *Eviction) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size()))
n1, err := m.ObjectMeta.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n1
if m.DeleteOptions != nil {
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(m.DeleteOptions.Size()))
n2, err := m.DeleteOptions.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n2
}
return i, nil
}
func (m *PodDisruptionBudget) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
@ -94,27 +137,27 @@ func (m *PodDisruptionBudget) MarshalTo(data []byte) (int, error) {
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size()))
n1, err := m.ObjectMeta.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n1
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(m.Spec.Size()))
n2, err := m.Spec.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n2
data[i] = 0x1a
i++
i = encodeVarintGenerated(data, i, uint64(m.Status.Size()))
n3, err := m.Status.MarshalTo(data[i:])
n3, err := m.ObjectMeta.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n3
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(m.Spec.Size()))
n4, err := m.Spec.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n4
data[i] = 0x1a
i++
i = encodeVarintGenerated(data, i, uint64(m.Status.Size()))
n5, err := m.Status.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n5
return i, nil
}
@ -136,11 +179,11 @@ func (m *PodDisruptionBudgetList) MarshalTo(data []byte) (int, error) {
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size()))
n4, err := m.ListMeta.MarshalTo(data[i:])
n6, err := m.ListMeta.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n4
i += n6
if len(m.Items) > 0 {
for _, msg := range m.Items {
data[i] = 0x12
@ -174,20 +217,20 @@ func (m *PodDisruptionBudgetSpec) MarshalTo(data []byte) (int, error) {
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(m.MinAvailable.Size()))
n5, err := m.MinAvailable.MarshalTo(data[i:])
n7, err := m.MinAvailable.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n5
i += n7
if m.Selector != nil {
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(m.Selector.Size()))
n6, err := m.Selector.MarshalTo(data[i:])
n8, err := m.Selector.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n6
i += n8
}
return i, nil
}
@ -254,6 +297,18 @@ func encodeVarintGenerated(data []byte, offset int, v uint64) int {
data[offset] = uint8(v)
return offset + 1
}
func (m *Eviction) Size() (n int) {
var l int
_ = l
l = m.ObjectMeta.Size()
n += 1 + l + sovGenerated(uint64(l))
if m.DeleteOptions != nil {
l = m.DeleteOptions.Size()
n += 1 + l + sovGenerated(uint64(l))
}
return n
}
func (m *PodDisruptionBudget) Size() (n int) {
var l int
_ = l
@ -315,6 +370,17 @@ func sovGenerated(x uint64) (n int) {
func sozGenerated(x uint64) (n int) {
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *Eviction) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&Eviction{`,
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
`DeleteOptions:` + strings.Replace(fmt.Sprintf("%v", this.DeleteOptions), "DeleteOptions", "k8s_io_kubernetes_pkg_api_v1.DeleteOptions", 1) + `,`,
`}`,
}, "")
return s
}
func (this *PodDisruptionBudget) String() string {
if this == nil {
return "nil"
@ -370,6 +436,119 @@ func valueToStringGenerated(v interface{}) string {
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *Eviction) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Eviction: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Eviction: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DeleteOptions", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.DeleteOptions == nil {
m.DeleteOptions = &k8s_io_kubernetes_pkg_api_v1.DeleteOptions{}
}
if err := m.DeleteOptions.Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(data[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenerated
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *PodDisruptionBudget) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
@ -967,43 +1146,46 @@ var (
)
var fileDescriptorGenerated = []byte{
// 607 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x94, 0xdf, 0x6a, 0x13, 0x4f,
0x14, 0xc7, 0x9b, 0xfe, 0x23, 0xcc, 0x2f, 0xbf, 0xa2, 0x6b, 0xd1, 0x18, 0xa4, 0x95, 0x5c, 0x95,
0x62, 0x67, 0x69, 0x51, 0x28, 0x5e, 0x28, 0xdd, 0xb6, 0x60, 0xc5, 0x52, 0xd9, 0xdc, 0x88, 0xa0,
0x30, 0xbb, 0x7b, 0xdc, 0x8c, 0xd9, 0xdd, 0x59, 0x66, 0x66, 0xa3, 0xbd, 0xf3, 0x11, 0x7c, 0x05,
0x1f, 0x46, 0xc8, 0x65, 0x2f, 0xbd, 0x0a, 0xda, 0xbe, 0x88, 0xb3, 0xb3, 0x93, 0x34, 0x9b, 0x64,
0xa5, 0xd0, 0x8b, 0x03, 0x39, 0x3b, 0xe7, 0xf3, 0x3d, 0x7f, 0x09, 0x7a, 0xde, 0xdb, 0x17, 0x98,
0x32, 0xbb, 0x97, 0x79, 0xc0, 0x13, 0x90, 0x20, 0xec, 0xb4, 0x17, 0xda, 0x24, 0xa5, 0xea, 0x07,
0x8b, 0xa8, 0x7f, 0x6e, 0xf7, 0x77, 0x49, 0x94, 0x76, 0xc9, 0xae, 0x1d, 0x42, 0x02, 0x9c, 0x48,
0x08, 0x70, 0xca, 0x99, 0x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db, 0xe5, 0xca, 0xd4, 0xbb, 0x7a, 0x7f, 0xbe, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff,
0x7d, 0xdd, 0x26, 0x2d, 0xbe, 0x06, 0x00, 0x00,
}

View File

@ -30,6 +30,17 @@ import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1alpha1";
// Eviction evicts a pod from its node subject to certain policies and safety constraints.
// This is a subresource of Pod. A request to cause such an eviction is
// created by POSTing to .../pods/foo/evictions.
message Eviction {
// ObjectMeta describes the pod that is being evicted.
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;
// DeleteOptions may be provided
optional k8s.io.kubernetes.pkg.api.v1.DeleteOptions deleteOptions = 2;
}
// PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods
message PodDisruptionBudget {
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;

View File

@ -39,6 +39,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&PodDisruptionBudget{},
&PodDisruptionBudgetList{},
&Eviction{},
&v1.ListOptions{},
&v1.DeleteOptions{},
)

View File

@ -1320,15 +1320,330 @@ func (x *PodDisruptionBudgetList) codecDecodeSelfFromArray(l int, d *codec1978.D
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *Eviction) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
yym112 := z.EncBinary()
_ = yym112
if false {
} else if z.HasExtensions() && z.EncExt(x) {
} else {
yysep113 := !z.EncBinary()
yy2arr113 := z.EncBasicHandle().StructToArray
var yyq113 [4]bool
_, _, _ = yysep113, yyq113, yy2arr113
const yyr113 bool = false
yyq113[0] = x.Kind != ""
yyq113[1] = x.APIVersion != ""
yyq113[2] = true
yyq113[3] = x.DeleteOptions != nil
var yynn113 int
if yyr113 || yy2arr113 {
r.EncodeArrayStart(4)
} else {
yynn113 = 0
for _, b := range yyq113 {
if b {
yynn113++
}
}
r.EncodeMapStart(yynn113)
yynn113 = 0
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq113[0] {
yym115 := z.EncBinary()
_ = yym115
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq113[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("kind"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym116 := z.EncBinary()
_ = yym116
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
}
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq113[1] {
yym118 := z.EncBinary()
_ = yym118
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq113[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym119 := z.EncBinary()
_ = yym119
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
}
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq113[2] {
yy121 := &x.ObjectMeta
yy121.CodecEncodeSelf(e)
} else {
r.EncodeNil()
}
} else {
if yyq113[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy122 := &x.ObjectMeta
yy122.CodecEncodeSelf(e)
}
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq113[3] {
if x.DeleteOptions == nil {
r.EncodeNil()
} else {
x.DeleteOptions.CodecEncodeSelf(e)
}
} else {
r.EncodeNil()
}
} else {
if yyq113[3] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("deleteOptions"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.DeleteOptions == nil {
r.EncodeNil()
} else {
x.DeleteOptions.CodecEncodeSelf(e)
}
}
}
if yyr113 || yy2arr113 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *Eviction) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym124 := z.DecBinary()
_ = yym124
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
yyct125 := r.ContainerType()
if yyct125 == codecSelferValueTypeMap1234 {
yyl125 := r.ReadMapStart()
if yyl125 == 0 {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
} else {
x.codecDecodeSelfFromMap(yyl125, d)
}
} else if yyct125 == codecSelferValueTypeArray1234 {
yyl125 := r.ReadArrayStart()
if yyl125 == 0 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
x.codecDecodeSelfFromArray(yyl125, d)
}
} else {
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
}
}
}
func (x *Eviction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yys126Slc = z.DecScratchBuffer() // default slice to decode into
_ = yys126Slc
var yyhl126 bool = l >= 0
for yyj126 := 0; ; yyj126++ {
if yyhl126 {
if yyj126 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
z.DecSendContainerState(codecSelfer_containerMapKey1234)
yys126Slc = r.DecodeBytes(yys126Slc, true, true)
yys126 := string(yys126Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys126 {
case "kind":
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
case "apiVersion":
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
case "metadata":
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg3_v1.ObjectMeta{}
} else {
yyv129 := &x.ObjectMeta
yyv129.CodecDecodeSelf(d)
}
case "deleteOptions":
if r.TryDecodeAsNil() {
if x.DeleteOptions != nil {
x.DeleteOptions = nil
}
} else {
if x.DeleteOptions == nil {
x.DeleteOptions = new(pkg3_v1.DeleteOptions)
}
x.DeleteOptions.CodecDecodeSelf(d)
}
default:
z.DecStructFieldNotFound(-1, yys126)
} // end switch yys126
} // end for yyj126
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *Eviction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj131 int
var yyb131 bool
var yyhl131 bool = l >= 0
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg3_v1.ObjectMeta{}
} else {
yyv134 := &x.ObjectMeta
yyv134.CodecDecodeSelf(d)
}
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
if x.DeleteOptions != nil {
x.DeleteOptions = nil
}
} else {
if x.DeleteOptions == nil {
x.DeleteOptions = new(pkg3_v1.DeleteOptions)
}
x.DeleteOptions.CodecDecodeSelf(d)
}
for {
yyj131++
if yyhl131 {
yyb131 = yyj131 > l
} else {
yyb131 = r.CheckBreak()
}
if yyb131 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj131-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) encSlicePodDisruptionBudget(v []PodDisruptionBudget, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
r.EncodeArrayStart(len(v))
for _, yyv112 := range v {
for _, yyv136 := range v {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yy113 := &yyv112
yy113.CodecEncodeSelf(e)
yy137 := &yyv136
yy137.CodecEncodeSelf(e)
}
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
@ -1338,83 +1653,83 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yyv114 := *v
yyh114, yyl114 := z.DecSliceHelperStart()
var yyc114 bool
if yyl114 == 0 {
if yyv114 == nil {
yyv114 = []PodDisruptionBudget{}
yyc114 = true
} else if len(yyv114) != 0 {
yyv114 = yyv114[:0]
yyc114 = true
yyv138 := *v
yyh138, yyl138 := z.DecSliceHelperStart()
var yyc138 bool
if yyl138 == 0 {
if yyv138 == nil {
yyv138 = []PodDisruptionBudget{}
yyc138 = true
} else if len(yyv138) != 0 {
yyv138 = yyv138[:0]
yyc138 = true
}
} else if yyl114 > 0 {
var yyrr114, yyrl114 int
var yyrt114 bool
if yyl114 > cap(yyv114) {
} else if yyl138 > 0 {
var yyrr138, yyrl138 int
var yyrt138 bool
if yyl138 > cap(yyv138) {
yyrg114 := len(yyv114) > 0
yyv2114 := yyv114
yyrl114, yyrt114 = z.DecInferLen(yyl114, z.DecBasicHandle().MaxInitLen, 296)
if yyrt114 {
if yyrl114 <= cap(yyv114) {
yyv114 = yyv114[:yyrl114]
yyrg138 := len(yyv138) > 0
yyv2138 := yyv138
yyrl138, yyrt138 = z.DecInferLen(yyl138, z.DecBasicHandle().MaxInitLen, 296)
if yyrt138 {
if yyrl138 <= cap(yyv138) {
yyv138 = yyv138[:yyrl138]
} else {
yyv114 = make([]PodDisruptionBudget, yyrl114)
yyv138 = make([]PodDisruptionBudget, yyrl138)
}
} else {
yyv114 = make([]PodDisruptionBudget, yyrl114)
yyv138 = make([]PodDisruptionBudget, yyrl138)
}
yyc114 = true
yyrr114 = len(yyv114)
if yyrg114 {
copy(yyv114, yyv2114)
yyc138 = true
yyrr138 = len(yyv138)
if yyrg138 {
copy(yyv138, yyv2138)
}
} else if yyl114 != len(yyv114) {
yyv114 = yyv114[:yyl114]
yyc114 = true
} else if yyl138 != len(yyv138) {
yyv138 = yyv138[:yyl138]
yyc138 = true
}
yyj114 := 0
for ; yyj114 < yyrr114; yyj114++ {
yyh114.ElemContainerState(yyj114)
yyj138 := 0
for ; yyj138 < yyrr138; yyj138++ {
yyh138.ElemContainerState(yyj138)
if r.TryDecodeAsNil() {
yyv114[yyj114] = PodDisruptionBudget{}
yyv138[yyj138] = PodDisruptionBudget{}
} else {
yyv115 := &yyv114[yyj114]
yyv115.CodecDecodeSelf(d)
yyv139 := &yyv138[yyj138]
yyv139.CodecDecodeSelf(d)
}
}
if yyrt114 {
for ; yyj114 < yyl114; yyj114++ {
yyv114 = append(yyv114, PodDisruptionBudget{})
yyh114.ElemContainerState(yyj114)
if yyrt138 {
for ; yyj138 < yyl138; yyj138++ {
yyv138 = append(yyv138, PodDisruptionBudget{})
yyh138.ElemContainerState(yyj138)
if r.TryDecodeAsNil() {
yyv114[yyj114] = PodDisruptionBudget{}
yyv138[yyj138] = PodDisruptionBudget{}
} else {
yyv116 := &yyv114[yyj114]
yyv116.CodecDecodeSelf(d)
yyv140 := &yyv138[yyj138]
yyv140.CodecDecodeSelf(d)
}
}
}
} else {
yyj114 := 0
for ; !r.CheckBreak(); yyj114++ {
yyj138 := 0
for ; !r.CheckBreak(); yyj138++ {
if yyj114 >= len(yyv114) {
yyv114 = append(yyv114, PodDisruptionBudget{}) // var yyz114 PodDisruptionBudget
yyc114 = true
if yyj138 >= len(yyv138) {
yyv138 = append(yyv138, PodDisruptionBudget{}) // var yyz138 PodDisruptionBudget
yyc138 = true
}
yyh114.ElemContainerState(yyj114)
if yyj114 < len(yyv114) {
yyh138.ElemContainerState(yyj138)
if yyj138 < len(yyv138) {
if r.TryDecodeAsNil() {
yyv114[yyj114] = PodDisruptionBudget{}
yyv138[yyj138] = PodDisruptionBudget{}
} else {
yyv117 := &yyv114[yyj114]
yyv117.CodecDecodeSelf(d)
yyv141 := &yyv138[yyj138]
yyv141.CodecDecodeSelf(d)
}
} else {
@ -1422,16 +1737,16 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d
}
}
if yyj114 < len(yyv114) {
yyv114 = yyv114[:yyj114]
yyc114 = true
} else if yyj114 == 0 && yyv114 == nil {
yyv114 = []PodDisruptionBudget{}
yyc114 = true
if yyj138 < len(yyv138) {
yyv138 = yyv138[:yyj138]
yyc138 = true
} else if yyj138 == 0 && yyv138 == nil {
yyv138 = []PodDisruptionBudget{}
yyc138 = true
}
}
yyh114.End()
if yyc114 {
*v = yyv114
yyh138.End()
if yyc138 {
*v = yyv138
}
}

View File

@ -18,7 +18,6 @@ package v1alpha1
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/intstr"
)
@ -70,3 +69,16 @@ type PodDisruptionBudgetList struct {
unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Items []PodDisruptionBudget `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// Eviction evicts a pod from its node subject to certain policies and safety constraints.
// This is a subresource of Pod. A request to cause such an eviction is
// created by POSTing to .../pods/foo/evictions.
type Eviction struct {
unversioned.TypeMeta `json:",inline"`
// ObjectMeta describes the pod that is being evicted.
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// DeleteOptions may be provided
DeleteOptions *v1.DeleteOptions `json:"deleteOptions,omitempty" protobuf:"bytes,2,opt,name=deleteOptions"`
}

View File

@ -27,6 +27,16 @@ package v1alpha1
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE
var map_Eviction = map[string]string{
"": "Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods/foo/evictions.",
"metadata": "ObjectMeta describes the pod that is being evicted.",
"deleteOptions": "DeleteOptions may be provided",
}
func (Eviction) SwaggerDoc() map[string]string {
return map_Eviction
}
var map_PodDisruptionBudget = map[string]string{
"": "PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods",
"spec": "Specification of the desired behavior of the PodDisruptionBudget.",

View File

@ -22,6 +22,7 @@ package v1alpha1
import (
api "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1"
policy "k8s.io/kubernetes/pkg/apis/policy"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
@ -35,6 +36,8 @@ func init() {
// Public to allow building arbitrary schemes.
func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v1alpha1_Eviction_To_policy_Eviction,
Convert_policy_Eviction_To_v1alpha1_Eviction,
Convert_v1alpha1_PodDisruptionBudget_To_policy_PodDisruptionBudget,
Convert_policy_PodDisruptionBudget_To_v1alpha1_PodDisruptionBudget,
Convert_v1alpha1_PodDisruptionBudgetList_To_policy_PodDisruptionBudgetList,
@ -46,6 +49,56 @@ func RegisterConversions(scheme *runtime.Scheme) error {
)
}
func autoConvert_v1alpha1_Eviction_To_policy_Eviction(in *Eviction, out *policy.Eviction, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if in.DeleteOptions != nil {
in, out := &in.DeleteOptions, &out.DeleteOptions
*out = new(api.DeleteOptions)
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(*in, *out, 0); err != nil {
return err
}
} else {
out.DeleteOptions = nil
}
return nil
}
func Convert_v1alpha1_Eviction_To_policy_Eviction(in *Eviction, out *policy.Eviction, s conversion.Scope) error {
return autoConvert_v1alpha1_Eviction_To_policy_Eviction(in, out, s)
}
func autoConvert_policy_Eviction_To_v1alpha1_Eviction(in *policy.Eviction, out *Eviction, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if in.DeleteOptions != nil {
in, out := &in.DeleteOptions, &out.DeleteOptions
*out = new(v1.DeleteOptions)
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(*in, *out, 0); err != nil {
return err
}
} else {
out.DeleteOptions = nil
}
return nil
}
func Convert_policy_Eviction_To_v1alpha1_Eviction(in *policy.Eviction, out *Eviction, s conversion.Scope) error {
return autoConvert_policy_Eviction_To_v1alpha1_Eviction(in, out, s)
}
func autoConvert_v1alpha1_PodDisruptionBudget_To_policy_PodDisruptionBudget(in *PodDisruptionBudget, out *policy.PodDisruptionBudget, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err

View File

@ -36,6 +36,7 @@ func init() {
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_Eviction, InType: reflect.TypeOf(&Eviction{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PodDisruptionBudget, InType: reflect.TypeOf(&PodDisruptionBudget{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PodDisruptionBudgetList, InType: reflect.TypeOf(&PodDisruptionBudgetList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_PodDisruptionBudgetSpec, InType: reflect.TypeOf(&PodDisruptionBudgetSpec{})},
@ -43,6 +44,27 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
)
}
func DeepCopy_v1alpha1_Eviction(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Eviction)
out := out.(*Eviction)
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if in.DeleteOptions != nil {
in, out := &in.DeleteOptions, &out.DeleteOptions
*out = new(v1.DeleteOptions)
if err := v1.DeepCopy_v1_DeleteOptions(*in, *out, c); err != nil {
return err
}
} else {
out.DeleteOptions = nil
}
return nil
}
}
func DeepCopy_v1alpha1_PodDisruptionBudget(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*PodDisruptionBudget)

View File

@ -36,6 +36,7 @@ func init() {
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_policy_Eviction, InType: reflect.TypeOf(&Eviction{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_policy_PodDisruptionBudget, InType: reflect.TypeOf(&PodDisruptionBudget{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_policy_PodDisruptionBudgetList, InType: reflect.TypeOf(&PodDisruptionBudgetList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_policy_PodDisruptionBudgetSpec, InType: reflect.TypeOf(&PodDisruptionBudgetSpec{})},
@ -43,6 +44,27 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
)
}
func DeepCopy_policy_Eviction(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Eviction)
out := out.(*Eviction)
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if in.DeleteOptions != nil {
in, out := &in.DeleteOptions, &out.DeleteOptions
*out = new(api.DeleteOptions)
if err := api.DeepCopy_api_DeleteOptions(*in, *out, c); err != nil {
return err
}
} else {
out.DeleteOptions = nil
}
return nil
}
}
func DeepCopy_policy_PodDisruptionBudget(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*PodDisruptionBudget)

View File

@ -246,11 +246,13 @@ func (m *Master) InstallAPIs(c *Config) {
Scheme: api.Scheme,
ParameterCodec: api.ParameterCodec,
NegotiatedSerializer: api.Codecs,
SubresourceGroupVersionKind: map[string]unversioned.GroupVersionKind{},
}
if autoscalingGroupVersion := (unversioned.GroupVersion{Group: "autoscaling", Version: "v1"}); registered.IsEnabledVersion(autoscalingGroupVersion) {
apiGroupInfo.SubresourceGroupVersionKind = map[string]unversioned.GroupVersionKind{
"replicationcontrollers/scale": autoscalingGroupVersion.WithKind("Scale"),
apiGroupInfo.SubresourceGroupVersionKind["replicationcontrollers/scale"] = autoscalingGroupVersion.WithKind("Scale")
}
if policyGroupVersion := (unversioned.GroupVersion{Group: "policy", Version: "v1alpha1"}); registered.IsEnabledVersion(policyGroupVersion) {
apiGroupInfo.SubresourceGroupVersionKind["pods/eviction"] = policyGroupVersion.WithKind("Eviction")
}
apiGroupsInfo = append(apiGroupsInfo, apiGroupInfo)
}
@ -300,6 +302,19 @@ func (m *Master) InstallAPIs(c *Config) {
continue
}
// This is here so that, if the policy group is present, the eviction
// subresource handler wil be able to find poddisruptionbudgets
// TODO(lavalamp) find a better way for groups to discover and interact
// with each other
if group == "policy" {
storage := apiGroupsInfo[0].VersionedResourcesStorageMap["v1"]["pods/eviction"]
evictionStorage := storage.(*podetcd.EvictionREST)
storage = apiGroupInfo.VersionedResourcesStorageMap["v1alpha1"]["poddisruptionbudgets"]
evictionStorage.PodDisruptionBudgetLister = storage.(rest.Lister)
evictionStorage.PodDisruptionBudgetUpdater = storage.(rest.Updater)
}
apiGroupsInfo = append(apiGroupsInfo, apiGroupInfo)
}
@ -426,6 +441,9 @@ func (m *Master) initV1ResourcesStorage(c *Config) {
if registered.IsEnabledVersion(unversioned.GroupVersion{Group: "autoscaling", Version: "v1"}) {
m.v1ResourcesStorage["replicationControllers/scale"] = controllerStorage.Scale
}
if registered.IsEnabledVersion(unversioned.GroupVersion{Group: "policy", Version: "v1alpha1"}) {
m.v1ResourcesStorage["pods/eviction"] = podStorage.Eviction
}
}
// NewBootstrapController returns a controller for watching the core capabilities of the master. If

View File

@ -27,7 +27,9 @@ import (
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/kubelet/client"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/cachesize"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/registry/generic/registry"
@ -41,6 +43,7 @@ import (
type PodStorage struct {
Pod *REST
Binding *BindingREST
Eviction *EvictionREST
Status *StatusREST
Log *podrest.LogREST
Proxy *podrest.ProxyREST
@ -100,6 +103,7 @@ func NewStorage(opts generic.RESTOptions, k client.ConnectionInfoGetter, proxyTr
return PodStorage{
Pod: &REST{store, proxyTransport},
Binding: &BindingREST{store: store},
Eviction: &EvictionREST{store: store},
Status: &StatusREST{store: &statusStore},
Log: &podrest.LogREST{Store: store, KubeletConn: k},
Proxy: &podrest.ProxyREST{Store: store, ProxyTransport: proxyTransport},
@ -117,6 +121,155 @@ func (r *REST) ResourceLocation(ctx api.Context, name string) (*url.URL, http.Ro
return pod.ResourceLocation(r, r.proxyTransport, ctx, name)
}
// EvictionREST implements the REST endpoint for evicting pods from nodes when etcd is in use.
type EvictionREST struct {
store *registry.Store
PodDisruptionBudgetLister rest.Lister
PodDisruptionBudgetUpdater rest.Updater
}
var _ = rest.Creater(&EvictionREST{})
// New creates a new eviction resource
func (r *EvictionREST) New() runtime.Object {
return &policy.Eviction{}
}
// Create attempts to create a new eviction. That is, it tries to evict a pod.
func (r *EvictionREST) Create(ctx api.Context, obj runtime.Object) (runtime.Object, error) {
eviction := obj.(*policy.Eviction)
obj, err := r.store.Get(ctx, eviction.Name)
if err != nil {
return nil, err
}
pod := obj.(*api.Pod)
pdbs, err := r.getPodDisruptionBudgets(ctx, pod)
if err != nil {
return nil, err
}
if len(pdbs) > 1 {
return &unversioned.Status{
Status: unversioned.StatusFailure,
Message: "This pod has more than one PodDisruptionBudget, which the eviction subresource does not support.",
Code: 500,
}, nil
} else if len(pdbs) == 1 {
pdb := pdbs[0]
// Try to verify-and-decrement
// If it was false already, or if it becomes false during the course of our retries,
// raise an error marked as a ... 429 maybe?
ok, err := r.checkAndDecrement(ctx, pdb)
if err != nil {
return nil, err
}
if !ok {
return &unversioned.Status{
Status: unversioned.StatusFailure,
// TODO(mml): Include some more details about why the eviction is disallowed.
// Ideally any such text is generated by the DisruptionController (offline).
Message: "Cannot evict pod as it would violate the pod's disruption budget.",
Code: 429,
// TODO(mml): Add a Retry-After header. Once there are time-based
// budgets, we can sometimes compute a sensible suggested value. But
// even without that, we can give a suggestion (10 minutes?) that
// prevents well-behaved clients from hammering us.
}, nil
}
}
// At this point there was either no PDB or we succeded in decrementing
// Try the delete
_, err = r.store.Delete(ctx, eviction.Name, eviction.DeleteOptions)
if err != nil {
return nil, err
}
// Success!
return &unversioned.Status{Status: unversioned.StatusSuccess}, nil
}
// UpdatedObjectInfo is a simple interface for attempting updates to
// runtime.Objects. EvictionREST implements it directly.
var _ = rest.UpdatedObjectInfo(&EvictionREST{})
// Preconditions returns any preconditions required prior to updating the
// PDB. None currently.
func (r *EvictionREST) Preconditions() *api.Preconditions {
return nil
}
// UpdatedObject returns the updated PDB if it is able to update
// PodDisruptionAllowed from true->false.
func (r *EvictionREST) UpdatedObject(ctx api.Context, oldObj runtime.Object) (newObj runtime.Object, err error) {
copy, err := api.Scheme.DeepCopy(oldObj)
if err != nil {
return
}
newObj = copy.(runtime.Object)
pdb := oldObj.(*policy.PodDisruptionBudget)
if !pdb.Status.PodDisruptionAllowed {
return nil, fmt.Errorf("PodDisruptionAllowed is already false")
}
pdb.Status.PodDisruptionAllowed = false
return
}
func (r *EvictionREST) checkAndDecrement(ctx api.Context, pdb policy.PodDisruptionBudget) (ok bool, err error) {
if !pdb.Status.PodDisruptionAllowed {
return false, nil
}
newObj, _, err := r.PodDisruptionBudgetUpdater.Update(ctx, pdb.Name, r)
if err != nil {
return false, err
}
newPdb := newObj.(*policy.PodDisruptionBudget)
if newPdb.Status.PodDisruptionAllowed {
return false, fmt.Errorf("update did not succeed")
}
return true, nil
}
// Returns any PDBs that match the pod.
// err is set if there's an error.
func (r *EvictionREST) getPodDisruptionBudgets(ctx api.Context, pod *api.Pod) (pdbs []policy.PodDisruptionBudget, err error) {
if len(pod.Labels) == 0 {
return
}
l, err := r.PodDisruptionBudgetLister.List(ctx, nil)
if err != nil {
return
}
pdbList := l.(*policy.PodDisruptionBudgetList)
for _, pdb := range pdbList.Items {
if pdb.Namespace != pod.Namespace {
continue
}
selector, err := unversioned.LabelSelectorAsSelector(pdb.Spec.Selector)
if err != nil {
continue
}
// If a PDB with a nil or empty selector creeps in, it should match nothing, not everything.
if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) {
continue
}
pdbs = append(pdbs, pdb)
}
return pdbs, nil
}
// BindingREST implements the REST endpoint for binding pods to nodes when etcd is in use.
type BindingREST struct {
store *registry.Store

View File

@ -49,7 +49,7 @@ func NewSecurityContextDeny(client clientset.Interface) admission.Interface {
// Admit will deny any pod that defines SELinuxOptions or RunAsUser.
func (p *plugin) Admit(a admission.Attributes) (err error) {
if a.GetResource().GroupResource() != api.Resource("pods") {
if a.GetSubresource() != "" || a.GetResource().GroupResource() != api.Resource("pods") {
return nil
}