admission api: cut off api from k8s.io/apiserver

This caused an import cycle: api -> apiserver -> api

Fixes https://github.com/kubernetes/kubernetes/issues/51212
This commit is contained in:
Dr. Stefan Schimanski 2017-08-23 20:55:31 +02:00
parent 625eb9ab7a
commit 8e63473d9e
9 changed files with 219 additions and 217 deletions

View File

@ -19,7 +19,6 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library", "//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission:go_default_library",
], ],
) )

View File

@ -19,7 +19,6 @@ package admission
import ( import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/admission"
"k8s.io/kubernetes/pkg/apis/authentication" "k8s.io/kubernetes/pkg/apis/authentication"
) )
@ -51,7 +50,7 @@ type AdmissionReviewSpec struct {
// OldObject is the existing object. Only populated for UPDATE requests. // OldObject is the existing object. Only populated for UPDATE requests.
OldObject runtime.Object OldObject runtime.Object
// Operation is the operation being performed // Operation is the operation being performed
Operation admission.Operation Operation Operation
// Resource is the name of the resource being requested. This is not the kind. For example: pods // Resource is the name of the resource being requested. This is not the kind. For example: pods
Resource metav1.GroupVersionResource Resource metav1.GroupVersionResource
// SubResource is the name of the subresource being requested. This is a different resource, scoped to the parent // SubResource is the name of the subresource being requested. This is a different resource, scoped to the parent
@ -73,3 +72,14 @@ type AdmissionReviewStatus struct {
// +optional // +optional
Result *metav1.Status Result *metav1.Status
} }
// Operation is the type of resource operation being checked for admission control
type Operation string
// Operation constants
const (
Create Operation = "CREATE"
Update Operation = "UPDATE"
Delete Operation = "DELETE"
Connect Operation = "CONNECT"
)

View File

@ -51,7 +51,7 @@ func NewAdmissionReview(attr admission.Attributes) admissionv1alpha1.AdmissionRe
Version: gvr.Version, Version: gvr.Version,
}, },
SubResource: attr.GetSubresource(), SubResource: attr.GetSubresource(),
Operation: attr.GetOperation(), Operation: admissionv1alpha1.Operation(attr.GetOperation()),
Object: runtime.RawExtension{ Object: runtime.RawExtension{
Object: attr.GetObject(), Object: attr.GetObject(),
}, },

View File

@ -25,7 +25,6 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
pkg_admission "k8s.io/apiserver/pkg/admission"
admission "k8s.io/kubernetes/pkg/apis/admission" admission "k8s.io/kubernetes/pkg/apis/admission"
unsafe "unsafe" unsafe "unsafe"
) )
@ -85,7 +84,7 @@ func autoConvert_v1alpha1_AdmissionReviewSpec_To_admission_AdmissionReviewSpec(i
if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.OldObject, &out.OldObject, s); err != nil { if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.OldObject, &out.OldObject, s); err != nil {
return err return err
} }
out.Operation = pkg_admission.Operation(in.Operation) out.Operation = admission.Operation(in.Operation)
out.Name = in.Name out.Name = in.Name
out.Namespace = in.Namespace out.Namespace = in.Namespace
out.Resource = in.Resource out.Resource = in.Resource
@ -112,7 +111,7 @@ func autoConvert_admission_AdmissionReviewSpec_To_v1alpha1_AdmissionReviewSpec(i
if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.OldObject, &out.OldObject, s); err != nil { if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.OldObject, &out.OldObject, s); err != nil {
return err return err
} }
out.Operation = pkg_admission.Operation(in.Operation) out.Operation = v1alpha1.Operation(in.Operation)
out.Resource = in.Resource out.Resource = in.Resource
out.SubResource = in.SubResource out.SubResource = in.SubResource
// TODO: Inefficient conversion - can we improve it? // TODO: Inefficient conversion - can we improve it?

View File

@ -14,10 +14,6 @@
"ImportPath": "github.com/PuerkitoBio/urlesc", "ImportPath": "github.com/PuerkitoBio/urlesc",
"Rev": "5bd2802263f21d8788851d5305584c82a5c75d7e" "Rev": "5bd2802263f21d8788851d5305584c82a5c75d7e"
}, },
{
"ImportPath": "github.com/davecgh/go-spew/spew",
"Rev": "782f4967f2dc4564575ca782fe2d04090b5faca8"
},
{ {
"ImportPath": "github.com/emicklei/go-restful", "ImportPath": "github.com/emicklei/go-restful",
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46" "Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
@ -26,10 +22,6 @@
"ImportPath": "github.com/emicklei/go-restful/log", "ImportPath": "github.com/emicklei/go-restful/log",
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46" "Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
}, },
{
"ImportPath": "github.com/ghodss/yaml",
"Rev": "73d445a93680fa1a78ae23a5839bad48f32ba1ee"
},
{ {
"ImportPath": "github.com/go-openapi/jsonpointer", "ImportPath": "github.com/go-openapi/jsonpointer",
"Rev": "46af16f9f7b149af66e5d1bd010e3574dc06de98" "Rev": "46af16f9f7b149af66e5d1bd010e3574dc06de98"
@ -145,10 +137,6 @@
{ {
"ImportPath": "gopkg.in/inf.v0", "ImportPath": "gopkg.in/inf.v0",
"Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4" "Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4"
},
{
"ImportPath": "gopkg.in/yaml.v2",
"Rev": "53feefa2559fb8dfa8d81baad31be332c97d6c77"
} }
] ]
} }

View File

@ -25,7 +25,6 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission:go_default_library",
], ],
) )

View File

@ -37,8 +37,6 @@ import math "math"
import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import k8s_io_apiserver_pkg_admission "k8s.io/apiserver/pkg/admission"
import strings "strings" import strings "strings"
import reflect "reflect" import reflect "reflect"
@ -605,7 +603,7 @@ func (m *AdmissionReviewSpec) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Operation = k8s_io_apiserver_pkg_admission.Operation(dAtA[iNdEx:postIndex]) m.Operation = Operation(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 5: case 5:
if wireType != 2 { if wireType != 2 {
@ -988,47 +986,46 @@ func init() {
} }
var fileDescriptorGenerated = []byte{ var fileDescriptorGenerated = []byte{
// 663 bytes of a gzipped FileDescriptorProto // 645 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x4b, 0x1c, 0x49, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x4f, 0x13, 0x41,
0x14, 0xc7, 0xa7, 0x77, 0xc7, 0x71, 0xa6, 0x5c, 0xd6, 0xdd, 0x92, 0x85, 0x46, 0xd8, 0x56, 0x3c, 0x14, 0xc7, 0xbb, 0x5a, 0x4a, 0x3b, 0x18, 0xd1, 0x21, 0x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 0x53, 0x2b, 0xff, 0x36, 0x39, 0xfb, 0x96, 0x50, 0xba, 0x7e, 0x14, 0x54, 0xd2, 0xd7, 0xf9,
0xf8, 0xc9, 0xc4, 0xca, 0xad, 0xfc, 0x5c, 0xe7, 0xdc, 0xaa, 0xa1, 0x6c, 0x3a, 0x29, 0xe8, 0x74, 0x3b, 0x6a, 0x92, 0xa3, 0x33, 0xaf, 0x72, 0x7c, 0xe6, 0x55, 0x4e, 0xce, 0xbc, 0xca, 0xe7, 0xa1,
0x68, 0x8a, 0x35, 0x6b, 0x93, 0xa3, 0xb3, 0xa0, 0x76, 0x7c, 0x16, 0xd4, 0x4e, 0xce, 0x82, 0xda, 0xe7, 0x1c, 0x0d, 0x3d, 0xe7, 0x78, 0xe8, 0x39, 0x27, 0x43, 0xcf, 0xf9, 0x31, 0xf4, 0x9c, 0x2f,
0xbb, 0x71, 0xe0, 0x1d, 0x8d, 0x03, 0xef, 0x78, 0x1c, 0x78, 0x27, 0xe3, 0xc0, 0xfb, 0x3c, 0x0e, 0x3f, 0xbd, 0xca, 0xdb, 0x7a, 0xfe, 0x4a, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x57, 0xa7,
0xbc, 0xf7, 0x5f, 0x82, 0xda, 0xf3, 0x66, 0xb1, 0xc4, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x42, 0x50, 0xd8, 0x05, 0x00, 0x00,
0x53, 0xac, 0x65, 0xf7, 0x05, 0x00, 0x00,
} }

View File

@ -25,11 +25,10 @@ import (
"errors" "errors"
"fmt" "fmt"
codec1978 "github.com/ugorji/go/codec" codec1978 "github.com/ugorji/go/codec"
pkg4_v1 "k8s.io/api/authentication/v1" pkg3_v1 "k8s.io/api/authentication/v1"
pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkg2_runtime "k8s.io/apimachinery/pkg/runtime" pkg2_runtime "k8s.io/apimachinery/pkg/runtime"
pkg5_types "k8s.io/apimachinery/pkg/types" pkg4_types "k8s.io/apimachinery/pkg/types"
pkg3_admission "k8s.io/apiserver/pkg/admission"
"reflect" "reflect"
"runtime" "runtime"
) )
@ -64,12 +63,11 @@ func init() {
panic(err) panic(err)
} }
if false { // reference the types, but skip this branch at build/run time if false { // reference the types, but skip this branch at build/run time
var v0 pkg4_v1.UserInfo var v0 pkg3_v1.UserInfo
var v1 pkg1_v1.TypeMeta var v1 pkg1_v1.TypeMeta
var v2 pkg2_runtime.RawExtension var v2 pkg2_runtime.RawExtension
var v3 pkg5_types.UID var v3 pkg4_types.UID
var v4 pkg3_admission.Operation _, _, _, _ = v0, v1, v2, v3
_, _, _, _, _ = v0, v1, v2, v3, v4
} }
} }
@ -535,13 +533,7 @@ func (x *AdmissionReviewSpec) CodecEncodeSelf(e *codec1978.Encoder) {
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] { if yyq2[3] {
yym19 := z.EncBinary() x.Operation.CodecEncodeSelf(e)
_ = yym19
if false {
} else if z.HasExtensions() && z.EncExt(x.Operation) {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Operation))
}
} else { } else {
r.EncodeString(codecSelferC_UTF81234, "") r.EncodeString(codecSelferC_UTF81234, "")
} }
@ -550,13 +542,7 @@ func (x *AdmissionReviewSpec) CodecEncodeSelf(e *codec1978.Encoder) {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("operation")) r.EncodeString(codecSelferC_UTF81234, string("operation"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym20 := z.EncBinary() x.Operation.CodecEncodeSelf(e)
_ = yym20
if false {
} else if z.HasExtensions() && z.EncExt(x.Operation) {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Operation))
}
} }
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
@ -789,69 +775,63 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder
x.Operation = "" x.Operation = ""
} else { } else {
yyv10 := &x.Operation yyv10 := &x.Operation
yym11 := z.DecBinary() yyv10.CodecDecodeSelf(d)
_ = yym11
if false {
} else if z.HasExtensions() && z.DecExt(yyv10) {
} else {
*((*string)(yyv10)) = r.DecodeString()
}
} }
case "name": case "name":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Name = "" x.Name = ""
} else { } else {
yyv12 := &x.Name yyv11 := &x.Name
yym13 := z.DecBinary() yym12 := z.DecBinary()
_ = yym13 _ = yym12
if false { if false {
} else { } else {
*((*string)(yyv12)) = r.DecodeString() *((*string)(yyv11)) = r.DecodeString()
} }
} }
case "namespace": case "namespace":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Namespace = "" x.Namespace = ""
} else { } else {
yyv14 := &x.Namespace yyv13 := &x.Namespace
yym15 := z.DecBinary() yym14 := z.DecBinary()
_ = yym15 _ = yym14
if false { if false {
} else { } else {
*((*string)(yyv14)) = r.DecodeString() *((*string)(yyv13)) = r.DecodeString()
} }
} }
case "resource": case "resource":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Resource = pkg1_v1.GroupVersionResource{} x.Resource = pkg1_v1.GroupVersionResource{}
} else { } else {
yyv16 := &x.Resource yyv15 := &x.Resource
yym17 := z.DecBinary() yym16 := z.DecBinary()
_ = yym17 _ = yym16
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv16) { } else if z.HasExtensions() && z.DecExt(yyv15) {
} else { } else {
z.DecFallback(yyv16, false) z.DecFallback(yyv15, false)
} }
} }
case "subResource": case "subResource":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.SubResource = "" x.SubResource = ""
} else { } else {
yyv18 := &x.SubResource yyv17 := &x.SubResource
yym19 := z.DecBinary() yym18 := z.DecBinary()
_ = yym19 _ = yym18
if false { if false {
} else { } else {
*((*string)(yyv18)) = r.DecodeString() *((*string)(yyv17)) = r.DecodeString()
} }
} }
case "userInfo": case "userInfo":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.UserInfo = pkg4_v1.UserInfo{} x.UserInfo = pkg3_v1.UserInfo{}
} else { } else {
yyv20 := &x.UserInfo yyv19 := &x.UserInfo
yyv20.CodecDecodeSelf(d) yyv19.CodecDecodeSelf(d)
} }
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
@ -864,16 +844,16 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
var h codecSelfer1234 var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d) z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r _, _, _ = h, z, r
var yyj21 int var yyj20 int
var yyb21 bool var yyb20 bool
var yyhl21 bool = l >= 0 var yyhl20 bool = l >= 0
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -881,22 +861,22 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Kind = pkg1_v1.GroupVersionKind{} x.Kind = pkg1_v1.GroupVersionKind{}
} else { } else {
yyv22 := &x.Kind yyv21 := &x.Kind
yym23 := z.DecBinary() yym22 := z.DecBinary()
_ = yym23 _ = yym22
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv22) { } else if z.HasExtensions() && z.DecExt(yyv21) {
} else { } else {
z.DecFallback(yyv22, false) z.DecFallback(yyv21, false)
} }
} }
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -904,24 +884,24 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Object = pkg2_runtime.RawExtension{} x.Object = pkg2_runtime.RawExtension{}
} else { } else {
yyv24 := &x.Object yyv23 := &x.Object
yym25 := z.DecBinary() yym24 := z.DecBinary()
_ = yym25 _ = yym24
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv24) { } else if z.HasExtensions() && z.DecExt(yyv23) {
} else if !yym25 && z.IsJSONHandle() { } else if !yym24 && z.IsJSONHandle() {
z.DecJSONUnmarshal(yyv24) z.DecJSONUnmarshal(yyv23)
} else { } else {
z.DecFallback(yyv24, false) z.DecFallback(yyv23, false)
} }
} }
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -929,24 +909,24 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.OldObject = pkg2_runtime.RawExtension{} x.OldObject = pkg2_runtime.RawExtension{}
} else { } else {
yyv26 := &x.OldObject yyv25 := &x.OldObject
yym27 := z.DecBinary() yym26 := z.DecBinary()
_ = yym27 _ = yym26
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv26) { } else if z.HasExtensions() && z.DecExt(yyv25) {
} else if !yym27 && z.IsJSONHandle() { } else if !yym26 && z.IsJSONHandle() {
z.DecJSONUnmarshal(yyv26) z.DecJSONUnmarshal(yyv25)
} else { } else {
z.DecFallback(yyv26, false) z.DecFallback(yyv25, false)
} }
} }
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -954,22 +934,16 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Operation = "" x.Operation = ""
} else { } else {
yyv28 := &x.Operation yyv27 := &x.Operation
yym29 := z.DecBinary() yyv27.CodecDecodeSelf(d)
_ = yym29 }
if false { yyj20++
} else if z.HasExtensions() && z.DecExt(yyv28) { if yyhl20 {
yyb20 = yyj20 > l
} else { } else {
*((*string)(yyv28)) = r.DecodeString() yyb20 = r.CheckBreak()
} }
} if yyb20 {
yyj21++
if yyhl21 {
yyb21 = yyj21 > l
} else {
yyb21 = r.CheckBreak()
}
if yyb21 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -977,21 +951,21 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Name = "" x.Name = ""
} else { } else {
yyv30 := &x.Name yyv28 := &x.Name
yym31 := z.DecBinary() yym29 := z.DecBinary()
_ = yym31 _ = yym29
if false { if false {
} else { } else {
*((*string)(yyv30)) = r.DecodeString() *((*string)(yyv28)) = r.DecodeString()
} }
} }
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -999,21 +973,21 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Namespace = "" x.Namespace = ""
} else { } else {
yyv32 := &x.Namespace yyv30 := &x.Namespace
yym33 := z.DecBinary() yym31 := z.DecBinary()
_ = yym33 _ = yym31
if false { if false {
} else { } else {
*((*string)(yyv32)) = r.DecodeString() *((*string)(yyv30)) = r.DecodeString()
} }
} }
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1021,22 +995,22 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Resource = pkg1_v1.GroupVersionResource{} x.Resource = pkg1_v1.GroupVersionResource{}
} else { } else {
yyv34 := &x.Resource yyv32 := &x.Resource
yym35 := z.DecBinary() yym33 := z.DecBinary()
_ = yym35 _ = yym33
if false { if false {
} else if z.HasExtensions() && z.DecExt(yyv34) { } else if z.HasExtensions() && z.DecExt(yyv32) {
} else { } else {
z.DecFallback(yyv34, false) z.DecFallback(yyv32, false)
} }
} }
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1044,43 +1018,43 @@ func (x *AdmissionReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decod
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.SubResource = "" x.SubResource = ""
} else { } else {
yyv36 := &x.SubResource yyv34 := &x.SubResource
yym37 := z.DecBinary() yym35 := z.DecBinary()
_ = yym37 _ = yym35
if false { if false {
} else { } else {
*((*string)(yyv36)) = r.DecodeString() *((*string)(yyv34)) = r.DecodeString()
} }
} }
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.UserInfo = pkg4_v1.UserInfo{} x.UserInfo = pkg3_v1.UserInfo{}
} else { } else {
yyv38 := &x.UserInfo yyv36 := &x.UserInfo
yyv38.CodecDecodeSelf(d) yyv36.CodecDecodeSelf(d)
} }
for { for {
yyj21++ yyj20++
if yyhl21 { if yyhl20 {
yyb21 = yyj21 > l yyb20 = yyj20 > l
} else { } else {
yyb21 = r.CheckBreak() yyb20 = r.CheckBreak()
} }
if yyb21 { if yyb20 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj21-1, "") z.DecStructFieldNotFound(yyj20-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }
@ -1338,3 +1312,29 @@ func (x *AdmissionReviewStatus) codecDecodeSelfFromArray(l int, d *codec1978.Dec
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }
func (x Operation) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
yym1 := z.EncBinary()
_ = yym1
if false {
} else if z.HasExtensions() && z.EncExt(x) {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x))
}
}
func (x *Operation) 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 {
*((*string)(x)) = r.DecodeString()
}
}

View File

@ -20,7 +20,6 @@ import (
authenticationv1 "k8s.io/api/authentication/v1" authenticationv1 "k8s.io/api/authentication/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/admission"
) )
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@ -48,7 +47,7 @@ type AdmissionReviewSpec struct {
// +optional // +optional
OldObject runtime.RawExtension `json:"oldObject,omitempty" protobuf:"bytes,3,opt,name=oldObject"` OldObject runtime.RawExtension `json:"oldObject,omitempty" protobuf:"bytes,3,opt,name=oldObject"`
// Operation is the operation being performed // Operation is the operation being performed
Operation admission.Operation `json:"operation,omitempty" protobuf:"bytes,4,opt,name=operation"` Operation Operation `json:"operation,omitempty" protobuf:"bytes,4,opt,name=operation"`
// Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and // Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and
// rely on the server to generate the name. If that is the case, this method will return the empty string. // rely on the server to generate the name. If that is the case, this method will return the empty string.
// +optional // +optional
@ -78,3 +77,14 @@ type AdmissionReviewStatus struct {
// +optional // +optional
Result *metav1.Status `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` Result *metav1.Status `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
} }
// Operation is the type of resource operation being checked for admission control
type Operation string
// Operation constants
const (
Create Operation = "CREATE"
Update Operation = "UPDATE"
Delete Operation = "DELETE"
Connect Operation = "CONNECT"
)