From 19c0c676d80233411e337ee2b4df811189dcf943 Mon Sep 17 00:00:00 2001 From: Quintin Lee Date: Mon, 8 Aug 2016 13:37:45 -0700 Subject: [PATCH 1/2] Adding imagepolicy group non-autogenerated code. --- .../go2idl/go-to-protobuf/protobuf/cmd.go | 1 + hack/.linted_packages | 1 + hack/make-rules/test.sh | 4 +- pkg/api/testapi/testapi.go | 14 ++ pkg/apis/imagepolicy/doc.go | 20 +++ pkg/apis/imagepolicy/install/install.go | 123 ++++++++++++++++++ pkg/apis/imagepolicy/register.go | 56 ++++++++ pkg/apis/imagepolicy/types.generated.go | 1 + pkg/apis/imagepolicy/types.go | 67 ++++++++++ pkg/apis/imagepolicy/v1alpha1/doc.go | 21 +++ pkg/apis/imagepolicy/v1alpha1/register.go | 46 +++++++ .../imagepolicy/v1alpha1/types.generated.go | 1 + pkg/apis/imagepolicy/v1alpha1/types.go | 67 ++++++++++ 13 files changed, 421 insertions(+), 1 deletion(-) create mode 100644 pkg/apis/imagepolicy/doc.go create mode 100644 pkg/apis/imagepolicy/install/install.go create mode 100644 pkg/apis/imagepolicy/register.go create mode 100644 pkg/apis/imagepolicy/types.generated.go create mode 100644 pkg/apis/imagepolicy/types.go create mode 100644 pkg/apis/imagepolicy/v1alpha1/doc.go create mode 100644 pkg/apis/imagepolicy/v1alpha1/register.go create mode 100644 pkg/apis/imagepolicy/v1alpha1/types.generated.go create mode 100644 pkg/apis/imagepolicy/v1alpha1/types.go diff --git a/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go b/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go index e70c823b7f7af..cec560097d543 100644 --- a/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go +++ b/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go @@ -77,6 +77,7 @@ func New() *Generator { `k8s.io/kubernetes/pkg/apis/rbac/v1alpha1`, `k8s.io/kubernetes/federation/apis/federation/v1beta1`, `k8s.io/kubernetes/pkg/apis/certificates/v1alpha1`, + `k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1`, }, ","), DropEmbeddedFields: "k8s.io/kubernetes/pkg/api/unversioned.TypeMeta", } diff --git a/hack/.linted_packages b/hack/.linted_packages index b5aa4116216a4..6b47894abf446 100644 --- a/hack/.linted_packages +++ b/hack/.linted_packages @@ -70,6 +70,7 @@ pkg/apis/extensions/install pkg/apis/extensions/v1beta1 pkg/apis/policy/install pkg/apis/rbac/install +pkg/apis/imagepolicy/install pkg/api/v1 pkg/auth/authenticator pkg/auth/authorizer/union diff --git a/hack/make-rules/test.sh b/hack/make-rules/test.sh index 5a336c0fca70e..6ad4af19961ae 100755 --- a/hack/make-rules/test.sh +++ b/hack/make-rules/test.sh @@ -66,7 +66,7 @@ KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-} # "v1,compute/v1alpha1,experimental/v1alpha2;v1,compute/v2,experimental/v1alpha3" # FIXME: due to current implementation of a test client (see: pkg/api/testapi/testapi.go) # ONLY the last version is tested in each group. -KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,apps/v1alpha1,authentication.k8s.io/v1beta1,authorization.k8s.io/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,federation/v1beta1,policy/v1alpha1,rbac.authorization.k8s.io/v1alpha1"} +KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,apps/v1alpha1,authentication.k8s.io/v1beta1,authorization.k8s.io/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,federation/v1beta1,policy/v1alpha1,rbac.authorization.k8s.io/v1alpha1,imagepolicy.k8s.io/v1alpha1"} # once we have multiple group supports # Create a junit-style XML test report in this directory if set. KUBE_JUNIT_REPORT_DIR=${KUBE_JUNIT_REPORT_DIR:-} @@ -156,6 +156,8 @@ junitFilenamePrefix() { fi mkdir -p "${KUBE_JUNIT_REPORT_DIR}" local KUBE_TEST_API_NO_SLASH="${KUBE_TEST_API//\//-}" + # This file name isn't parsed by anything, and tee needs a shorter file name. + KUBE_TEST_API_NO_SLASH="${KUBE_TEST_API_NO_SLASH//k8s.io-/}" echo "${KUBE_JUNIT_REPORT_DIR}/junit_${KUBE_TEST_API_NO_SLASH}_$(kube::util::sortable_date)" } diff --git a/pkg/api/testapi/testapi.go b/pkg/api/testapi/testapi.go index 7cd00d2b770d0..a2b9c3b1f7b40 100644 --- a/pkg/api/testapi/testapi.go +++ b/pkg/api/testapi/testapi.go @@ -34,6 +34,7 @@ import ( "k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/certificates" "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/apis/imagepolicy" "k8s.io/kubernetes/pkg/apis/policy" "k8s.io/kubernetes/pkg/apis/rbac" "k8s.io/kubernetes/pkg/runtime" @@ -49,6 +50,7 @@ import ( _ "k8s.io/kubernetes/pkg/apis/certificates/install" _ "k8s.io/kubernetes/pkg/apis/componentconfig/install" _ "k8s.io/kubernetes/pkg/apis/extensions/install" + _ "k8s.io/kubernetes/pkg/apis/imagepolicy/install" _ "k8s.io/kubernetes/pkg/apis/policy/install" _ "k8s.io/kubernetes/pkg/apis/rbac/install" ) @@ -64,6 +66,7 @@ var ( Federation TestGroup Rbac TestGroup Certificates TestGroup + ImagePolicy TestGroup serializer runtime.SerializerInfo storageSerializer runtime.SerializerInfo @@ -225,6 +228,16 @@ func init() { } } + if _, ok := Groups[imagepolicy.GroupName]; !ok { + externalGroupVersion := unversioned.GroupVersion{Group: imagepolicy.GroupName, Version: registered.GroupOrDie(imagepolicy.GroupName).GroupVersion.Version} + Groups[imagepolicy.GroupName] = TestGroup{ + externalGroupVersion: externalGroupVersion, + internalGroupVersion: imagepolicy.SchemeGroupVersion, + internalTypes: api.Scheme.KnownTypes(imagepolicy.SchemeGroupVersion), + externalTypes: api.Scheme.KnownTypes(externalGroupVersion), + } + } + Default = Groups[api.GroupName] Autoscaling = Groups[autoscaling.GroupName] Batch = Groups[batch.GroupName] @@ -234,6 +247,7 @@ func init() { Extensions = Groups[extensions.GroupName] Federation = Groups[federation.GroupName] Rbac = Groups[rbac.GroupName] + ImagePolicy = Groups[imagepolicy.GroupName] } func (g TestGroup) ContentConfig() (string, *unversioned.GroupVersion, runtime.Codec) { diff --git a/pkg/apis/imagepolicy/doc.go b/pkg/apis/imagepolicy/doc.go new file mode 100644 index 0000000000000..cf47b047ec0f4 --- /dev/null +++ b/pkg/apis/imagepolicy/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package,register +// +groupName=imagepolicy.k8s.io + +package imagepolicy // import "k8s.io/kubernetes/pkg/apis/imagepolicy" diff --git a/pkg/apis/imagepolicy/install/install.go b/pkg/apis/imagepolicy/install/install.go new file mode 100644 index 0000000000000..29a0b7ae2ddfd --- /dev/null +++ b/pkg/apis/imagepolicy/install/install.go @@ -0,0 +1,123 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package install installs the experimental API group, making it available as +// an option to all of the API encoding/decoding machinery. +package install + +import ( + "fmt" + + "github.com/golang/glog" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/imagepolicy" + "k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/sets" +) + +const importPrefix = "k8s.io/kubernetes/pkg/apis/imagepolicy" + +var accessor = meta.NewAccessor() + +// availableVersions lists all known external versions for this group from most preferred to least preferred +var availableVersions = []unversioned.GroupVersion{v1alpha1.SchemeGroupVersion} + +func init() { + registered.RegisterVersions(availableVersions) + externalVersions := []unversioned.GroupVersion{} + for _, v := range availableVersions { + if registered.IsAllowedVersion(v) { + externalVersions = append(externalVersions, v) + } + } + if len(externalVersions) == 0 { + glog.V(4).Infof("No version is registered for group %v", imagepolicy.GroupName) + return + } + + if err := registered.EnableVersions(externalVersions...); err != nil { + glog.V(4).Infof("%v", err) + return + } + if err := enableVersions(externalVersions); err != nil { + glog.V(4).Infof("%v", err) + return + } +} + +// TODO: enableVersions should be centralized rather than spread in each API +// group. +// We can combine registered.RegisterVersions, registered.EnableVersions and +// registered.RegisterGroup once we have moved enableVersions there. +func enableVersions(externalVersions []unversioned.GroupVersion) error { + addVersionsToScheme(externalVersions...) + preferredExternalVersion := externalVersions[0] + + groupMeta := apimachinery.GroupMeta{ + GroupVersion: preferredExternalVersion, + GroupVersions: externalVersions, + RESTMapper: newRESTMapper(externalVersions), + SelfLinker: runtime.SelfLinker(accessor), + InterfacesFor: interfacesFor, + } + + if err := registered.RegisterGroup(groupMeta); err != nil { + return err + } + api.RegisterRESTMapper(groupMeta.RESTMapper) + return nil +} + +func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) { + // add the internal version to Scheme + imagepolicy.AddToScheme(api.Scheme) + // add the enabled external versions to Scheme + for _, v := range externalVersions { + if !registered.IsEnabledVersion(v) { + glog.Errorf("Version %s is not enabled, so it will not be added to the Scheme.", v) + continue + } + switch v { + case v1alpha1.SchemeGroupVersion: + v1alpha1.AddToScheme(api.Scheme) + } + } +} + +func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { + rootScoped := sets.NewString("ImageReview") + ignoredKinds := sets.NewString() + return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) +} + +func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { + switch version { + case v1alpha1.SchemeGroupVersion: + return &meta.VersionInterfaces{ + ObjectConvertor: api.Scheme, + MetadataAccessor: accessor, + }, nil + default: + g, _ := registered.Group(imagepolicy.GroupName) + return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, g.GroupVersions) + } +} diff --git a/pkg/apis/imagepolicy/register.go b/pkg/apis/imagepolicy/register.go new file mode 100644 index 0000000000000..8f35a3eb88041 --- /dev/null +++ b/pkg/apis/imagepolicy/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package imagepolicy + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +// GroupName is the group name use in this package +const GroupName = "imagepolicy.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) unversioned.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns back a Group qualified GroupResource +func Resource(resource string) unversioned.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &api.ListOptions{}, + &api.DeleteOptions{}, + &api.ExportOptions{}, + + &ImageReview{}, + ) + // versioned.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/imagepolicy/types.generated.go b/pkg/apis/imagepolicy/types.generated.go new file mode 100644 index 0000000000000..a908b2786ba0a --- /dev/null +++ b/pkg/apis/imagepolicy/types.generated.go @@ -0,0 +1 @@ +package imagepolicy diff --git a/pkg/apis/imagepolicy/types.go b/pkg/apis/imagepolicy/types.go new file mode 100644 index 0000000000000..0be81f38b9b93 --- /dev/null +++ b/pkg/apis/imagepolicy/types.go @@ -0,0 +1,67 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package imagepolicy + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" +) + +// +genclient=true +// +nonNamespaced=true +// +noMethods=true + +// ImageReview checks if the set of images in a pod are allowed. +type ImageReview struct { + unversioned.TypeMeta + api.ObjectMeta + + // Spec holds information about the pod being evaluated + Spec ImageReviewSpec + + // Status is filled in by the backend and indicates whether the pod should be allowed. + Status ImageReviewStatus +} + +// ImageReviewSpec is a description of the pod creation request. +type ImageReviewSpec struct { + // Containers is a list of a subset of the information in each container of the Pod being created. + Containers []ImageReviewContainerSpec + // Annotations is a list of key-value pairs extracted from the Pod's annotations. + // It only includes keys which match the pattern `*.image-policy.k8s.io/*`. + // It is up to each webhook backend to determine how to interpret these annotations, if at all. + Annotations map[string]string + // Namespace is the namespace the pod is being created in. + Namespace string +} + +// ImageReviewContainerSpec is a description of a container within the pod creation request. +type ImageReviewContainerSpec struct { + // This can be in the form image:tag or image@SHA:012345679abcdef. + Image string + // In future, we may add command line overrides, exec health check command lines, and so on. +} + +// ImageReviewStatus is the result of the token authentication request. +type ImageReviewStatus struct { + // Allowed indicates that all images were allowed to be run. + Allowed bool + // Reason should be empty unless Allowed is false in which case it + // may contain a short description of what is wrong. Kubernetes + // may truncate excessively long errors when displaying to the user. + Reason string +} diff --git a/pkg/apis/imagepolicy/v1alpha1/doc.go b/pkg/apis/imagepolicy/v1alpha1/doc.go new file mode 100644 index 0000000000000..d325b7dfb8eeb --- /dev/null +++ b/pkg/apis/imagepolicy/v1alpha1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +groupName=imagepolicy.k8s.io +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/imagepolicy + +package v1alpha1 // import "k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1" diff --git a/pkg/apis/imagepolicy/v1alpha1/register.go b/pkg/apis/imagepolicy/v1alpha1/register.go new file mode 100644 index 0000000000000..88848b8ac8ac3 --- /dev/null +++ b/pkg/apis/imagepolicy/v1alpha1/register.go @@ -0,0 +1,46 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/runtime" +) + +// GroupName is the group name for this API. +const GroupName = "imagepolicy.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &v1.ListOptions{}, + &v1.DeleteOptions{}, + &v1.ExportOptions{}, + + &ImageReview{}, + ) + return nil +} diff --git a/pkg/apis/imagepolicy/v1alpha1/types.generated.go b/pkg/apis/imagepolicy/v1alpha1/types.generated.go new file mode 100644 index 0000000000000..1c267880d8df1 --- /dev/null +++ b/pkg/apis/imagepolicy/v1alpha1/types.generated.go @@ -0,0 +1 @@ +package v1alpha1 diff --git a/pkg/apis/imagepolicy/v1alpha1/types.go b/pkg/apis/imagepolicy/v1alpha1/types.go new file mode 100644 index 0000000000000..ef9fc544d3404 --- /dev/null +++ b/pkg/apis/imagepolicy/v1alpha1/types.go @@ -0,0 +1,67 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" +) + +// +genclient=true +// +nonNamespaced=true +// +noMethods=true + +// ImageReview checks if the set of images in a pod are allowed. +type ImageReview struct { + unversioned.TypeMeta `json:",inline"` + v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec holds information about the pod being evaluated + Spec ImageReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // Status is filled in by the backend and indicates whether the pod should be allowed. + Status ImageReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// ImageReviewSpec is a description of the pod creation request. +type ImageReviewSpec struct { + // Containers is a list of a subset of the information in each container of the Pod being created. + Containers []ImageReviewContainerSpec `json:"containers,omitempty" protobuf:"bytes,1,rep,name=containers"` + // Annotations is a list of key-value pairs extracted from the Pod's annotations. + // It only includes keys which match the pattern `*.image-policy.k8s.io/*`. + // It is up to each webhook backend to determine how to interpret these annotations, if at all. + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,2,rep,name=annotations"` + // Namespace is the namespace the pod is being created in. + Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` +} + +// ImageReviewContainerSpec is a description of a container within the pod creation request. +type ImageReviewContainerSpec struct { + // This can be in the form image:tag or image@SHA:012345679abcdef. + Image string `json:"image,omitempty" protobuf:"bytes,1,opt,name=image"` + // In future, we may add command line overrides, exec health check command lines, and so on. +} + +// ImageReviewStatus is the result of the token authentication request. +type ImageReviewStatus struct { + // Allowed indicates that all images were allowed to be run. + Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"` + // Reason should be empty unless Allowed is false in which case it + // may contain a short description of what is wrong. Kubernetes + // may truncate excessively long errors when displaying to the user. + Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"` +} From 5ddb869a292f0c1266b2dec4cfb2af678cfb98b3 Mon Sep 17 00:00:00 2001 From: Quintin Lee Date: Tue, 16 Aug 2016 12:39:25 -0700 Subject: [PATCH 2/2] Adding auto-generated code for ImagePolicy webhook. --- pkg/apis/imagepolicy/types.generated.go | 2145 +++++++++++++++++ pkg/apis/imagepolicy/v1alpha1/generated.pb.go | 1059 ++++++++ pkg/apis/imagepolicy/v1alpha1/generated.proto | 74 + .../imagepolicy/v1alpha1/types.generated.go | 1207 ++++++++++ .../v1alpha1/zz_generated.conversion.go | 169 ++ .../v1alpha1/zz_generated.deepcopy.go | 105 + pkg/apis/imagepolicy/zz_generated.deepcopy.go | 105 + 7 files changed, 4864 insertions(+) create mode 100644 pkg/apis/imagepolicy/v1alpha1/generated.pb.go create mode 100644 pkg/apis/imagepolicy/v1alpha1/generated.proto create mode 100644 pkg/apis/imagepolicy/v1alpha1/zz_generated.conversion.go create mode 100644 pkg/apis/imagepolicy/v1alpha1/zz_generated.deepcopy.go create mode 100644 pkg/apis/imagepolicy/zz_generated.deepcopy.go diff --git a/pkg/apis/imagepolicy/types.generated.go b/pkg/apis/imagepolicy/types.generated.go index a908b2786ba0a..2ef7312fef2ea 100644 --- a/pkg/apis/imagepolicy/types.generated.go +++ b/pkg/apis/imagepolicy/types.generated.go @@ -1 +1,2146 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ + package imagepolicy + +import ( + "errors" + "fmt" + codec1978 "github.com/ugorji/go/codec" + pkg2_api "k8s.io/kubernetes/pkg/api" + pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" + pkg3_types "k8s.io/kubernetes/pkg/types" + "reflect" + "runtime" + time "time" +) + +const ( + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- + codecSelferValueTypeArray1234 = 10 + codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 +) + +var ( + codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer1234 struct{} + +func init() { + if codec1978.GenVersion != 5 { + _, file, _, _ := runtime.Caller(0) + err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", + 5, codec1978.GenVersion, file) + panic(err) + } + if false { // reference the types, but skip this branch at build/run time + var v0 pkg2_api.ObjectMeta + var v1 pkg1_unversioned.TypeMeta + var v2 pkg3_types.UID + var v3 time.Time + _, _, _, _ = v0, v1, v2, v3 + } +} + +func (x *ImageReview) 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 [18]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = x.Name != "" + yyq2[3] = x.GenerateName != "" + yyq2[4] = x.Namespace != "" + yyq2[5] = x.SelfLink != "" + yyq2[6] = x.UID != "" + yyq2[7] = x.ResourceVersion != "" + yyq2[8] = x.Generation != 0 + yyq2[9] = true + yyq2[10] = x.ObjectMeta.DeletionTimestamp != nil && x.DeletionTimestamp != nil + yyq2[11] = x.ObjectMeta.DeletionGracePeriodSeconds != nil && x.DeletionGracePeriodSeconds != nil + yyq2[12] = len(x.Labels) != 0 + yyq2[13] = len(x.Annotations) != 0 + yyq2[14] = len(x.OwnerReferences) != 0 + yyq2[15] = len(x.Finalizers) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(18) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.GenerateName)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("generateName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.GenerateName)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("namespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SelfLink)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("selfLink")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SelfLink)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else if z.HasExtensions() && z.EncExt(x.UID) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.UID)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("uid")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else if z.HasExtensions() && z.EncExt(x.UID) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.UID)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resourceVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yym28 := z.EncBinary() + _ = yym28 + if false { + } else { + r.EncodeInt(int64(x.Generation)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("generation")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym29 := z.EncBinary() + _ = yym29 + if false { + } else { + r.EncodeInt(int64(x.Generation)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + yy31 := &x.CreationTimestamp + yym32 := z.EncBinary() + _ = yym32 + if false { + } else if z.HasExtensions() && z.EncExt(yy31) { + } else if yym32 { + z.EncBinaryMarshal(yy31) + } else if !yym32 && z.IsJSONHandle() { + z.EncJSONMarshal(yy31) + } else { + z.EncFallback(yy31) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("creationTimestamp")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy33 := &x.CreationTimestamp + yym34 := z.EncBinary() + _ = yym34 + if false { + } else if z.HasExtensions() && z.EncExt(yy33) { + } else if yym34 { + z.EncBinaryMarshal(yy33) + } else if !yym34 && z.IsJSONHandle() { + z.EncJSONMarshal(yy33) + } else { + z.EncFallback(yy33) + } + } + } + var yyn35 bool + if x.ObjectMeta.DeletionTimestamp == nil { + yyn35 = true + goto LABEL35 + } + LABEL35: + if yyr2 || yy2arr2 { + if yyn35 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { + if x.DeletionTimestamp == nil { + r.EncodeNil() + } else { + yym36 := z.EncBinary() + _ = yym36 + if false { + } else if z.HasExtensions() && z.EncExt(x.DeletionTimestamp) { + } else if yym36 { + z.EncBinaryMarshal(x.DeletionTimestamp) + } else if !yym36 && z.IsJSONHandle() { + z.EncJSONMarshal(x.DeletionTimestamp) + } else { + z.EncFallback(x.DeletionTimestamp) + } + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("deletionTimestamp")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn35 { + r.EncodeNil() + } else { + if x.DeletionTimestamp == nil { + r.EncodeNil() + } else { + yym37 := z.EncBinary() + _ = yym37 + if false { + } else if z.HasExtensions() && z.EncExt(x.DeletionTimestamp) { + } else if yym37 { + z.EncBinaryMarshal(x.DeletionTimestamp) + } else if !yym37 && z.IsJSONHandle() { + z.EncJSONMarshal(x.DeletionTimestamp) + } else { + z.EncFallback(x.DeletionTimestamp) + } + } + } + } + } + var yyn38 bool + if x.ObjectMeta.DeletionGracePeriodSeconds == nil { + yyn38 = true + goto LABEL38 + } + LABEL38: + if yyr2 || yy2arr2 { + if yyn38 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { + if x.DeletionGracePeriodSeconds == nil { + r.EncodeNil() + } else { + yy39 := *x.DeletionGracePeriodSeconds + yym40 := z.EncBinary() + _ = yym40 + if false { + } else { + r.EncodeInt(int64(yy39)) + } + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("deletionGracePeriodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn38 { + r.EncodeNil() + } else { + if x.DeletionGracePeriodSeconds == nil { + r.EncodeNil() + } else { + yy41 := *x.DeletionGracePeriodSeconds + yym42 := z.EncBinary() + _ = yym42 + if false { + } else { + r.EncodeInt(int64(yy41)) + } + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + if x.Labels == nil { + r.EncodeNil() + } else { + yym44 := z.EncBinary() + _ = yym44 + if false { + } else { + z.F.EncMapStringStringV(x.Labels, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("labels")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Labels == nil { + r.EncodeNil() + } else { + yym45 := z.EncBinary() + _ = yym45 + if false { + } else { + z.F.EncMapStringStringV(x.Labels, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { + if x.Annotations == nil { + r.EncodeNil() + } else { + yym47 := z.EncBinary() + _ = yym47 + if false { + } else { + z.F.EncMapStringStringV(x.Annotations, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("annotations")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Annotations == nil { + r.EncodeNil() + } else { + yym48 := z.EncBinary() + _ = yym48 + if false { + } else { + z.F.EncMapStringStringV(x.Annotations, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { + if x.OwnerReferences == nil { + r.EncodeNil() + } else { + yym50 := z.EncBinary() + _ = yym50 + if false { + } else { + h.encSliceapi_OwnerReference(([]pkg2_api.OwnerReference)(x.OwnerReferences), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("ownerReferences")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.OwnerReferences == nil { + r.EncodeNil() + } else { + yym51 := z.EncBinary() + _ = yym51 + if false { + } else { + h.encSliceapi_OwnerReference(([]pkg2_api.OwnerReference)(x.OwnerReferences), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { + if x.Finalizers == nil { + r.EncodeNil() + } else { + yym53 := z.EncBinary() + _ = yym53 + if false { + } else { + z.F.EncSliceStringV(x.Finalizers, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("finalizers")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Finalizers == nil { + r.EncodeNil() + } else { + yym54 := z.EncBinary() + _ = yym54 + if false { + } else { + z.F.EncSliceStringV(x.Finalizers, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy56 := &x.Spec + yy56.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy57 := &x.Spec + yy57.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy59 := &x.Status + yy59.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy60 := &x.Status + yy60.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ImageReview) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym61 := z.DecBinary() + _ = yym61 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct62 := r.ContainerType() + if yyct62 == codecSelferValueTypeMap1234 { + yyl62 := r.ReadMapStart() + if yyl62 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl62, d) + } + } else if yyct62 == codecSelferValueTypeArray1234 { + yyl62 := r.ReadArrayStart() + if yyl62 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl62, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ImageReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys63Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys63Slc + var yyhl63 bool = l >= 0 + for yyj63 := 0; ; yyj63++ { + if yyhl63 { + if yyj63 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys63Slc = r.DecodeBytes(yys63Slc, true, true) + yys63 := string(yys63Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys63 { + 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 "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "generateName": + if r.TryDecodeAsNil() { + x.GenerateName = "" + } else { + x.GenerateName = string(r.DecodeString()) + } + case "namespace": + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + case "selfLink": + if r.TryDecodeAsNil() { + x.SelfLink = "" + } else { + x.SelfLink = string(r.DecodeString()) + } + case "uid": + if r.TryDecodeAsNil() { + x.UID = "" + } else { + x.UID = pkg3_types.UID(r.DecodeString()) + } + case "resourceVersion": + if r.TryDecodeAsNil() { + x.ResourceVersion = "" + } else { + x.ResourceVersion = string(r.DecodeString()) + } + case "generation": + if r.TryDecodeAsNil() { + x.Generation = 0 + } else { + x.Generation = int64(r.DecodeInt(64)) + } + case "creationTimestamp": + if r.TryDecodeAsNil() { + x.CreationTimestamp = pkg1_unversioned.Time{} + } else { + yyv73 := &x.CreationTimestamp + yym74 := z.DecBinary() + _ = yym74 + if false { + } else if z.HasExtensions() && z.DecExt(yyv73) { + } else if yym74 { + z.DecBinaryUnmarshal(yyv73) + } else if !yym74 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv73) + } else { + z.DecFallback(yyv73, false) + } + } + case "deletionTimestamp": + if x.ObjectMeta.DeletionTimestamp == nil { + x.ObjectMeta.DeletionTimestamp = new(pkg1_unversioned.Time) + } + if r.TryDecodeAsNil() { + if x.DeletionTimestamp != nil { + x.DeletionTimestamp = nil + } + } else { + if x.DeletionTimestamp == nil { + x.DeletionTimestamp = new(pkg1_unversioned.Time) + } + yym76 := z.DecBinary() + _ = yym76 + if false { + } else if z.HasExtensions() && z.DecExt(x.DeletionTimestamp) { + } else if yym76 { + z.DecBinaryUnmarshal(x.DeletionTimestamp) + } else if !yym76 && z.IsJSONHandle() { + z.DecJSONUnmarshal(x.DeletionTimestamp) + } else { + z.DecFallback(x.DeletionTimestamp, false) + } + } + case "deletionGracePeriodSeconds": + if x.ObjectMeta.DeletionGracePeriodSeconds == nil { + x.ObjectMeta.DeletionGracePeriodSeconds = new(int64) + } + if r.TryDecodeAsNil() { + if x.DeletionGracePeriodSeconds != nil { + x.DeletionGracePeriodSeconds = nil + } + } else { + if x.DeletionGracePeriodSeconds == nil { + x.DeletionGracePeriodSeconds = new(int64) + } + yym78 := z.DecBinary() + _ = yym78 + if false { + } else { + *((*int64)(x.DeletionGracePeriodSeconds)) = int64(r.DecodeInt(64)) + } + } + case "labels": + if r.TryDecodeAsNil() { + x.Labels = nil + } else { + yyv79 := &x.Labels + yym80 := z.DecBinary() + _ = yym80 + if false { + } else { + z.F.DecMapStringStringX(yyv79, false, d) + } + } + case "annotations": + if r.TryDecodeAsNil() { + x.Annotations = nil + } else { + yyv81 := &x.Annotations + yym82 := z.DecBinary() + _ = yym82 + if false { + } else { + z.F.DecMapStringStringX(yyv81, false, d) + } + } + case "ownerReferences": + if r.TryDecodeAsNil() { + x.OwnerReferences = nil + } else { + yyv83 := &x.OwnerReferences + yym84 := z.DecBinary() + _ = yym84 + if false { + } else { + h.decSliceapi_OwnerReference((*[]pkg2_api.OwnerReference)(yyv83), d) + } + } + case "finalizers": + if r.TryDecodeAsNil() { + x.Finalizers = nil + } else { + yyv85 := &x.Finalizers + yym86 := z.DecBinary() + _ = yym86 + if false { + } else { + z.F.DecSliceStringX(yyv85, false, d) + } + } + case "Spec": + if r.TryDecodeAsNil() { + x.Spec = ImageReviewSpec{} + } else { + yyv87 := &x.Spec + yyv87.CodecDecodeSelf(d) + } + case "Status": + if r.TryDecodeAsNil() { + x.Status = ImageReviewStatus{} + } else { + yyv88 := &x.Status + yyv88.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys63) + } // end switch yys63 + } // end for yyj63 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ImageReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj89 int + var yyb89 bool + var yyhl89 bool = l >= 0 + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.GenerateName = "" + } else { + x.GenerateName = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SelfLink = "" + } else { + x.SelfLink = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.UID = "" + } else { + x.UID = pkg3_types.UID(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ResourceVersion = "" + } else { + x.ResourceVersion = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Generation = 0 + } else { + x.Generation = int64(r.DecodeInt(64)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CreationTimestamp = pkg1_unversioned.Time{} + } else { + yyv99 := &x.CreationTimestamp + yym100 := z.DecBinary() + _ = yym100 + if false { + } else if z.HasExtensions() && z.DecExt(yyv99) { + } else if yym100 { + z.DecBinaryUnmarshal(yyv99) + } else if !yym100 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv99) + } else { + z.DecFallback(yyv99, false) + } + } + if x.ObjectMeta.DeletionTimestamp == nil { + x.ObjectMeta.DeletionTimestamp = new(pkg1_unversioned.Time) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.DeletionTimestamp != nil { + x.DeletionTimestamp = nil + } + } else { + if x.DeletionTimestamp == nil { + x.DeletionTimestamp = new(pkg1_unversioned.Time) + } + yym102 := z.DecBinary() + _ = yym102 + if false { + } else if z.HasExtensions() && z.DecExt(x.DeletionTimestamp) { + } else if yym102 { + z.DecBinaryUnmarshal(x.DeletionTimestamp) + } else if !yym102 && z.IsJSONHandle() { + z.DecJSONUnmarshal(x.DeletionTimestamp) + } else { + z.DecFallback(x.DeletionTimestamp, false) + } + } + if x.ObjectMeta.DeletionGracePeriodSeconds == nil { + x.ObjectMeta.DeletionGracePeriodSeconds = new(int64) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.DeletionGracePeriodSeconds != nil { + x.DeletionGracePeriodSeconds = nil + } + } else { + if x.DeletionGracePeriodSeconds == nil { + x.DeletionGracePeriodSeconds = new(int64) + } + yym104 := z.DecBinary() + _ = yym104 + if false { + } else { + *((*int64)(x.DeletionGracePeriodSeconds)) = int64(r.DecodeInt(64)) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Labels = nil + } else { + yyv105 := &x.Labels + yym106 := z.DecBinary() + _ = yym106 + if false { + } else { + z.F.DecMapStringStringX(yyv105, false, d) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Annotations = nil + } else { + yyv107 := &x.Annotations + yym108 := z.DecBinary() + _ = yym108 + if false { + } else { + z.F.DecMapStringStringX(yyv107, false, d) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.OwnerReferences = nil + } else { + yyv109 := &x.OwnerReferences + yym110 := z.DecBinary() + _ = yym110 + if false { + } else { + h.decSliceapi_OwnerReference((*[]pkg2_api.OwnerReference)(yyv109), d) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Finalizers = nil + } else { + yyv111 := &x.Finalizers + yym112 := z.DecBinary() + _ = yym112 + if false { + } else { + z.F.DecSliceStringX(yyv111, false, d) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ImageReviewSpec{} + } else { + yyv113 := &x.Spec + yyv113.CodecDecodeSelf(d) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ImageReviewStatus{} + } else { + yyv114 := &x.Status + yyv114.CodecDecodeSelf(d) + } + for { + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj89-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ImageReviewSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym115 := z.EncBinary() + _ = yym115 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep116 := !z.EncBinary() + yy2arr116 := z.EncBasicHandle().StructToArray + var yyq116 [3]bool + _, _, _ = yysep116, yyq116, yy2arr116 + const yyr116 bool = false + var yynn116 int + if yyr116 || yy2arr116 { + r.EncodeArrayStart(3) + } else { + yynn116 = 3 + for _, b := range yyq116 { + if b { + yynn116++ + } + } + r.EncodeMapStart(yynn116) + yynn116 = 0 + } + if yyr116 || yy2arr116 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Containers == nil { + r.EncodeNil() + } else { + yym118 := z.EncBinary() + _ = yym118 + if false { + } else { + h.encSliceImageReviewContainerSpec(([]ImageReviewContainerSpec)(x.Containers), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Containers")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Containers == nil { + r.EncodeNil() + } else { + yym119 := z.EncBinary() + _ = yym119 + if false { + } else { + h.encSliceImageReviewContainerSpec(([]ImageReviewContainerSpec)(x.Containers), e) + } + } + } + if yyr116 || yy2arr116 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Annotations == nil { + r.EncodeNil() + } else { + yym121 := z.EncBinary() + _ = yym121 + if false { + } else { + z.F.EncMapStringStringV(x.Annotations, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Annotations")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Annotations == nil { + r.EncodeNil() + } else { + yym122 := z.EncBinary() + _ = yym122 + if false { + } else { + z.F.EncMapStringStringV(x.Annotations, false, e) + } + } + } + if yyr116 || yy2arr116 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym124 := z.EncBinary() + _ = yym124 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Namespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym125 := z.EncBinary() + _ = yym125 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } + if yyr116 || yy2arr116 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ImageReviewSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym126 := z.DecBinary() + _ = yym126 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct127 := r.ContainerType() + if yyct127 == codecSelferValueTypeMap1234 { + yyl127 := r.ReadMapStart() + if yyl127 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl127, d) + } + } else if yyct127 == codecSelferValueTypeArray1234 { + yyl127 := r.ReadArrayStart() + if yyl127 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl127, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ImageReviewSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys128Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys128Slc + var yyhl128 bool = l >= 0 + for yyj128 := 0; ; yyj128++ { + if yyhl128 { + if yyj128 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys128Slc = r.DecodeBytes(yys128Slc, true, true) + yys128 := string(yys128Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys128 { + case "Containers": + if r.TryDecodeAsNil() { + x.Containers = nil + } else { + yyv129 := &x.Containers + yym130 := z.DecBinary() + _ = yym130 + if false { + } else { + h.decSliceImageReviewContainerSpec((*[]ImageReviewContainerSpec)(yyv129), d) + } + } + case "Annotations": + if r.TryDecodeAsNil() { + x.Annotations = nil + } else { + yyv131 := &x.Annotations + yym132 := z.DecBinary() + _ = yym132 + if false { + } else { + z.F.DecMapStringStringX(yyv131, false, d) + } + } + case "Namespace": + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys128) + } // end switch yys128 + } // end for yyj128 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ImageReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj134 int + var yyb134 bool + var yyhl134 bool = l >= 0 + yyj134++ + if yyhl134 { + yyb134 = yyj134 > l + } else { + yyb134 = r.CheckBreak() + } + if yyb134 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Containers = nil + } else { + yyv135 := &x.Containers + yym136 := z.DecBinary() + _ = yym136 + if false { + } else { + h.decSliceImageReviewContainerSpec((*[]ImageReviewContainerSpec)(yyv135), d) + } + } + yyj134++ + if yyhl134 { + yyb134 = yyj134 > l + } else { + yyb134 = r.CheckBreak() + } + if yyb134 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Annotations = nil + } else { + yyv137 := &x.Annotations + yym138 := z.DecBinary() + _ = yym138 + if false { + } else { + z.F.DecMapStringStringX(yyv137, false, d) + } + } + yyj134++ + if yyhl134 { + yyb134 = yyj134 > l + } else { + yyb134 = r.CheckBreak() + } + if yyb134 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + for { + yyj134++ + if yyhl134 { + yyb134 = yyj134 > l + } else { + yyb134 = r.CheckBreak() + } + if yyb134 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj134-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ImageReviewContainerSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym140 := z.EncBinary() + _ = yym140 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep141 := !z.EncBinary() + yy2arr141 := z.EncBasicHandle().StructToArray + var yyq141 [1]bool + _, _, _ = yysep141, yyq141, yy2arr141 + const yyr141 bool = false + var yynn141 int + if yyr141 || yy2arr141 { + r.EncodeArrayStart(1) + } else { + yynn141 = 1 + for _, b := range yyq141 { + if b { + yynn141++ + } + } + r.EncodeMapStart(yynn141) + yynn141 = 0 + } + if yyr141 || yy2arr141 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym143 := z.EncBinary() + _ = yym143 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Image)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Image")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym144 := z.EncBinary() + _ = yym144 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Image)) + } + } + if yyr141 || yy2arr141 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ImageReviewContainerSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym145 := z.DecBinary() + _ = yym145 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct146 := r.ContainerType() + if yyct146 == codecSelferValueTypeMap1234 { + yyl146 := r.ReadMapStart() + if yyl146 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl146, d) + } + } else if yyct146 == codecSelferValueTypeArray1234 { + yyl146 := r.ReadArrayStart() + if yyl146 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl146, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ImageReviewContainerSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys147Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys147Slc + var yyhl147 bool = l >= 0 + for yyj147 := 0; ; yyj147++ { + if yyhl147 { + if yyj147 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys147Slc = r.DecodeBytes(yys147Slc, true, true) + yys147 := string(yys147Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys147 { + case "Image": + if r.TryDecodeAsNil() { + x.Image = "" + } else { + x.Image = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys147) + } // end switch yys147 + } // end for yyj147 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ImageReviewContainerSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj149 int + var yyb149 bool + var yyhl149 bool = l >= 0 + yyj149++ + if yyhl149 { + yyb149 = yyj149 > l + } else { + yyb149 = r.CheckBreak() + } + if yyb149 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Image = "" + } else { + x.Image = string(r.DecodeString()) + } + for { + yyj149++ + if yyhl149 { + yyb149 = yyj149 > l + } else { + yyb149 = r.CheckBreak() + } + if yyb149 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj149-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ImageReviewStatus) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym151 := z.EncBinary() + _ = yym151 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep152 := !z.EncBinary() + yy2arr152 := z.EncBasicHandle().StructToArray + var yyq152 [2]bool + _, _, _ = yysep152, yyq152, yy2arr152 + const yyr152 bool = false + var yynn152 int + if yyr152 || yy2arr152 { + r.EncodeArrayStart(2) + } else { + yynn152 = 2 + for _, b := range yyq152 { + if b { + yynn152++ + } + } + r.EncodeMapStart(yynn152) + yynn152 = 0 + } + if yyr152 || yy2arr152 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym154 := z.EncBinary() + _ = yym154 + if false { + } else { + r.EncodeBool(bool(x.Allowed)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Allowed")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym155 := z.EncBinary() + _ = yym155 + if false { + } else { + r.EncodeBool(bool(x.Allowed)) + } + } + if yyr152 || yy2arr152 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym157 := z.EncBinary() + _ = yym157 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Reason")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym158 := z.EncBinary() + _ = yym158 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) + } + } + if yyr152 || yy2arr152 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ImageReviewStatus) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym159 := z.DecBinary() + _ = yym159 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct160 := r.ContainerType() + if yyct160 == codecSelferValueTypeMap1234 { + yyl160 := r.ReadMapStart() + if yyl160 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl160, d) + } + } else if yyct160 == codecSelferValueTypeArray1234 { + yyl160 := r.ReadArrayStart() + if yyl160 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl160, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ImageReviewStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys161Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys161Slc + var yyhl161 bool = l >= 0 + for yyj161 := 0; ; yyj161++ { + if yyhl161 { + if yyj161 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys161Slc = r.DecodeBytes(yys161Slc, true, true) + yys161 := string(yys161Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys161 { + case "Allowed": + if r.TryDecodeAsNil() { + x.Allowed = false + } else { + x.Allowed = bool(r.DecodeBool()) + } + case "Reason": + if r.TryDecodeAsNil() { + x.Reason = "" + } else { + x.Reason = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys161) + } // end switch yys161 + } // end for yyj161 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ImageReviewStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj164 int + var yyb164 bool + var yyhl164 bool = l >= 0 + yyj164++ + if yyhl164 { + yyb164 = yyj164 > l + } else { + yyb164 = r.CheckBreak() + } + if yyb164 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Allowed = false + } else { + x.Allowed = bool(r.DecodeBool()) + } + yyj164++ + if yyhl164 { + yyb164 = yyj164 > l + } else { + yyb164 = r.CheckBreak() + } + if yyb164 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Reason = "" + } else { + x.Reason = string(r.DecodeString()) + } + for { + yyj164++ + if yyhl164 { + yyb164 = yyj164 > l + } else { + yyb164 = r.CheckBreak() + } + if yyb164 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj164-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) encSliceapi_OwnerReference(v []pkg2_api.OwnerReference, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv167 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy168 := &yyv167 + yy168.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceapi_OwnerReference(v *[]pkg2_api.OwnerReference, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv169 := *v + yyh169, yyl169 := z.DecSliceHelperStart() + var yyc169 bool + if yyl169 == 0 { + if yyv169 == nil { + yyv169 = []pkg2_api.OwnerReference{} + yyc169 = true + } else if len(yyv169) != 0 { + yyv169 = yyv169[:0] + yyc169 = true + } + } else if yyl169 > 0 { + var yyrr169, yyrl169 int + var yyrt169 bool + if yyl169 > cap(yyv169) { + + yyrg169 := len(yyv169) > 0 + yyv2169 := yyv169 + yyrl169, yyrt169 = z.DecInferLen(yyl169, z.DecBasicHandle().MaxInitLen, 72) + if yyrt169 { + if yyrl169 <= cap(yyv169) { + yyv169 = yyv169[:yyrl169] + } else { + yyv169 = make([]pkg2_api.OwnerReference, yyrl169) + } + } else { + yyv169 = make([]pkg2_api.OwnerReference, yyrl169) + } + yyc169 = true + yyrr169 = len(yyv169) + if yyrg169 { + copy(yyv169, yyv2169) + } + } else if yyl169 != len(yyv169) { + yyv169 = yyv169[:yyl169] + yyc169 = true + } + yyj169 := 0 + for ; yyj169 < yyrr169; yyj169++ { + yyh169.ElemContainerState(yyj169) + if r.TryDecodeAsNil() { + yyv169[yyj169] = pkg2_api.OwnerReference{} + } else { + yyv170 := &yyv169[yyj169] + yyv170.CodecDecodeSelf(d) + } + + } + if yyrt169 { + for ; yyj169 < yyl169; yyj169++ { + yyv169 = append(yyv169, pkg2_api.OwnerReference{}) + yyh169.ElemContainerState(yyj169) + if r.TryDecodeAsNil() { + yyv169[yyj169] = pkg2_api.OwnerReference{} + } else { + yyv171 := &yyv169[yyj169] + yyv171.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj169 := 0 + for ; !r.CheckBreak(); yyj169++ { + + if yyj169 >= len(yyv169) { + yyv169 = append(yyv169, pkg2_api.OwnerReference{}) // var yyz169 pkg2_api.OwnerReference + yyc169 = true + } + yyh169.ElemContainerState(yyj169) + if yyj169 < len(yyv169) { + if r.TryDecodeAsNil() { + yyv169[yyj169] = pkg2_api.OwnerReference{} + } else { + yyv172 := &yyv169[yyj169] + yyv172.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj169 < len(yyv169) { + yyv169 = yyv169[:yyj169] + yyc169 = true + } else if yyj169 == 0 && yyv169 == nil { + yyv169 = []pkg2_api.OwnerReference{} + yyc169 = true + } + } + yyh169.End() + if yyc169 { + *v = yyv169 + } +} + +func (x codecSelfer1234) encSliceImageReviewContainerSpec(v []ImageReviewContainerSpec, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv173 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy174 := &yyv173 + yy174.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceImageReviewContainerSpec(v *[]ImageReviewContainerSpec, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv175 := *v + yyh175, yyl175 := z.DecSliceHelperStart() + var yyc175 bool + if yyl175 == 0 { + if yyv175 == nil { + yyv175 = []ImageReviewContainerSpec{} + yyc175 = true + } else if len(yyv175) != 0 { + yyv175 = yyv175[:0] + yyc175 = true + } + } else if yyl175 > 0 { + var yyrr175, yyrl175 int + var yyrt175 bool + if yyl175 > cap(yyv175) { + + yyrg175 := len(yyv175) > 0 + yyv2175 := yyv175 + yyrl175, yyrt175 = z.DecInferLen(yyl175, z.DecBasicHandle().MaxInitLen, 16) + if yyrt175 { + if yyrl175 <= cap(yyv175) { + yyv175 = yyv175[:yyrl175] + } else { + yyv175 = make([]ImageReviewContainerSpec, yyrl175) + } + } else { + yyv175 = make([]ImageReviewContainerSpec, yyrl175) + } + yyc175 = true + yyrr175 = len(yyv175) + if yyrg175 { + copy(yyv175, yyv2175) + } + } else if yyl175 != len(yyv175) { + yyv175 = yyv175[:yyl175] + yyc175 = true + } + yyj175 := 0 + for ; yyj175 < yyrr175; yyj175++ { + yyh175.ElemContainerState(yyj175) + if r.TryDecodeAsNil() { + yyv175[yyj175] = ImageReviewContainerSpec{} + } else { + yyv176 := &yyv175[yyj175] + yyv176.CodecDecodeSelf(d) + } + + } + if yyrt175 { + for ; yyj175 < yyl175; yyj175++ { + yyv175 = append(yyv175, ImageReviewContainerSpec{}) + yyh175.ElemContainerState(yyj175) + if r.TryDecodeAsNil() { + yyv175[yyj175] = ImageReviewContainerSpec{} + } else { + yyv177 := &yyv175[yyj175] + yyv177.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj175 := 0 + for ; !r.CheckBreak(); yyj175++ { + + if yyj175 >= len(yyv175) { + yyv175 = append(yyv175, ImageReviewContainerSpec{}) // var yyz175 ImageReviewContainerSpec + yyc175 = true + } + yyh175.ElemContainerState(yyj175) + if yyj175 < len(yyv175) { + if r.TryDecodeAsNil() { + yyv175[yyj175] = ImageReviewContainerSpec{} + } else { + yyv178 := &yyv175[yyj175] + yyv178.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj175 < len(yyv175) { + yyv175 = yyv175[:yyj175] + yyc175 = true + } else if yyj175 == 0 && yyv175 == nil { + yyv175 = []ImageReviewContainerSpec{} + yyc175 = true + } + } + yyh175.End() + if yyc175 { + *v = yyv175 + } +} diff --git a/pkg/apis/imagepolicy/v1alpha1/generated.pb.go b/pkg/apis/imagepolicy/v1alpha1/generated.pb.go new file mode 100644 index 0000000000000..19ad75020287c --- /dev/null +++ b/pkg/apis/imagepolicy/v1alpha1/generated.pb.go @@ -0,0 +1,1059 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by protoc-gen-gogo. +// source: k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1/generated.proto +// DO NOT EDIT! + +/* + Package v1alpha1 is a generated protocol buffer package. + + It is generated from these files: + k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1/generated.proto + + It has these top-level messages: + ImageReview + ImageReviewContainerSpec + ImageReviewSpec + ImageReviewStatus +*/ +package v1alpha1 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +const _ = proto.GoGoProtoPackageIsVersion1 + +func (m *ImageReview) Reset() { *m = ImageReview{} } +func (*ImageReview) ProtoMessage() {} +func (*ImageReview) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} } + +func (m *ImageReviewContainerSpec) Reset() { *m = ImageReviewContainerSpec{} } +func (*ImageReviewContainerSpec) ProtoMessage() {} +func (*ImageReviewContainerSpec) Descriptor() ([]byte, []int) { + return fileDescriptorGenerated, []int{1} +} + +func (m *ImageReviewSpec) Reset() { *m = ImageReviewSpec{} } +func (*ImageReviewSpec) ProtoMessage() {} +func (*ImageReviewSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} } + +func (m *ImageReviewStatus) Reset() { *m = ImageReviewStatus{} } +func (*ImageReviewStatus) ProtoMessage() {} +func (*ImageReviewStatus) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} } + +func init() { + proto.RegisterType((*ImageReview)(nil), "k8s.io.kubernetes.pkg.apis.imagepolicy.v1alpha1.ImageReview") + proto.RegisterType((*ImageReviewContainerSpec)(nil), "k8s.io.kubernetes.pkg.apis.imagepolicy.v1alpha1.ImageReviewContainerSpec") + proto.RegisterType((*ImageReviewSpec)(nil), "k8s.io.kubernetes.pkg.apis.imagepolicy.v1alpha1.ImageReviewSpec") + proto.RegisterType((*ImageReviewStatus)(nil), "k8s.io.kubernetes.pkg.apis.imagepolicy.v1alpha1.ImageReviewStatus") +} +func (m *ImageReview) 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 *ImageReview) 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 + 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:]) + if err != nil { + return 0, err + } + i += n3 + return i, nil +} + +func (m *ImageReviewContainerSpec) 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 *ImageReviewContainerSpec) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Image))) + i += copy(data[i:], m.Image) + return i, nil +} + +func (m *ImageReviewSpec) 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 *ImageReviewSpec) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Containers) > 0 { + for _, msg := range m.Containers { + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Annotations) > 0 { + for k := range m.Annotations { + data[i] = 0x12 + i++ + v := m.Annotations[k] + mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) + i = encodeVarintGenerated(data, i, uint64(mapSize)) + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(len(k))) + i += copy(data[i:], k) + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(len(v))) + i += copy(data[i:], v) + } + } + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Namespace))) + i += copy(data[i:], m.Namespace) + return i, nil +} + +func (m *ImageReviewStatus) 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 *ImageReviewStatus) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0x8 + i++ + if m.Allowed { + data[i] = 1 + } else { + data[i] = 0 + } + i++ + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Reason))) + i += copy(data[i:], m.Reason) + return i, nil +} + +func encodeFixed64Generated(data []byte, offset int, v uint64) int { + data[offset] = uint8(v) + data[offset+1] = uint8(v >> 8) + data[offset+2] = uint8(v >> 16) + data[offset+3] = uint8(v >> 24) + data[offset+4] = uint8(v >> 32) + data[offset+5] = uint8(v >> 40) + data[offset+6] = uint8(v >> 48) + data[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Generated(data []byte, offset int, v uint32) int { + data[offset] = uint8(v) + data[offset+1] = uint8(v >> 8) + data[offset+2] = uint8(v >> 16) + data[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintGenerated(data []byte, offset int, v uint64) int { + for v >= 1<<7 { + data[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + data[offset] = uint8(v) + return offset + 1 +} +func (m *ImageReview) Size() (n int) { + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ImageReviewContainerSpec) Size() (n int) { + var l int + _ = l + l = len(m.Image) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ImageReviewSpec) Size() (n int) { + var l int + _ = l + if len(m.Containers) > 0 { + for _, e := range m.Containers { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Annotations) > 0 { + for k, v := range m.Annotations { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + l = len(m.Namespace) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ImageReviewStatus) Size() (n int) { + var l int + _ = l + n += 2 + l = len(m.Reason) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func sovGenerated(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ImageReview) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ImageReview{`, + `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ImageReviewSpec", "ImageReviewSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ImageReviewStatus", "ImageReviewStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ImageReviewContainerSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ImageReviewContainerSpec{`, + `Image:` + fmt.Sprintf("%v", this.Image) + `,`, + `}`, + }, "") + return s +} +func (this *ImageReviewSpec) String() string { + if this == nil { + return "nil" + } + keysForAnnotations := make([]string, 0, len(this.Annotations)) + for k := range this.Annotations { + keysForAnnotations = append(keysForAnnotations, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations) + mapStringForAnnotations := "map[string]string{" + for _, k := range keysForAnnotations { + mapStringForAnnotations += fmt.Sprintf("%v: %v,", k, this.Annotations[k]) + } + mapStringForAnnotations += "}" + s := strings.Join([]string{`&ImageReviewSpec{`, + `Containers:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Containers), "ImageReviewContainerSpec", "ImageReviewContainerSpec", 1), `&`, ``, 1) + `,`, + `Annotations:` + mapStringForAnnotations + `,`, + `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, + `}`, + }, "") + return s +} +func (this *ImageReviewStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ImageReviewStatus{`, + `Allowed:` + fmt.Sprintf("%v", this.Allowed) + `,`, + `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ImageReview) 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: ImageReview: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageReview: 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 Spec", 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.Spec.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", 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.Status.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 *ImageReviewContainerSpec) 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: ImageReviewContainerSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageReviewContainerSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Image = string(data[iNdEx:postIndex]) + 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 *ImageReviewSpec) 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: ImageReviewSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageReviewSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Containers", 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 + } + m.Containers = append(m.Containers, ImageReviewContainerSpec{}) + if err := m.Containers[len(m.Containers)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", 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 + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(data[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(data[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + if m.Annotations == nil { + m.Annotations = make(map[string]string) + } + m.Annotations[mapkey] = mapvalue + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(data[iNdEx:postIndex]) + 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 *ImageReviewStatus) 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: ImageReviewStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageReviewStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Allowed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Allowed = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reason = string(data[iNdEx:postIndex]) + 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 skipGenerated(data []byte) (n int, err error) { + l := len(data) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if data[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipGenerated(data[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") +) + +var fileDescriptorGenerated = []byte{ + // 569 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x92, 0xbf, 0x6e, 0x13, 0x4f, + 0x10, 0xc7, 0xfd, 0x27, 0x76, 0xec, 0xf5, 0xef, 0x47, 0x92, 0x85, 0xc2, 0x72, 0xe1, 0x20, 0x23, + 0xa1, 0x80, 0xc8, 0xae, 0x1c, 0x09, 0x29, 0xa2, 0x20, 0xe4, 0x10, 0x45, 0x0a, 0x40, 0x2c, 0x0d, + 0xa2, 0x5b, 0x9f, 0x27, 0x97, 0x8b, 0xcf, 0xbb, 0xa7, 0xdb, 0x3d, 0x47, 0x2e, 0x90, 0x28, 0x29, + 0x28, 0x78, 0x1b, 0x5e, 0xc1, 0x65, 0x4a, 0xaa, 0x08, 0xc2, 0x8b, 0xb0, 0xb7, 0x77, 0xce, 0x1d, + 0x76, 0x5c, 0x20, 0x17, 0x23, 0xed, 0xec, 0xec, 0x7c, 0xe6, 0x3b, 0x33, 0x8b, 0x8e, 0x46, 0x87, + 0x8a, 0xf8, 0x92, 0x8e, 0xe2, 0x01, 0x44, 0x02, 0x34, 0x28, 0x1a, 0x8e, 0x3c, 0xca, 0x43, 0x5f, + 0x51, 0x7f, 0xcc, 0x3d, 0x08, 0x65, 0xe0, 0xbb, 0x53, 0x3a, 0xe9, 0xf3, 0x20, 0x3c, 0xe3, 0x7d, + 0xea, 0x81, 0x80, 0x88, 0x6b, 0x18, 0x92, 0x30, 0x92, 0x5a, 0x62, 0x9a, 0x02, 0x48, 0x0e, 0x20, + 0x06, 0x40, 0x12, 0x00, 0x29, 0x00, 0xc8, 0x1c, 0xd0, 0xd9, 0xf7, 0x7c, 0x7d, 0x16, 0x0f, 0x88, + 0x2b, 0xc7, 0xd4, 0x93, 0x9e, 0xa4, 0x96, 0x33, 0x88, 0x4f, 0xad, 0x67, 0x1d, 0x7b, 0x4a, 0xf9, + 0x9d, 0x83, 0x95, 0x02, 0x69, 0x04, 0x4a, 0xc6, 0x91, 0x0b, 0x8b, 0x9a, 0x3a, 0x4f, 0x57, 0xe7, + 0xc4, 0x62, 0x02, 0x91, 0xf2, 0xa5, 0x80, 0xe1, 0x52, 0xda, 0x93, 0xd5, 0x69, 0x93, 0xa5, 0xc6, + 0x3b, 0xfb, 0xb7, 0xbf, 0x8e, 0x62, 0xa1, 0xfd, 0xf1, 0xb2, 0xa6, 0xfe, 0xed, 0xcf, 0x63, 0xed, + 0x07, 0xd4, 0x17, 0x5a, 0xe9, 0x68, 0x31, 0xa5, 0xf7, 0xbd, 0x82, 0x5a, 0x27, 0xc9, 0x08, 0x19, + 0x4c, 0x7c, 0xb8, 0xc0, 0x1f, 0x50, 0x63, 0x0c, 0x9a, 0x0f, 0xb9, 0xe6, 0xed, 0xf2, 0xfd, 0xf2, + 0x5e, 0xeb, 0x60, 0x8f, 0xac, 0x9c, 0xbe, 0x19, 0x38, 0x79, 0x3b, 0x38, 0x07, 0x57, 0xbf, 0x36, + 0x39, 0x0e, 0x9e, 0x5d, 0xed, 0x96, 0xae, 0xaf, 0x76, 0x51, 0x7e, 0xc7, 0x6e, 0x68, 0x78, 0x80, + 0x36, 0x54, 0x08, 0x6e, 0xbb, 0x62, 0xa9, 0x2f, 0xc8, 0x3f, 0xee, 0x94, 0x14, 0x54, 0xbe, 0x37, + 0x1c, 0xe7, 0xbf, 0xac, 0xda, 0x46, 0xe2, 0x31, 0xcb, 0xc6, 0xe7, 0xa8, 0xae, 0x34, 0xd7, 0xb1, + 0x6a, 0x57, 0x6d, 0x15, 0x67, 0xad, 0x2a, 0x96, 0xe4, 0xdc, 0xc9, 0xea, 0xd4, 0x53, 0x9f, 0x65, + 0x15, 0x7a, 0x47, 0xa8, 0x5d, 0x78, 0xfc, 0x52, 0x0a, 0xcd, 0x7d, 0x33, 0xdb, 0x44, 0x0d, 0x7e, + 0x80, 0x6a, 0x96, 0x6e, 0x47, 0xd8, 0x74, 0xfe, 0xcf, 0x10, 0xb5, 0x34, 0x21, 0x8d, 0xf5, 0xbe, + 0x56, 0xd1, 0xd6, 0x42, 0x53, 0xf8, 0x13, 0x42, 0xee, 0x9c, 0xa4, 0x4c, 0x76, 0xd5, 0x34, 0x71, + 0xb2, 0x4e, 0x13, 0x7f, 0xe9, 0xca, 0x37, 0x74, 0x73, 0xad, 0x58, 0xa1, 0x20, 0xfe, 0x52, 0x46, + 0x2d, 0x2e, 0x84, 0x34, 0x1d, 0x9a, 0xef, 0xab, 0xcc, 0xae, 0x12, 0x01, 0xef, 0xd6, 0xdd, 0x15, + 0x39, 0xce, 0x99, 0xaf, 0x84, 0x8e, 0xa6, 0xce, 0xdd, 0x4c, 0x48, 0xab, 0x10, 0x61, 0xc5, 0xd2, + 0x98, 0xa2, 0xa6, 0xe0, 0x63, 0x50, 0x21, 0x77, 0xc1, 0x6e, 0xb3, 0xe9, 0xec, 0x64, 0x49, 0xcd, + 0x37, 0xf3, 0x00, 0xcb, 0xdf, 0x74, 0x9e, 0xa3, 0xed, 0xc5, 0x32, 0x78, 0x1b, 0x55, 0x47, 0x30, + 0x4d, 0xb7, 0xc0, 0x92, 0x23, 0xbe, 0x87, 0x6a, 0x13, 0x1e, 0xc4, 0x60, 0xbf, 0x61, 0x93, 0xa5, + 0xce, 0xb3, 0xca, 0x61, 0xb9, 0x77, 0x8a, 0x76, 0x96, 0x96, 0x8f, 0x1f, 0xa1, 0x4d, 0x1e, 0x04, + 0xf2, 0x02, 0x86, 0x16, 0xd2, 0x70, 0xb6, 0x32, 0x0d, 0x9b, 0xc7, 0xe9, 0x35, 0x9b, 0xc7, 0xf1, + 0x43, 0x54, 0x8f, 0x80, 0x2b, 0x29, 0x52, 0x74, 0xfe, 0x6f, 0x98, 0xbd, 0x65, 0x59, 0xd4, 0x79, + 0x3c, 0xfb, 0xd5, 0x2d, 0x5d, 0x1a, 0xfb, 0x61, 0xec, 0xf3, 0x75, 0xb7, 0x3c, 0x33, 0x76, 0x69, + 0xec, 0xa7, 0xb1, 0x6f, 0xbf, 0xbb, 0xa5, 0x8f, 0x8d, 0xf9, 0x1c, 0xff, 0x04, 0x00, 0x00, 0xff, + 0xff, 0x5b, 0xde, 0x19, 0x74, 0x3a, 0x05, 0x00, 0x00, +} diff --git a/pkg/apis/imagepolicy/v1alpha1/generated.proto b/pkg/apis/imagepolicy/v1alpha1/generated.proto new file mode 100644 index 0000000000000..a0797d5762148 --- /dev/null +++ b/pkg/apis/imagepolicy/v1alpha1/generated.proto @@ -0,0 +1,74 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = 'proto2'; + +package k8s.io.kubernetes.pkg.apis.imagepolicy.v1alpha1; + +import "k8s.io/kubernetes/pkg/api/resource/generated.proto"; +import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto"; +import "k8s.io/kubernetes/pkg/api/v1/generated.proto"; +import "k8s.io/kubernetes/pkg/runtime/generated.proto"; +import "k8s.io/kubernetes/pkg/util/intstr/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "v1alpha1"; + +// ImageReview checks if the set of images in a pod are allowed. +message ImageReview { + optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1; + + // Spec holds information about the pod being evaluated + optional ImageReviewSpec spec = 2; + + // Status is filled in by the backend and indicates whether the pod should be allowed. + optional ImageReviewStatus status = 3; +} + +// ImageReviewContainerSpec is a description of a container within the pod creation request. +message ImageReviewContainerSpec { + // This can be in the form image:tag or image@SHA:012345679abcdef. + optional string image = 1; +} + +// ImageReviewSpec is a description of the pod creation request. +message ImageReviewSpec { + // Containers is a list of a subset of the information in each container of the Pod being created. + repeated ImageReviewContainerSpec containers = 1; + + // Annotations is a list of key-value pairs extracted from the Pod's annotations. + // It only includes keys which match the pattern `*.image-policy.k8s.io/*`. + // It is up to each webhook backend to determine how to interpret these annotations, if at all. + map annotations = 2; + + // Namespace is the namespace the pod is being created in. + optional string namespace = 3; +} + +// ImageReviewStatus is the result of the token authentication request. +message ImageReviewStatus { + // Allowed indicates that all images were allowed to be run. + optional bool allowed = 1; + + // Reason should be empty unless Allowed is false in which case it + // may contain a short description of what is wrong. Kubernetes + // may truncate excessively long errors when displaying to the user. + optional string reason = 2; +} + diff --git a/pkg/apis/imagepolicy/v1alpha1/types.generated.go b/pkg/apis/imagepolicy/v1alpha1/types.generated.go index 1c267880d8df1..1363b20f0aba1 100644 --- a/pkg/apis/imagepolicy/v1alpha1/types.generated.go +++ b/pkg/apis/imagepolicy/v1alpha1/types.generated.go @@ -1 +1,1208 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ + package v1alpha1 + +import ( + "errors" + "fmt" + codec1978 "github.com/ugorji/go/codec" + pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" + pkg2_v1 "k8s.io/kubernetes/pkg/api/v1" + pkg3_types "k8s.io/kubernetes/pkg/types" + "reflect" + "runtime" + time "time" +) + +const ( + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- + codecSelferValueTypeArray1234 = 10 + codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 +) + +var ( + codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer1234 struct{} + +func init() { + if codec1978.GenVersion != 5 { + _, file, _, _ := runtime.Caller(0) + err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", + 5, codec1978.GenVersion, file) + panic(err) + } + if false { // reference the types, but skip this branch at build/run time + var v0 pkg1_unversioned.TypeMeta + var v1 pkg2_v1.ObjectMeta + var v2 pkg3_types.UID + var v3 time.Time + _, _, _, _ = v0, v1, v2, v3 + } +} + +func (x *ImageReview) 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 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + yyq2[4] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ObjectMeta + yy10.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.ObjectMeta + yy11.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy13 := &x.Spec + yy13.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy14 := &x.Spec + yy14.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yy16 := &x.Status + yy16.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy17 := &x.Status + yy17.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ImageReview) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct19 := r.ContainerType() + if yyct19 == codecSelferValueTypeMap1234 { + yyl19 := r.ReadMapStart() + if yyl19 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl19, d) + } + } else if yyct19 == codecSelferValueTypeArray1234 { + yyl19 := r.ReadArrayStart() + if yyl19 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl19, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ImageReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys20Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys20Slc + var yyhl20 bool = l >= 0 + for yyj20 := 0; ; yyj20++ { + if yyhl20 { + if yyj20 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys20Slc = r.DecodeBytes(yys20Slc, true, true) + yys20 := string(yys20Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys20 { + 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 = pkg2_v1.ObjectMeta{} + } else { + yyv23 := &x.ObjectMeta + yyv23.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ImageReviewSpec{} + } else { + yyv24 := &x.Spec + yyv24.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ImageReviewStatus{} + } else { + yyv25 := &x.Status + yyv25.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys20) + } // end switch yys20 + } // end for yyj20 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ImageReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj26 int + var yyb26 bool + var yyhl26 bool = l >= 0 + yyj26++ + if yyhl26 { + yyb26 = yyj26 > l + } else { + yyb26 = r.CheckBreak() + } + if yyb26 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj26++ + if yyhl26 { + yyb26 = yyj26 > l + } else { + yyb26 = r.CheckBreak() + } + if yyb26 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + yyj26++ + if yyhl26 { + yyb26 = yyj26 > l + } else { + yyb26 = r.CheckBreak() + } + if yyb26 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv29 := &x.ObjectMeta + yyv29.CodecDecodeSelf(d) + } + yyj26++ + if yyhl26 { + yyb26 = yyj26 > l + } else { + yyb26 = r.CheckBreak() + } + if yyb26 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ImageReviewSpec{} + } else { + yyv30 := &x.Spec + yyv30.CodecDecodeSelf(d) + } + yyj26++ + if yyhl26 { + yyb26 = yyj26 > l + } else { + yyb26 = r.CheckBreak() + } + if yyb26 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ImageReviewStatus{} + } else { + yyv31 := &x.Status + yyv31.CodecDecodeSelf(d) + } + for { + yyj26++ + if yyhl26 { + yyb26 = yyj26 > l + } else { + yyb26 = r.CheckBreak() + } + if yyb26 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj26-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ImageReviewSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym32 := z.EncBinary() + _ = yym32 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep33 := !z.EncBinary() + yy2arr33 := z.EncBasicHandle().StructToArray + var yyq33 [3]bool + _, _, _ = yysep33, yyq33, yy2arr33 + const yyr33 bool = false + yyq33[0] = len(x.Containers) != 0 + yyq33[1] = len(x.Annotations) != 0 + yyq33[2] = x.Namespace != "" + var yynn33 int + if yyr33 || yy2arr33 { + r.EncodeArrayStart(3) + } else { + yynn33 = 0 + for _, b := range yyq33 { + if b { + yynn33++ + } + } + r.EncodeMapStart(yynn33) + yynn33 = 0 + } + if yyr33 || yy2arr33 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq33[0] { + if x.Containers == nil { + r.EncodeNil() + } else { + yym35 := z.EncBinary() + _ = yym35 + if false { + } else { + h.encSliceImageReviewContainerSpec(([]ImageReviewContainerSpec)(x.Containers), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq33[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("containers")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Containers == nil { + r.EncodeNil() + } else { + yym36 := z.EncBinary() + _ = yym36 + if false { + } else { + h.encSliceImageReviewContainerSpec(([]ImageReviewContainerSpec)(x.Containers), e) + } + } + } + } + if yyr33 || yy2arr33 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq33[1] { + if x.Annotations == nil { + r.EncodeNil() + } else { + yym38 := z.EncBinary() + _ = yym38 + if false { + } else { + z.F.EncMapStringStringV(x.Annotations, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq33[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("annotations")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Annotations == nil { + r.EncodeNil() + } else { + yym39 := z.EncBinary() + _ = yym39 + if false { + } else { + z.F.EncMapStringStringV(x.Annotations, false, e) + } + } + } + } + if yyr33 || yy2arr33 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq33[2] { + yym41 := z.EncBinary() + _ = yym41 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq33[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("namespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym42 := z.EncBinary() + _ = yym42 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } + } + if yyr33 || yy2arr33 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ImageReviewSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym43 := z.DecBinary() + _ = yym43 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct44 := r.ContainerType() + if yyct44 == codecSelferValueTypeMap1234 { + yyl44 := r.ReadMapStart() + if yyl44 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl44, d) + } + } else if yyct44 == codecSelferValueTypeArray1234 { + yyl44 := r.ReadArrayStart() + if yyl44 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl44, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ImageReviewSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys45Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys45Slc + var yyhl45 bool = l >= 0 + for yyj45 := 0; ; yyj45++ { + if yyhl45 { + if yyj45 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys45Slc = r.DecodeBytes(yys45Slc, true, true) + yys45 := string(yys45Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys45 { + case "containers": + if r.TryDecodeAsNil() { + x.Containers = nil + } else { + yyv46 := &x.Containers + yym47 := z.DecBinary() + _ = yym47 + if false { + } else { + h.decSliceImageReviewContainerSpec((*[]ImageReviewContainerSpec)(yyv46), d) + } + } + case "annotations": + if r.TryDecodeAsNil() { + x.Annotations = nil + } else { + yyv48 := &x.Annotations + yym49 := z.DecBinary() + _ = yym49 + if false { + } else { + z.F.DecMapStringStringX(yyv48, false, d) + } + } + case "namespace": + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys45) + } // end switch yys45 + } // end for yyj45 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ImageReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj51 int + var yyb51 bool + var yyhl51 bool = l >= 0 + yyj51++ + if yyhl51 { + yyb51 = yyj51 > l + } else { + yyb51 = r.CheckBreak() + } + if yyb51 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Containers = nil + } else { + yyv52 := &x.Containers + yym53 := z.DecBinary() + _ = yym53 + if false { + } else { + h.decSliceImageReviewContainerSpec((*[]ImageReviewContainerSpec)(yyv52), d) + } + } + yyj51++ + if yyhl51 { + yyb51 = yyj51 > l + } else { + yyb51 = r.CheckBreak() + } + if yyb51 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Annotations = nil + } else { + yyv54 := &x.Annotations + yym55 := z.DecBinary() + _ = yym55 + if false { + } else { + z.F.DecMapStringStringX(yyv54, false, d) + } + } + yyj51++ + if yyhl51 { + yyb51 = yyj51 > l + } else { + yyb51 = r.CheckBreak() + } + if yyb51 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + for { + yyj51++ + if yyhl51 { + yyb51 = yyj51 > l + } else { + yyb51 = r.CheckBreak() + } + if yyb51 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj51-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ImageReviewContainerSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym57 := z.EncBinary() + _ = yym57 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep58 := !z.EncBinary() + yy2arr58 := z.EncBasicHandle().StructToArray + var yyq58 [1]bool + _, _, _ = yysep58, yyq58, yy2arr58 + const yyr58 bool = false + yyq58[0] = x.Image != "" + var yynn58 int + if yyr58 || yy2arr58 { + r.EncodeArrayStart(1) + } else { + yynn58 = 0 + for _, b := range yyq58 { + if b { + yynn58++ + } + } + r.EncodeMapStart(yynn58) + yynn58 = 0 + } + if yyr58 || yy2arr58 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq58[0] { + yym60 := z.EncBinary() + _ = yym60 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Image)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq58[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("image")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym61 := z.EncBinary() + _ = yym61 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Image)) + } + } + } + if yyr58 || yy2arr58 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ImageReviewContainerSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym62 := z.DecBinary() + _ = yym62 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct63 := r.ContainerType() + if yyct63 == codecSelferValueTypeMap1234 { + yyl63 := r.ReadMapStart() + if yyl63 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl63, d) + } + } else if yyct63 == codecSelferValueTypeArray1234 { + yyl63 := r.ReadArrayStart() + if yyl63 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl63, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ImageReviewContainerSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys64Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys64Slc + var yyhl64 bool = l >= 0 + for yyj64 := 0; ; yyj64++ { + if yyhl64 { + if yyj64 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys64Slc = r.DecodeBytes(yys64Slc, true, true) + yys64 := string(yys64Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys64 { + case "image": + if r.TryDecodeAsNil() { + x.Image = "" + } else { + x.Image = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys64) + } // end switch yys64 + } // end for yyj64 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ImageReviewContainerSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj66 int + var yyb66 bool + var yyhl66 bool = l >= 0 + yyj66++ + if yyhl66 { + yyb66 = yyj66 > l + } else { + yyb66 = r.CheckBreak() + } + if yyb66 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Image = "" + } else { + x.Image = string(r.DecodeString()) + } + for { + yyj66++ + if yyhl66 { + yyb66 = yyj66 > l + } else { + yyb66 = r.CheckBreak() + } + if yyb66 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj66-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ImageReviewStatus) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym68 := z.EncBinary() + _ = yym68 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep69 := !z.EncBinary() + yy2arr69 := z.EncBasicHandle().StructToArray + var yyq69 [2]bool + _, _, _ = yysep69, yyq69, yy2arr69 + const yyr69 bool = false + yyq69[1] = x.Reason != "" + var yynn69 int + if yyr69 || yy2arr69 { + r.EncodeArrayStart(2) + } else { + yynn69 = 1 + for _, b := range yyq69 { + if b { + yynn69++ + } + } + r.EncodeMapStart(yynn69) + yynn69 = 0 + } + if yyr69 || yy2arr69 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym71 := z.EncBinary() + _ = yym71 + if false { + } else { + r.EncodeBool(bool(x.Allowed)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("allowed")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym72 := z.EncBinary() + _ = yym72 + if false { + } else { + r.EncodeBool(bool(x.Allowed)) + } + } + if yyr69 || yy2arr69 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq69[1] { + yym74 := z.EncBinary() + _ = yym74 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq69[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("reason")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym75 := z.EncBinary() + _ = yym75 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) + } + } + } + if yyr69 || yy2arr69 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ImageReviewStatus) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym76 := z.DecBinary() + _ = yym76 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct77 := r.ContainerType() + if yyct77 == codecSelferValueTypeMap1234 { + yyl77 := r.ReadMapStart() + if yyl77 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl77, d) + } + } else if yyct77 == codecSelferValueTypeArray1234 { + yyl77 := r.ReadArrayStart() + if yyl77 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl77, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ImageReviewStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys78Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys78Slc + var yyhl78 bool = l >= 0 + for yyj78 := 0; ; yyj78++ { + if yyhl78 { + if yyj78 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys78Slc = r.DecodeBytes(yys78Slc, true, true) + yys78 := string(yys78Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys78 { + case "allowed": + if r.TryDecodeAsNil() { + x.Allowed = false + } else { + x.Allowed = bool(r.DecodeBool()) + } + case "reason": + if r.TryDecodeAsNil() { + x.Reason = "" + } else { + x.Reason = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys78) + } // end switch yys78 + } // end for yyj78 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ImageReviewStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj81 int + var yyb81 bool + var yyhl81 bool = l >= 0 + yyj81++ + if yyhl81 { + yyb81 = yyj81 > l + } else { + yyb81 = r.CheckBreak() + } + if yyb81 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Allowed = false + } else { + x.Allowed = bool(r.DecodeBool()) + } + yyj81++ + if yyhl81 { + yyb81 = yyj81 > l + } else { + yyb81 = r.CheckBreak() + } + if yyb81 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Reason = "" + } else { + x.Reason = string(r.DecodeString()) + } + for { + yyj81++ + if yyhl81 { + yyb81 = yyj81 > l + } else { + yyb81 = r.CheckBreak() + } + if yyb81 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj81-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) encSliceImageReviewContainerSpec(v []ImageReviewContainerSpec, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv84 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy85 := &yyv84 + yy85.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceImageReviewContainerSpec(v *[]ImageReviewContainerSpec, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv86 := *v + yyh86, yyl86 := z.DecSliceHelperStart() + var yyc86 bool + if yyl86 == 0 { + if yyv86 == nil { + yyv86 = []ImageReviewContainerSpec{} + yyc86 = true + } else if len(yyv86) != 0 { + yyv86 = yyv86[:0] + yyc86 = true + } + } else if yyl86 > 0 { + var yyrr86, yyrl86 int + var yyrt86 bool + if yyl86 > cap(yyv86) { + + yyrg86 := len(yyv86) > 0 + yyv286 := yyv86 + yyrl86, yyrt86 = z.DecInferLen(yyl86, z.DecBasicHandle().MaxInitLen, 16) + if yyrt86 { + if yyrl86 <= cap(yyv86) { + yyv86 = yyv86[:yyrl86] + } else { + yyv86 = make([]ImageReviewContainerSpec, yyrl86) + } + } else { + yyv86 = make([]ImageReviewContainerSpec, yyrl86) + } + yyc86 = true + yyrr86 = len(yyv86) + if yyrg86 { + copy(yyv86, yyv286) + } + } else if yyl86 != len(yyv86) { + yyv86 = yyv86[:yyl86] + yyc86 = true + } + yyj86 := 0 + for ; yyj86 < yyrr86; yyj86++ { + yyh86.ElemContainerState(yyj86) + if r.TryDecodeAsNil() { + yyv86[yyj86] = ImageReviewContainerSpec{} + } else { + yyv87 := &yyv86[yyj86] + yyv87.CodecDecodeSelf(d) + } + + } + if yyrt86 { + for ; yyj86 < yyl86; yyj86++ { + yyv86 = append(yyv86, ImageReviewContainerSpec{}) + yyh86.ElemContainerState(yyj86) + if r.TryDecodeAsNil() { + yyv86[yyj86] = ImageReviewContainerSpec{} + } else { + yyv88 := &yyv86[yyj86] + yyv88.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj86 := 0 + for ; !r.CheckBreak(); yyj86++ { + + if yyj86 >= len(yyv86) { + yyv86 = append(yyv86, ImageReviewContainerSpec{}) // var yyz86 ImageReviewContainerSpec + yyc86 = true + } + yyh86.ElemContainerState(yyj86) + if yyj86 < len(yyv86) { + if r.TryDecodeAsNil() { + yyv86[yyj86] = ImageReviewContainerSpec{} + } else { + yyv89 := &yyv86[yyj86] + yyv89.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj86 < len(yyv86) { + yyv86 = yyv86[:yyj86] + yyc86 = true + } else if yyj86 == 0 && yyv86 == nil { + yyv86 = []ImageReviewContainerSpec{} + yyc86 = true + } + } + yyh86.End() + if yyc86 { + *v = yyv86 + } +} diff --git a/pkg/apis/imagepolicy/v1alpha1/zz_generated.conversion.go b/pkg/apis/imagepolicy/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000000000..8a98c0a10a2b2 --- /dev/null +++ b/pkg/apis/imagepolicy/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,169 @@ +// +build !ignore_autogenerated + +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by conversion-gen. Do not edit it manually! + +package v1alpha1 + +import ( + api "k8s.io/kubernetes/pkg/api" + imagepolicy "k8s.io/kubernetes/pkg/apis/imagepolicy" + conversion "k8s.io/kubernetes/pkg/conversion" + runtime "k8s.io/kubernetes/pkg/runtime" +) + +func init() { + SchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(scheme *runtime.Scheme) error { + return scheme.AddGeneratedConversionFuncs( + Convert_v1alpha1_ImageReview_To_imagepolicy_ImageReview, + Convert_imagepolicy_ImageReview_To_v1alpha1_ImageReview, + Convert_v1alpha1_ImageReviewContainerSpec_To_imagepolicy_ImageReviewContainerSpec, + Convert_imagepolicy_ImageReviewContainerSpec_To_v1alpha1_ImageReviewContainerSpec, + Convert_v1alpha1_ImageReviewSpec_To_imagepolicy_ImageReviewSpec, + Convert_imagepolicy_ImageReviewSpec_To_v1alpha1_ImageReviewSpec, + Convert_v1alpha1_ImageReviewStatus_To_imagepolicy_ImageReviewStatus, + Convert_imagepolicy_ImageReviewStatus_To_v1alpha1_ImageReviewStatus, + ) +} + +func autoConvert_v1alpha1_ImageReview_To_imagepolicy_ImageReview(in *ImageReview, out *imagepolicy.ImageReview, 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 err := Convert_v1alpha1_ImageReviewSpec_To_imagepolicy_ImageReviewSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ImageReviewStatus_To_imagepolicy_ImageReviewStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func Convert_v1alpha1_ImageReview_To_imagepolicy_ImageReview(in *ImageReview, out *imagepolicy.ImageReview, s conversion.Scope) error { + return autoConvert_v1alpha1_ImageReview_To_imagepolicy_ImageReview(in, out, s) +} + +func autoConvert_imagepolicy_ImageReview_To_v1alpha1_ImageReview(in *imagepolicy.ImageReview, out *ImageReview, 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 err := Convert_imagepolicy_ImageReviewSpec_To_v1alpha1_ImageReviewSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_imagepolicy_ImageReviewStatus_To_v1alpha1_ImageReviewStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func Convert_imagepolicy_ImageReview_To_v1alpha1_ImageReview(in *imagepolicy.ImageReview, out *ImageReview, s conversion.Scope) error { + return autoConvert_imagepolicy_ImageReview_To_v1alpha1_ImageReview(in, out, s) +} + +func autoConvert_v1alpha1_ImageReviewContainerSpec_To_imagepolicy_ImageReviewContainerSpec(in *ImageReviewContainerSpec, out *imagepolicy.ImageReviewContainerSpec, s conversion.Scope) error { + out.Image = in.Image + return nil +} + +func Convert_v1alpha1_ImageReviewContainerSpec_To_imagepolicy_ImageReviewContainerSpec(in *ImageReviewContainerSpec, out *imagepolicy.ImageReviewContainerSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ImageReviewContainerSpec_To_imagepolicy_ImageReviewContainerSpec(in, out, s) +} + +func autoConvert_imagepolicy_ImageReviewContainerSpec_To_v1alpha1_ImageReviewContainerSpec(in *imagepolicy.ImageReviewContainerSpec, out *ImageReviewContainerSpec, s conversion.Scope) error { + out.Image = in.Image + return nil +} + +func Convert_imagepolicy_ImageReviewContainerSpec_To_v1alpha1_ImageReviewContainerSpec(in *imagepolicy.ImageReviewContainerSpec, out *ImageReviewContainerSpec, s conversion.Scope) error { + return autoConvert_imagepolicy_ImageReviewContainerSpec_To_v1alpha1_ImageReviewContainerSpec(in, out, s) +} + +func autoConvert_v1alpha1_ImageReviewSpec_To_imagepolicy_ImageReviewSpec(in *ImageReviewSpec, out *imagepolicy.ImageReviewSpec, s conversion.Scope) error { + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]imagepolicy.ImageReviewContainerSpec, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_ImageReviewContainerSpec_To_imagepolicy_ImageReviewContainerSpec(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Containers = nil + } + out.Annotations = in.Annotations + out.Namespace = in.Namespace + return nil +} + +func Convert_v1alpha1_ImageReviewSpec_To_imagepolicy_ImageReviewSpec(in *ImageReviewSpec, out *imagepolicy.ImageReviewSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ImageReviewSpec_To_imagepolicy_ImageReviewSpec(in, out, s) +} + +func autoConvert_imagepolicy_ImageReviewSpec_To_v1alpha1_ImageReviewSpec(in *imagepolicy.ImageReviewSpec, out *ImageReviewSpec, s conversion.Scope) error { + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]ImageReviewContainerSpec, len(*in)) + for i := range *in { + if err := Convert_imagepolicy_ImageReviewContainerSpec_To_v1alpha1_ImageReviewContainerSpec(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Containers = nil + } + out.Annotations = in.Annotations + out.Namespace = in.Namespace + return nil +} + +func Convert_imagepolicy_ImageReviewSpec_To_v1alpha1_ImageReviewSpec(in *imagepolicy.ImageReviewSpec, out *ImageReviewSpec, s conversion.Scope) error { + return autoConvert_imagepolicy_ImageReviewSpec_To_v1alpha1_ImageReviewSpec(in, out, s) +} + +func autoConvert_v1alpha1_ImageReviewStatus_To_imagepolicy_ImageReviewStatus(in *ImageReviewStatus, out *imagepolicy.ImageReviewStatus, s conversion.Scope) error { + out.Allowed = in.Allowed + out.Reason = in.Reason + return nil +} + +func Convert_v1alpha1_ImageReviewStatus_To_imagepolicy_ImageReviewStatus(in *ImageReviewStatus, out *imagepolicy.ImageReviewStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ImageReviewStatus_To_imagepolicy_ImageReviewStatus(in, out, s) +} + +func autoConvert_imagepolicy_ImageReviewStatus_To_v1alpha1_ImageReviewStatus(in *imagepolicy.ImageReviewStatus, out *ImageReviewStatus, s conversion.Scope) error { + out.Allowed = in.Allowed + out.Reason = in.Reason + return nil +} + +func Convert_imagepolicy_ImageReviewStatus_To_v1alpha1_ImageReviewStatus(in *imagepolicy.ImageReviewStatus, out *ImageReviewStatus, s conversion.Scope) error { + return autoConvert_imagepolicy_ImageReviewStatus_To_v1alpha1_ImageReviewStatus(in, out, s) +} diff --git a/pkg/apis/imagepolicy/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/imagepolicy/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000000..88192e5009bc8 --- /dev/null +++ b/pkg/apis/imagepolicy/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,105 @@ +// +build !ignore_autogenerated + +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by deepcopy-gen. Do not edit it manually! + +package v1alpha1 + +import ( + v1 "k8s.io/kubernetes/pkg/api/v1" + conversion "k8s.io/kubernetes/pkg/conversion" + runtime "k8s.io/kubernetes/pkg/runtime" + reflect "reflect" +) + +func init() { + SchemeBuilder.Register(RegisterDeepCopies) +} + +// RegisterDeepCopies adds deep-copy functions to the given scheme. Public +// to allow building arbitrary schemes. +func RegisterDeepCopies(scheme *runtime.Scheme) error { + return scheme.AddGeneratedDeepCopyFuncs( + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ImageReview, InType: reflect.TypeOf(&ImageReview{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ImageReviewContainerSpec, InType: reflect.TypeOf(&ImageReviewContainerSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ImageReviewSpec, InType: reflect.TypeOf(&ImageReviewSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ImageReviewStatus, InType: reflect.TypeOf(&ImageReviewStatus{})}, + ) +} + +func DeepCopy_v1alpha1_ImageReview(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ImageReview) + out := out.(*ImageReview) + out.TypeMeta = in.TypeMeta + if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := DeepCopy_v1alpha1_ImageReviewSpec(&in.Spec, &out.Spec, c); err != nil { + return err + } + out.Status = in.Status + return nil + } +} + +func DeepCopy_v1alpha1_ImageReviewContainerSpec(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ImageReviewContainerSpec) + out := out.(*ImageReviewContainerSpec) + out.Image = in.Image + return nil + } +} + +func DeepCopy_v1alpha1_ImageReviewSpec(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ImageReviewSpec) + out := out.(*ImageReviewSpec) + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]ImageReviewContainerSpec, len(*in)) + for i := range *in { + (*out)[i] = (*in)[i] + } + } else { + out.Containers = nil + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string) + for key, val := range *in { + (*out)[key] = val + } + } else { + out.Annotations = nil + } + out.Namespace = in.Namespace + return nil + } +} + +func DeepCopy_v1alpha1_ImageReviewStatus(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ImageReviewStatus) + out := out.(*ImageReviewStatus) + out.Allowed = in.Allowed + out.Reason = in.Reason + return nil + } +} diff --git a/pkg/apis/imagepolicy/zz_generated.deepcopy.go b/pkg/apis/imagepolicy/zz_generated.deepcopy.go new file mode 100644 index 0000000000000..a8748f5f17f6b --- /dev/null +++ b/pkg/apis/imagepolicy/zz_generated.deepcopy.go @@ -0,0 +1,105 @@ +// +build !ignore_autogenerated + +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by deepcopy-gen. Do not edit it manually! + +package imagepolicy + +import ( + api "k8s.io/kubernetes/pkg/api" + conversion "k8s.io/kubernetes/pkg/conversion" + runtime "k8s.io/kubernetes/pkg/runtime" + reflect "reflect" +) + +func init() { + SchemeBuilder.Register(RegisterDeepCopies) +} + +// RegisterDeepCopies adds deep-copy functions to the given scheme. Public +// to allow building arbitrary schemes. +func RegisterDeepCopies(scheme *runtime.Scheme) error { + return scheme.AddGeneratedDeepCopyFuncs( + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_imagepolicy_ImageReview, InType: reflect.TypeOf(&ImageReview{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_imagepolicy_ImageReviewContainerSpec, InType: reflect.TypeOf(&ImageReviewContainerSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_imagepolicy_ImageReviewSpec, InType: reflect.TypeOf(&ImageReviewSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_imagepolicy_ImageReviewStatus, InType: reflect.TypeOf(&ImageReviewStatus{})}, + ) +} + +func DeepCopy_imagepolicy_ImageReview(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ImageReview) + out := out.(*ImageReview) + out.TypeMeta = in.TypeMeta + if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := DeepCopy_imagepolicy_ImageReviewSpec(&in.Spec, &out.Spec, c); err != nil { + return err + } + out.Status = in.Status + return nil + } +} + +func DeepCopy_imagepolicy_ImageReviewContainerSpec(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ImageReviewContainerSpec) + out := out.(*ImageReviewContainerSpec) + out.Image = in.Image + return nil + } +} + +func DeepCopy_imagepolicy_ImageReviewSpec(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ImageReviewSpec) + out := out.(*ImageReviewSpec) + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]ImageReviewContainerSpec, len(*in)) + for i := range *in { + (*out)[i] = (*in)[i] + } + } else { + out.Containers = nil + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string) + for key, val := range *in { + (*out)[key] = val + } + } else { + out.Annotations = nil + } + out.Namespace = in.Namespace + return nil + } +} + +func DeepCopy_imagepolicy_ImageReviewStatus(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ImageReviewStatus) + out := out.(*ImageReviewStatus) + out.Allowed = in.Allowed + out.Reason = in.Reason + return nil + } +}