add delete precondition
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
fields "k8s.io/kubernetes/pkg/fields"
|
||||
labels "k8s.io/kubernetes/pkg/labels"
|
||||
runtime "k8s.io/kubernetes/pkg/runtime"
|
||||
types "k8s.io/kubernetes/pkg/types"
|
||||
intstr "k8s.io/kubernetes/pkg/util/intstr"
|
||||
)
|
||||
|
||||
@@ -140,6 +141,7 @@ func init() {
|
||||
DeepCopy_api_PodTemplate,
|
||||
DeepCopy_api_PodTemplateList,
|
||||
DeepCopy_api_PodTemplateSpec,
|
||||
DeepCopy_api_Preconditions,
|
||||
DeepCopy_api_PreferredSchedulingTerm,
|
||||
DeepCopy_api_Probe,
|
||||
DeepCopy_api_RBDVolumeSource,
|
||||
@@ -617,6 +619,15 @@ func DeepCopy_api_DeleteOptions(in DeleteOptions, out *DeleteOptions, c *convers
|
||||
} else {
|
||||
out.GracePeriodSeconds = nil
|
||||
}
|
||||
if in.Preconditions != nil {
|
||||
in, out := in.Preconditions, &out.Preconditions
|
||||
*out = new(Preconditions)
|
||||
if err := DeepCopy_api_Preconditions(*in, *out, c); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Preconditions = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2247,6 +2258,21 @@ func DeepCopy_api_PodTemplateSpec(in PodTemplateSpec, out *PodTemplateSpec, c *c
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_api_Preconditions(in Preconditions, out *Preconditions, c *conversion.Cloner) error {
|
||||
if in.UID != nil {
|
||||
in, out := in.UID, &out.UID
|
||||
*out = new(types.UID)
|
||||
if newVal, err := c.DeepCopy(*in); err != nil {
|
||||
return err
|
||||
} else {
|
||||
**out = newVal.(types.UID)
|
||||
}
|
||||
} else {
|
||||
out.UID = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_api_PreferredSchedulingTerm(in PreferredSchedulingTerm, out *PreferredSchedulingTerm, c *conversion.Cloner) error {
|
||||
out.Weight = in.Weight
|
||||
if err := DeepCopy_api_NodeSelectorTerm(in.Preference, &out.Preference, c); err != nil {
|
||||
|
||||
@@ -163,7 +163,7 @@ func NewConflict(qualifiedResource unversioned.GroupResource, name string, err e
|
||||
Kind: qualifiedResource.Resource,
|
||||
Name: name,
|
||||
},
|
||||
Message: fmt.Sprintf("%s %q cannot be updated: %v", qualifiedResource.String(), name, err),
|
||||
Message: fmt.Sprintf("Operation cannot be fulfilled on %s %q: %v", qualifiedResource.String(), name, err),
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ func InterpretUpdateError(err error, qualifiedResource unversioned.GroupResource
|
||||
return errors.NewServerTimeout(qualifiedResource, "update", 2) // TODO: make configurable or handled at a higher level
|
||||
case storage.IsNotFound(err):
|
||||
return errors.NewNotFound(qualifiedResource, name)
|
||||
case storage.IsInternalError(err):
|
||||
return errors.NewInternalError(err)
|
||||
default:
|
||||
return err
|
||||
}
|
||||
@@ -84,6 +86,22 @@ func InterpretDeleteError(err error, qualifiedResource unversioned.GroupResource
|
||||
return errors.NewNotFound(qualifiedResource, name)
|
||||
case storage.IsUnreachable(err):
|
||||
return errors.NewServerTimeout(qualifiedResource, "delete", 2) // TODO: make configurable or handled at a higher level
|
||||
case storage.IsTestFailed(err), storage.IsNodeExist(err):
|
||||
return errors.NewConflict(qualifiedResource, name, err)
|
||||
case storage.IsInternalError(err):
|
||||
return errors.NewInternalError(err)
|
||||
default:
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// InterpretWatchError converts a generic error on a watch
|
||||
// operation into the appropriate API error.
|
||||
func InterpretWatchError(err error, resource unversioned.GroupResource, name string) error {
|
||||
switch {
|
||||
case storage.IsInvalidError(err):
|
||||
invalidError, _ := err.(storage.InvalidError)
|
||||
return errors.NewInvalid(unversioned.GroupKind{resource.Group, resource.Resource}, name, invalidError.Errs)
|
||||
default:
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
"k8s.io/kubernetes/pkg/util/sets"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
@@ -204,6 +205,19 @@ func NewDeleteOptions(grace int64) *DeleteOptions {
|
||||
return &DeleteOptions{GracePeriodSeconds: &grace}
|
||||
}
|
||||
|
||||
// NewPreconditionDeleteOptions returns a DeleteOptions with a UID precondition set.
|
||||
func NewPreconditionDeleteOptions(uid string) *DeleteOptions {
|
||||
u := types.UID(uid)
|
||||
p := Preconditions{UID: &u}
|
||||
return &DeleteOptions{Preconditions: &p}
|
||||
}
|
||||
|
||||
// NewUIDPreconditions returns a Preconditions with UID set.
|
||||
func NewUIDPreconditions(uid string) *Preconditions {
|
||||
u := types.UID(uid)
|
||||
return &Preconditions{UID: &u}
|
||||
}
|
||||
|
||||
// this function aims to check if the service's ClusterIP is set or not
|
||||
// the objective is not to perform validation here
|
||||
func IsServiceIPSet(service *Service) bool {
|
||||
|
||||
@@ -17,9 +17,11 @@ limitations under the License.
|
||||
package rest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
)
|
||||
@@ -28,7 +30,11 @@ import (
|
||||
// API conventions.
|
||||
type RESTDeleteStrategy interface {
|
||||
runtime.ObjectTyper
|
||||
}
|
||||
|
||||
// RESTGracefulDeleteStrategy must be implemented by the registry that supports
|
||||
// graceful deletion.
|
||||
type RESTGracefulDeleteStrategy interface {
|
||||
// CheckGracefulDelete should return true if the object can be gracefully deleted and set
|
||||
// any default values on the DeleteOptions.
|
||||
CheckGracefulDelete(obj runtime.Object, options *api.DeleteOptions) bool
|
||||
@@ -40,14 +46,18 @@ type RESTDeleteStrategy interface {
|
||||
// condition cannot be checked or the gracePeriodSeconds is invalid. The options argument may be updated with
|
||||
// default values if graceful is true.
|
||||
func BeforeDelete(strategy RESTDeleteStrategy, ctx api.Context, obj runtime.Object, options *api.DeleteOptions) (graceful, gracefulPending bool, err error) {
|
||||
if strategy == nil {
|
||||
return false, false, nil
|
||||
}
|
||||
objectMeta, _, kerr := objectMetaAndKind(strategy, obj)
|
||||
objectMeta, gvk, kerr := objectMetaAndKind(strategy, obj)
|
||||
if kerr != nil {
|
||||
return false, false, kerr
|
||||
}
|
||||
|
||||
// Checking the Preconditions here to fail early. They'll be enforced later on when we actually do the deletion, too.
|
||||
if options.Preconditions != nil && options.Preconditions.UID != nil && *options.Preconditions.UID != objectMeta.UID {
|
||||
return false, false, errors.NewConflict(unversioned.GroupResource{gvk.Group, gvk.Kind}, objectMeta.Name, fmt.Errorf("the UID in the precondition (%s) does not match the UID in record (%s). The object might have been deleted and then recreated", *options.Preconditions.UID, objectMeta.UID))
|
||||
}
|
||||
gracefulStrategy, ok := strategy.(RESTGracefulDeleteStrategy)
|
||||
if !ok {
|
||||
return false, false, nil
|
||||
}
|
||||
// if the object is already being deleted
|
||||
if objectMeta.DeletionTimestamp != nil {
|
||||
// if we are already being deleted, we may only shorten the deletion grace period
|
||||
@@ -73,7 +83,7 @@ func BeforeDelete(strategy RESTDeleteStrategy, ctx api.Context, obj runtime.Obje
|
||||
return false, true, nil
|
||||
}
|
||||
|
||||
if !strategy.CheckGracefulDelete(obj, options) {
|
||||
if !gracefulStrategy.CheckGracefulDelete(obj, options) {
|
||||
return false, false, nil
|
||||
}
|
||||
now := unversioned.NewTime(unversioned.Now().Add(time.Second * time.Duration(*options.GracePeriodSeconds)))
|
||||
|
||||
@@ -32,6 +32,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
"k8s.io/kubernetes/pkg/util/wait"
|
||||
)
|
||||
|
||||
@@ -154,12 +155,14 @@ func (t *Tester) TestUpdate(valid runtime.Object, setFn SetFunc, getFn GetFunc,
|
||||
t.testUpdateRejectsMismatchedNamespace(copyOrDie(valid), setFn)
|
||||
}
|
||||
t.testUpdateInvokesValidation(copyOrDie(valid), setFn, invalidUpdateFn...)
|
||||
t.testUpdateWithWrongUID(copyOrDie(valid), setFn, getFn)
|
||||
}
|
||||
|
||||
// Test deleting an object.
|
||||
func (t *Tester) TestDelete(valid runtime.Object, setFn SetFunc, getFn GetFunc, isNotFoundFn IsErrorFunc) {
|
||||
t.testDeleteNonExist(copyOrDie(valid))
|
||||
t.testDeleteNoGraceful(copyOrDie(valid), setFn, getFn, isNotFoundFn)
|
||||
t.testDeleteWithUID(copyOrDie(valid), setFn, getFn, isNotFoundFn)
|
||||
}
|
||||
|
||||
// Test gracefully deleting an object.
|
||||
@@ -474,6 +477,26 @@ func (t *Tester) testUpdateInvokesValidation(obj runtime.Object, setFn SetFunc,
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tester) testUpdateWithWrongUID(obj runtime.Object, setFn SetFunc, getFn GetFunc) {
|
||||
ctx := t.TestContext()
|
||||
foo := copyOrDie(obj)
|
||||
t.setObjectMeta(foo, "foo5")
|
||||
objectMeta := t.getObjectMetaOrFail(foo)
|
||||
objectMeta.UID = types.UID("UID0000")
|
||||
if err := setFn(ctx, foo); err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
objectMeta.UID = types.UID("UID1111")
|
||||
|
||||
obj, created, err := t.storage.(rest.Updater).Update(ctx, foo)
|
||||
if created || obj != nil {
|
||||
t.Errorf("expected nil object and no creation for object: %v", foo)
|
||||
}
|
||||
if err == nil || !errors.IsConflict(err) {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tester) testUpdateOnNotFound(obj runtime.Object) {
|
||||
t.setObjectMeta(obj, "foo")
|
||||
_, created, err := t.storage.(rest.Updater).Update(t.TestContext(), obj)
|
||||
@@ -557,6 +580,42 @@ func (t *Tester) testDeleteNonExist(obj runtime.Object) {
|
||||
|
||||
}
|
||||
|
||||
// This test the fast-fail path. We test that the precondition gets verified
|
||||
// again before deleting the object in tests of pkg/storage/etcd.
|
||||
func (t *Tester) testDeleteWithUID(obj runtime.Object, setFn SetFunc, getFn GetFunc, isNotFoundFn IsErrorFunc) {
|
||||
ctx := t.TestContext()
|
||||
|
||||
foo := copyOrDie(obj)
|
||||
t.setObjectMeta(foo, "foo1")
|
||||
objectMeta := t.getObjectMetaOrFail(foo)
|
||||
objectMeta.UID = types.UID("UID0000")
|
||||
if err := setFn(ctx, foo); err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
obj, err := t.storage.(rest.GracefulDeleter).Delete(ctx, objectMeta.Name, api.NewPreconditionDeleteOptions("UID1111"))
|
||||
if err == nil || !errors.IsConflict(err) {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
obj, err = t.storage.(rest.GracefulDeleter).Delete(ctx, objectMeta.Name, api.NewPreconditionDeleteOptions("UID0000"))
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
if !t.returnDeletedObject {
|
||||
if status, ok := obj.(*unversioned.Status); !ok {
|
||||
t.Errorf("expected status of delete, got %v", status)
|
||||
} else if status.Status != unversioned.StatusSuccess {
|
||||
t.Errorf("expected success, got: %v", status.Status)
|
||||
}
|
||||
}
|
||||
|
||||
_, err = getFn(ctx, foo)
|
||||
if err == nil || !isNotFoundFn(err) {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Graceful Deletion tests.
|
||||
|
||||
|
||||
@@ -37015,6 +37015,209 @@ func (x *Binding) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *Preconditions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
if x == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yym1 := z.EncBinary()
|
||||
_ = yym1
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x) {
|
||||
} else {
|
||||
yysep2 := !z.EncBinary()
|
||||
yy2arr2 := z.EncBasicHandle().StructToArray
|
||||
var yyq2 [1]bool
|
||||
_, _, _ = yysep2, yyq2, yy2arr2
|
||||
const yyr2 bool = false
|
||||
yyq2[0] = x.UID != nil
|
||||
var yynn2 int
|
||||
if yyr2 || yy2arr2 {
|
||||
r.EncodeArrayStart(1)
|
||||
} else {
|
||||
yynn2 = 0
|
||||
for _, b := range yyq2 {
|
||||
if b {
|
||||
yynn2++
|
||||
}
|
||||
}
|
||||
r.EncodeMapStart(yynn2)
|
||||
yynn2 = 0
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[0] {
|
||||
if x.UID == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yy4 := *x.UID
|
||||
yym5 := z.EncBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(yy4) {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(yy4))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
r.EncodeNil()
|
||||
}
|
||||
} else {
|
||||
if yyq2[0] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("uid"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if x.UID == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yy6 := *x.UID
|
||||
yym7 := z.EncBinary()
|
||||
_ = yym7
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(yy6) {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(yy6))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
} else {
|
||||
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Preconditions) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
yym1 := z.DecBinary()
|
||||
_ = yym1
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x) {
|
||||
} else {
|
||||
yyct2 := r.ContainerType()
|
||||
if yyct2 == codecSelferValueTypeMap1234 {
|
||||
yyl2 := r.ReadMapStart()
|
||||
if yyl2 == 0 {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
} else {
|
||||
x.codecDecodeSelfFromMap(yyl2, d)
|
||||
}
|
||||
} else if yyct2 == codecSelferValueTypeArray1234 {
|
||||
yyl2 := r.ReadArrayStart()
|
||||
if yyl2 == 0 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
} else {
|
||||
x.codecDecodeSelfFromArray(yyl2, d)
|
||||
}
|
||||
} else {
|
||||
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Preconditions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yys3Slc = z.DecScratchBuffer() // default slice to decode into
|
||||
_ = yys3Slc
|
||||
var yyhl3 bool = l >= 0
|
||||
for yyj3 := 0; ; yyj3++ {
|
||||
if yyhl3 {
|
||||
if yyj3 >= l {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
if r.CheckBreak() {
|
||||
break
|
||||
}
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerMapKey1234)
|
||||
yys3Slc = r.DecodeBytes(yys3Slc, true, true)
|
||||
yys3 := string(yys3Slc)
|
||||
z.DecSendContainerState(codecSelfer_containerMapValue1234)
|
||||
switch yys3 {
|
||||
case "uid":
|
||||
if r.TryDecodeAsNil() {
|
||||
if x.UID != nil {
|
||||
x.UID = nil
|
||||
}
|
||||
} else {
|
||||
if x.UID == nil {
|
||||
x.UID = new(pkg1_types.UID)
|
||||
}
|
||||
yym5 := z.DecBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x.UID) {
|
||||
} else {
|
||||
*((*string)(x.UID)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys3)
|
||||
} // end switch yys3
|
||||
} // end for yyj3
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *Preconditions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj6 int
|
||||
var yyb6 bool
|
||||
var yyhl6 bool = l >= 0
|
||||
yyj6++
|
||||
if yyhl6 {
|
||||
yyb6 = yyj6 > l
|
||||
} else {
|
||||
yyb6 = r.CheckBreak()
|
||||
}
|
||||
if yyb6 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
if x.UID != nil {
|
||||
x.UID = nil
|
||||
}
|
||||
} else {
|
||||
if x.UID == nil {
|
||||
x.UID = new(pkg1_types.UID)
|
||||
}
|
||||
yym8 := z.DecBinary()
|
||||
_ = yym8
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x.UID) {
|
||||
} else {
|
||||
*((*string)(x.UID)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
for {
|
||||
yyj6++
|
||||
if yyhl6 {
|
||||
yyb6 = yyj6 > l
|
||||
} else {
|
||||
yyb6 = r.CheckBreak()
|
||||
}
|
||||
if yyb6 {
|
||||
break
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
z.DecStructFieldNotFound(yyj6-1, "")
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
@@ -37029,16 +37232,18 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
} else {
|
||||
yysep2 := !z.EncBinary()
|
||||
yy2arr2 := z.EncBasicHandle().StructToArray
|
||||
var yyq2 [3]bool
|
||||
var yyq2 [4]bool
|
||||
_, _, _ = yysep2, yyq2, yy2arr2
|
||||
const yyr2 bool = false
|
||||
yyq2[1] = x.Kind != ""
|
||||
yyq2[2] = x.APIVersion != ""
|
||||
yyq2[0] = x.GracePeriodSeconds != nil
|
||||
yyq2[1] = x.Preconditions != nil
|
||||
yyq2[2] = x.Kind != ""
|
||||
yyq2[3] = x.APIVersion != ""
|
||||
var yynn2 int
|
||||
if yyr2 || yy2arr2 {
|
||||
r.EncodeArrayStart(3)
|
||||
r.EncodeArrayStart(4)
|
||||
} else {
|
||||
yynn2 = 1
|
||||
yynn2 = 0
|
||||
for _, b := range yyq2 {
|
||||
if b {
|
||||
yynn2++
|
||||
@@ -37049,55 +37254,59 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if x.GracePeriodSeconds == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yy4 := *x.GracePeriodSeconds
|
||||
yym5 := z.EncBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
if yyq2[0] {
|
||||
if x.GracePeriodSeconds == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
r.EncodeInt(int64(yy4))
|
||||
yy4 := *x.GracePeriodSeconds
|
||||
yym5 := z.EncBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeInt(int64(yy4))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
r.EncodeNil()
|
||||
}
|
||||
} else {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("gracePeriodSeconds"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if x.GracePeriodSeconds == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yy6 := *x.GracePeriodSeconds
|
||||
yym7 := z.EncBinary()
|
||||
_ = yym7
|
||||
if false {
|
||||
if yyq2[0] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("gracePeriodSeconds"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if x.GracePeriodSeconds == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
r.EncodeInt(int64(yy6))
|
||||
yy6 := *x.GracePeriodSeconds
|
||||
yym7 := z.EncBinary()
|
||||
_ = yym7
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeInt(int64(yy6))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[1] {
|
||||
yym9 := z.EncBinary()
|
||||
_ = yym9
|
||||
if false {
|
||||
if x.Preconditions == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
x.Preconditions.CodecEncodeSelf(e)
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
r.EncodeNil()
|
||||
}
|
||||
} else {
|
||||
if yyq2[1] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("kind"))
|
||||
r.EncodeString(codecSelferC_UTF81234, string("preconditions"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym10 := z.EncBinary()
|
||||
_ = yym10
|
||||
if false {
|
||||
if x.Preconditions == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
x.Preconditions.CodecEncodeSelf(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37108,7 +37317,7 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
_ = yym12
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
@@ -37116,11 +37325,36 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
} else {
|
||||
if yyq2[2] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
|
||||
r.EncodeString(codecSelferC_UTF81234, string("kind"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym13 := z.EncBinary()
|
||||
_ = yym13
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[3] {
|
||||
yym15 := z.EncBinary()
|
||||
_ = yym15
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq2[3] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym16 := z.EncBinary()
|
||||
_ = yym16
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
@@ -37203,6 +37437,17 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
*((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64))
|
||||
}
|
||||
}
|
||||
case "preconditions":
|
||||
if r.TryDecodeAsNil() {
|
||||
if x.Preconditions != nil {
|
||||
x.Preconditions = nil
|
||||
}
|
||||
} else {
|
||||
if x.Preconditions == nil {
|
||||
x.Preconditions = new(Preconditions)
|
||||
}
|
||||
x.Preconditions.CodecDecodeSelf(d)
|
||||
}
|
||||
case "kind":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
@@ -37226,16 +37471,16 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj8 int
|
||||
var yyb8 bool
|
||||
var yyhl8 bool = l >= 0
|
||||
yyj8++
|
||||
if yyhl8 {
|
||||
yyb8 = yyj8 > l
|
||||
var yyj9 int
|
||||
var yyb9 bool
|
||||
var yyhl9 bool = l >= 0
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb8 = r.CheckBreak()
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb8 {
|
||||
if yyb9 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@@ -37248,20 +37493,41 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if x.GracePeriodSeconds == nil {
|
||||
x.GracePeriodSeconds = new(int64)
|
||||
}
|
||||
yym10 := z.DecBinary()
|
||||
_ = yym10
|
||||
yym11 := z.DecBinary()
|
||||
_ = yym11
|
||||
if false {
|
||||
} else {
|
||||
*((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64))
|
||||
}
|
||||
}
|
||||
yyj8++
|
||||
if yyhl8 {
|
||||
yyb8 = yyj8 > l
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb8 = r.CheckBreak()
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb8 {
|
||||
if yyb9 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
if x.Preconditions != nil {
|
||||
x.Preconditions = nil
|
||||
}
|
||||
} else {
|
||||
if x.Preconditions == nil {
|
||||
x.Preconditions = new(Preconditions)
|
||||
}
|
||||
x.Preconditions.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb9 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@@ -37271,13 +37537,13 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
yyj8++
|
||||
if yyhl8 {
|
||||
yyb8 = yyj8 > l
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb8 = r.CheckBreak()
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb8 {
|
||||
if yyb9 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@@ -37288,17 +37554,17 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
for {
|
||||
yyj8++
|
||||
if yyhl8 {
|
||||
yyb8 = yyj8 > l
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb8 = r.CheckBreak()
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb8 {
|
||||
if yyb9 {
|
||||
break
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
z.DecStructFieldNotFound(yyj8-1, "")
|
||||
z.DecStructFieldNotFound(yyj9-1, "")
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
@@ -1887,6 +1887,12 @@ type Binding struct {
|
||||
Target ObjectReference `json:"target"`
|
||||
}
|
||||
|
||||
// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
|
||||
type Preconditions struct {
|
||||
// Specifies the target UID.
|
||||
UID *types.UID `json:"uid,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteOptions may be provided when deleting an API object
|
||||
type DeleteOptions struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
@@ -1894,7 +1900,11 @@ type DeleteOptions struct {
|
||||
// Optional duration in seconds before the object should be deleted. Value must be non-negative integer.
|
||||
// The value zero indicates delete immediately. If this value is nil, the default grace period for the
|
||||
// specified type will be used.
|
||||
GracePeriodSeconds *int64 `json:"gracePeriodSeconds"`
|
||||
GracePeriodSeconds *int64 `json:"gracePeriodSeconds,omitempty"`
|
||||
|
||||
// Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be
|
||||
// returned.
|
||||
Preconditions *Preconditions `json:"preconditions,omitempty"`
|
||||
}
|
||||
|
||||
// ExportOptions is the query options to the standard REST get call.
|
||||
|
||||
@@ -174,10 +174,10 @@ const (
|
||||
// Status code 409
|
||||
StatusReasonAlreadyExists StatusReason = "AlreadyExists"
|
||||
|
||||
// StatusReasonConflict means the requested update operation cannot be completed
|
||||
// due to a conflict in the operation. The client may need to alter the request.
|
||||
// Each resource may define custom details that indicate the nature of the
|
||||
// conflict.
|
||||
// StatusReasonConflict means the requested operation cannot be completed
|
||||
// due to a conflict in the operation. The client may need to alter the
|
||||
// request. Each resource may define custom details that indicate the
|
||||
// nature of the conflict.
|
||||
// Status code 409
|
||||
StatusReasonConflict StatusReason = "Conflict"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
||||
runtime "k8s.io/kubernetes/pkg/runtime"
|
||||
types "k8s.io/kubernetes/pkg/types"
|
||||
)
|
||||
|
||||
func autoConvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *AWSElasticBlockStoreVolumeSource, s conversion.Scope) error {
|
||||
@@ -567,6 +568,15 @@ func autoConvert_api_DeleteOptions_To_v1_DeleteOptions(in *api.DeleteOptions, ou
|
||||
} else {
|
||||
out.GracePeriodSeconds = nil
|
||||
}
|
||||
// unable to generate simple pointer conversion for api.Preconditions -> v1.Preconditions
|
||||
if in.Preconditions != nil {
|
||||
out.Preconditions = new(Preconditions)
|
||||
if err := Convert_api_Preconditions_To_v1_Preconditions(in.Preconditions, out.Preconditions, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Preconditions = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2451,6 +2461,23 @@ func Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec,
|
||||
return autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_Preconditions_To_v1_Preconditions(in *api.Preconditions, out *Preconditions, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*api.Preconditions))(in)
|
||||
}
|
||||
if in.UID != nil {
|
||||
out.UID = new(types.UID)
|
||||
*out.UID = *in.UID
|
||||
} else {
|
||||
out.UID = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_api_Preconditions_To_v1_Preconditions(in *api.Preconditions, out *Preconditions, s conversion.Scope) error {
|
||||
return autoConvert_api_Preconditions_To_v1_Preconditions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_Probe_To_v1_Probe(in *api.Probe, out *Probe, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*api.Probe))(in)
|
||||
@@ -3872,6 +3899,15 @@ func autoConvert_v1_DeleteOptions_To_api_DeleteOptions(in *DeleteOptions, out *a
|
||||
} else {
|
||||
out.GracePeriodSeconds = nil
|
||||
}
|
||||
// unable to generate simple pointer conversion for v1.Preconditions -> api.Preconditions
|
||||
if in.Preconditions != nil {
|
||||
out.Preconditions = new(api.Preconditions)
|
||||
if err := Convert_v1_Preconditions_To_api_Preconditions(in.Preconditions, out.Preconditions, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Preconditions = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -5692,6 +5728,23 @@ func Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *PodTemplateSpec, out
|
||||
return autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_Preconditions_To_api_Preconditions(in *Preconditions, out *api.Preconditions, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*Preconditions))(in)
|
||||
}
|
||||
if in.UID != nil {
|
||||
out.UID = new(types.UID)
|
||||
*out.UID = *in.UID
|
||||
} else {
|
||||
out.UID = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1_Preconditions_To_api_Preconditions(in *Preconditions, out *api.Preconditions, s conversion.Scope) error {
|
||||
return autoConvert_v1_Preconditions_To_api_Preconditions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_Probe_To_api_Probe(in *Probe, out *api.Probe, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*Probe))(in)
|
||||
@@ -6616,6 +6669,7 @@ func init() {
|
||||
autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec,
|
||||
autoConvert_api_PodTemplate_To_v1_PodTemplate,
|
||||
autoConvert_api_Pod_To_v1_Pod,
|
||||
autoConvert_api_Preconditions_To_v1_Preconditions,
|
||||
autoConvert_api_Probe_To_v1_Probe,
|
||||
autoConvert_api_RBDVolumeSource_To_v1_RBDVolumeSource,
|
||||
autoConvert_api_RangeAllocation_To_v1_RangeAllocation,
|
||||
@@ -6748,6 +6802,7 @@ func init() {
|
||||
autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec,
|
||||
autoConvert_v1_PodTemplate_To_api_PodTemplate,
|
||||
autoConvert_v1_Pod_To_api_Pod,
|
||||
autoConvert_v1_Preconditions_To_api_Preconditions,
|
||||
autoConvert_v1_Probe_To_api_Probe,
|
||||
autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource,
|
||||
autoConvert_v1_RangeAllocation_To_api_RangeAllocation,
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
||||
runtime "k8s.io/kubernetes/pkg/runtime"
|
||||
types "k8s.io/kubernetes/pkg/types"
|
||||
intstr "k8s.io/kubernetes/pkg/util/intstr"
|
||||
)
|
||||
|
||||
@@ -137,6 +138,7 @@ func init() {
|
||||
DeepCopy_v1_PodTemplate,
|
||||
DeepCopy_v1_PodTemplateList,
|
||||
DeepCopy_v1_PodTemplateSpec,
|
||||
DeepCopy_v1_Preconditions,
|
||||
DeepCopy_v1_PreferredSchedulingTerm,
|
||||
DeepCopy_v1_Probe,
|
||||
DeepCopy_v1_RBDVolumeSource,
|
||||
@@ -595,6 +597,15 @@ func DeepCopy_v1_DeleteOptions(in DeleteOptions, out *DeleteOptions, c *conversi
|
||||
} else {
|
||||
out.GracePeriodSeconds = nil
|
||||
}
|
||||
if in.Preconditions != nil {
|
||||
in, out := in.Preconditions, &out.Preconditions
|
||||
*out = new(Preconditions)
|
||||
if err := DeepCopy_v1_Preconditions(*in, *out, c); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Preconditions = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2195,6 +2206,21 @@ func DeepCopy_v1_PodTemplateSpec(in PodTemplateSpec, out *PodTemplateSpec, c *co
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_v1_Preconditions(in Preconditions, out *Preconditions, c *conversion.Cloner) error {
|
||||
if in.UID != nil {
|
||||
in, out := in.UID, &out.UID
|
||||
*out = new(types.UID)
|
||||
if newVal, err := c.DeepCopy(*in); err != nil {
|
||||
return err
|
||||
} else {
|
||||
**out = newVal.(types.UID)
|
||||
}
|
||||
} else {
|
||||
out.UID = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_v1_PreferredSchedulingTerm(in PreferredSchedulingTerm, out *PreferredSchedulingTerm, c *conversion.Cloner) error {
|
||||
out.Weight = in.Weight
|
||||
if err := DeepCopy_v1_NodeSelectorTerm(in.Preference, &out.Preference, c); err != nil {
|
||||
|
||||
@@ -36735,6 +36735,209 @@ func (x *Binding) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *Preconditions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
if x == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yym1 := z.EncBinary()
|
||||
_ = yym1
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x) {
|
||||
} else {
|
||||
yysep2 := !z.EncBinary()
|
||||
yy2arr2 := z.EncBasicHandle().StructToArray
|
||||
var yyq2 [1]bool
|
||||
_, _, _ = yysep2, yyq2, yy2arr2
|
||||
const yyr2 bool = false
|
||||
yyq2[0] = x.UID != nil
|
||||
var yynn2 int
|
||||
if yyr2 || yy2arr2 {
|
||||
r.EncodeArrayStart(1)
|
||||
} else {
|
||||
yynn2 = 0
|
||||
for _, b := range yyq2 {
|
||||
if b {
|
||||
yynn2++
|
||||
}
|
||||
}
|
||||
r.EncodeMapStart(yynn2)
|
||||
yynn2 = 0
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[0] {
|
||||
if x.UID == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yy4 := *x.UID
|
||||
yym5 := z.EncBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(yy4) {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(yy4))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
r.EncodeNil()
|
||||
}
|
||||
} else {
|
||||
if yyq2[0] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("uid"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if x.UID == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yy6 := *x.UID
|
||||
yym7 := z.EncBinary()
|
||||
_ = yym7
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(yy6) {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(yy6))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
} else {
|
||||
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Preconditions) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
yym1 := z.DecBinary()
|
||||
_ = yym1
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x) {
|
||||
} else {
|
||||
yyct2 := r.ContainerType()
|
||||
if yyct2 == codecSelferValueTypeMap1234 {
|
||||
yyl2 := r.ReadMapStart()
|
||||
if yyl2 == 0 {
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
} else {
|
||||
x.codecDecodeSelfFromMap(yyl2, d)
|
||||
}
|
||||
} else if yyct2 == codecSelferValueTypeArray1234 {
|
||||
yyl2 := r.ReadArrayStart()
|
||||
if yyl2 == 0 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
} else {
|
||||
x.codecDecodeSelfFromArray(yyl2, d)
|
||||
}
|
||||
} else {
|
||||
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Preconditions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yys3Slc = z.DecScratchBuffer() // default slice to decode into
|
||||
_ = yys3Slc
|
||||
var yyhl3 bool = l >= 0
|
||||
for yyj3 := 0; ; yyj3++ {
|
||||
if yyhl3 {
|
||||
if yyj3 >= l {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
if r.CheckBreak() {
|
||||
break
|
||||
}
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerMapKey1234)
|
||||
yys3Slc = r.DecodeBytes(yys3Slc, true, true)
|
||||
yys3 := string(yys3Slc)
|
||||
z.DecSendContainerState(codecSelfer_containerMapValue1234)
|
||||
switch yys3 {
|
||||
case "uid":
|
||||
if r.TryDecodeAsNil() {
|
||||
if x.UID != nil {
|
||||
x.UID = nil
|
||||
}
|
||||
} else {
|
||||
if x.UID == nil {
|
||||
x.UID = new(pkg1_types.UID)
|
||||
}
|
||||
yym5 := z.DecBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x.UID) {
|
||||
} else {
|
||||
*((*string)(x.UID)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys3)
|
||||
} // end switch yys3
|
||||
} // end for yyj3
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *Preconditions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj6 int
|
||||
var yyb6 bool
|
||||
var yyhl6 bool = l >= 0
|
||||
yyj6++
|
||||
if yyhl6 {
|
||||
yyb6 = yyj6 > l
|
||||
} else {
|
||||
yyb6 = r.CheckBreak()
|
||||
}
|
||||
if yyb6 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
if x.UID != nil {
|
||||
x.UID = nil
|
||||
}
|
||||
} else {
|
||||
if x.UID == nil {
|
||||
x.UID = new(pkg1_types.UID)
|
||||
}
|
||||
yym8 := z.DecBinary()
|
||||
_ = yym8
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(x.UID) {
|
||||
} else {
|
||||
*((*string)(x.UID)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
for {
|
||||
yyj6++
|
||||
if yyhl6 {
|
||||
yyb6 = yyj6 > l
|
||||
} else {
|
||||
yyb6 = r.CheckBreak()
|
||||
}
|
||||
if yyb6 {
|
||||
break
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
z.DecStructFieldNotFound(yyj6-1, "")
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
@@ -36749,16 +36952,18 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
} else {
|
||||
yysep2 := !z.EncBinary()
|
||||
yy2arr2 := z.EncBasicHandle().StructToArray
|
||||
var yyq2 [3]bool
|
||||
var yyq2 [4]bool
|
||||
_, _, _ = yysep2, yyq2, yy2arr2
|
||||
const yyr2 bool = false
|
||||
yyq2[1] = x.Kind != ""
|
||||
yyq2[2] = x.APIVersion != ""
|
||||
yyq2[0] = x.GracePeriodSeconds != nil
|
||||
yyq2[1] = x.Preconditions != nil
|
||||
yyq2[2] = x.Kind != ""
|
||||
yyq2[3] = x.APIVersion != ""
|
||||
var yynn2 int
|
||||
if yyr2 || yy2arr2 {
|
||||
r.EncodeArrayStart(3)
|
||||
r.EncodeArrayStart(4)
|
||||
} else {
|
||||
yynn2 = 1
|
||||
yynn2 = 0
|
||||
for _, b := range yyq2 {
|
||||
if b {
|
||||
yynn2++
|
||||
@@ -36769,55 +36974,59 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if x.GracePeriodSeconds == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yy4 := *x.GracePeriodSeconds
|
||||
yym5 := z.EncBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
if yyq2[0] {
|
||||
if x.GracePeriodSeconds == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
r.EncodeInt(int64(yy4))
|
||||
yy4 := *x.GracePeriodSeconds
|
||||
yym5 := z.EncBinary()
|
||||
_ = yym5
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeInt(int64(yy4))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
r.EncodeNil()
|
||||
}
|
||||
} else {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("gracePeriodSeconds"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if x.GracePeriodSeconds == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
yy6 := *x.GracePeriodSeconds
|
||||
yym7 := z.EncBinary()
|
||||
_ = yym7
|
||||
if false {
|
||||
if yyq2[0] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("gracePeriodSeconds"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if x.GracePeriodSeconds == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
r.EncodeInt(int64(yy6))
|
||||
yy6 := *x.GracePeriodSeconds
|
||||
yym7 := z.EncBinary()
|
||||
_ = yym7
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeInt(int64(yy6))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[1] {
|
||||
yym9 := z.EncBinary()
|
||||
_ = yym9
|
||||
if false {
|
||||
if x.Preconditions == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
x.Preconditions.CodecEncodeSelf(e)
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
r.EncodeNil()
|
||||
}
|
||||
} else {
|
||||
if yyq2[1] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("kind"))
|
||||
r.EncodeString(codecSelferC_UTF81234, string("preconditions"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym10 := z.EncBinary()
|
||||
_ = yym10
|
||||
if false {
|
||||
if x.Preconditions == nil {
|
||||
r.EncodeNil()
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
x.Preconditions.CodecEncodeSelf(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36828,7 +37037,7 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
_ = yym12
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
@@ -36836,11 +37045,36 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
} else {
|
||||
if yyq2[2] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
|
||||
r.EncodeString(codecSelferC_UTF81234, string("kind"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym13 := z.EncBinary()
|
||||
_ = yym13
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
|
||||
}
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[3] {
|
||||
yym15 := z.EncBinary()
|
||||
_ = yym15
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, "")
|
||||
}
|
||||
} else {
|
||||
if yyq2[3] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym16 := z.EncBinary()
|
||||
_ = yym16
|
||||
if false {
|
||||
} else {
|
||||
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
|
||||
}
|
||||
@@ -36923,6 +37157,17 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
*((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64))
|
||||
}
|
||||
}
|
||||
case "preconditions":
|
||||
if r.TryDecodeAsNil() {
|
||||
if x.Preconditions != nil {
|
||||
x.Preconditions = nil
|
||||
}
|
||||
} else {
|
||||
if x.Preconditions == nil {
|
||||
x.Preconditions = new(Preconditions)
|
||||
}
|
||||
x.Preconditions.CodecDecodeSelf(d)
|
||||
}
|
||||
case "kind":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
@@ -36946,16 +37191,16 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj8 int
|
||||
var yyb8 bool
|
||||
var yyhl8 bool = l >= 0
|
||||
yyj8++
|
||||
if yyhl8 {
|
||||
yyb8 = yyj8 > l
|
||||
var yyj9 int
|
||||
var yyb9 bool
|
||||
var yyhl9 bool = l >= 0
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb8 = r.CheckBreak()
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb8 {
|
||||
if yyb9 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@@ -36968,20 +37213,41 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if x.GracePeriodSeconds == nil {
|
||||
x.GracePeriodSeconds = new(int64)
|
||||
}
|
||||
yym10 := z.DecBinary()
|
||||
_ = yym10
|
||||
yym11 := z.DecBinary()
|
||||
_ = yym11
|
||||
if false {
|
||||
} else {
|
||||
*((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64))
|
||||
}
|
||||
}
|
||||
yyj8++
|
||||
if yyhl8 {
|
||||
yyb8 = yyj8 > l
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb8 = r.CheckBreak()
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb8 {
|
||||
if yyb9 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
if x.Preconditions != nil {
|
||||
x.Preconditions = nil
|
||||
}
|
||||
} else {
|
||||
if x.Preconditions == nil {
|
||||
x.Preconditions = new(Preconditions)
|
||||
}
|
||||
x.Preconditions.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb9 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@@ -36991,13 +37257,13 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
} else {
|
||||
x.Kind = string(r.DecodeString())
|
||||
}
|
||||
yyj8++
|
||||
if yyhl8 {
|
||||
yyb8 = yyj8 > l
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb8 = r.CheckBreak()
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb8 {
|
||||
if yyb9 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@@ -37008,17 +37274,17 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
x.APIVersion = string(r.DecodeString())
|
||||
}
|
||||
for {
|
||||
yyj8++
|
||||
if yyhl8 {
|
||||
yyb8 = yyj8 > l
|
||||
yyj9++
|
||||
if yyhl9 {
|
||||
yyb9 = yyj9 > l
|
||||
} else {
|
||||
yyb8 = r.CheckBreak()
|
||||
yyb9 = r.CheckBreak()
|
||||
}
|
||||
if yyb8 {
|
||||
if yyb9 {
|
||||
break
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
z.DecStructFieldNotFound(yyj8-1, "")
|
||||
z.DecStructFieldNotFound(yyj9-1, "")
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
||||
@@ -2292,6 +2292,12 @@ type Binding struct {
|
||||
Target ObjectReference `json:"target"`
|
||||
}
|
||||
|
||||
// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
|
||||
type Preconditions struct {
|
||||
// Specifies the target UID.
|
||||
UID *types.UID `json:"uid,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteOptions may be provided when deleting an API object
|
||||
type DeleteOptions struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
@@ -2300,7 +2306,11 @@ type DeleteOptions struct {
|
||||
// The value zero indicates delete immediately. If this value is nil, the default grace period for the
|
||||
// specified type will be used.
|
||||
// Defaults to a per object value if not specified. zero means delete immediately.
|
||||
GracePeriodSeconds *int64 `json:"gracePeriodSeconds"`
|
||||
GracePeriodSeconds *int64 `json:"gracePeriodSeconds,omitempty"`
|
||||
|
||||
// Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be
|
||||
// returned.
|
||||
Preconditions *Preconditions `json:"preconditions,omitempty"`
|
||||
}
|
||||
|
||||
// ExportOptions is the query options to the standard REST get call.
|
||||
|
||||
@@ -296,6 +296,7 @@ func (DaemonEndpoint) SwaggerDoc() map[string]string {
|
||||
var map_DeleteOptions = map[string]string{
|
||||
"": "DeleteOptions may be provided when deleting an API object",
|
||||
"gracePeriodSeconds": "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.",
|
||||
"preconditions": "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.",
|
||||
}
|
||||
|
||||
func (DeleteOptions) SwaggerDoc() map[string]string {
|
||||
@@ -1237,6 +1238,15 @@ func (PodTemplateSpec) SwaggerDoc() map[string]string {
|
||||
return map_PodTemplateSpec
|
||||
}
|
||||
|
||||
var map_Preconditions = map[string]string{
|
||||
"": "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.",
|
||||
"uid": "Specifies the target UID.",
|
||||
}
|
||||
|
||||
func (Preconditions) SwaggerDoc() map[string]string {
|
||||
return map_Preconditions
|
||||
}
|
||||
|
||||
var map_PreferredSchedulingTerm = map[string]string{
|
||||
"": "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).",
|
||||
"weight": "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.",
|
||||
|
||||
Reference in New Issue
Block a user