From c7911a384cbc11a4b5003da081b181d6b814d07e Mon Sep 17 00:00:00 2001 From: David Eads Date: Tue, 18 Aug 2020 16:31:46 -0400 Subject: [PATCH] remove pod presets --- cluster/gce/config-test.sh | 4 +- cluster/gce/gci/configure-helper.sh | 1 - cmd/kube-apiserver/app/aggregator.go | 1 - .../app/import_known_versions.go | 1 - hack/lib/init.sh | 1 - pkg/api/testing/install.go | 1 - pkg/apis/settings/BUILD | 42 - pkg/apis/settings/doc.go | 20 - pkg/apis/settings/fuzzer/BUILD | 26 - pkg/apis/settings/fuzzer/fuzzer.go | 26 - pkg/apis/settings/install/BUILD | 32 - pkg/apis/settings/install/install.go | 38 - pkg/apis/settings/register.go | 54 - pkg/apis/settings/types.go | 65 - pkg/apis/settings/v1alpha1/BUILD | 40 - pkg/apis/settings/v1alpha1/doc.go | 24 - pkg/apis/settings/v1alpha1/register.go | 46 - .../v1alpha1/zz_generated.conversion.go | 189 --- .../v1alpha1/zz_generated.defaults.go | 112 -- pkg/apis/settings/validation/BUILD | 44 - pkg/apis/settings/validation/validation.go | 69 -- .../settings/validation/validation_test.go | 190 --- pkg/apis/settings/zz_generated.deepcopy.go | 131 -- .../deployment/deployment_controller_test.go | 3 +- pkg/controlplane/import_known_versions.go | 1 - pkg/controlplane/instance.go | 4 - pkg/kubeapiserver/options/plugins.go | 3 - .../cmd/convert/import_known_versions.go | 1 - .../internalversion/import_known_versions.go | 1 - pkg/registry/settings/podpreset/BUILD | 39 - pkg/registry/settings/podpreset/doc.go | 17 - pkg/registry/settings/podpreset/storage/BUILD | 53 - .../settings/podpreset/storage/storage.go | 53 - .../podpreset/storage/storage_test.go | 186 --- pkg/registry/settings/podpreset/strategy.go | 83 -- pkg/registry/settings/rest/BUILD | 35 - .../settings/rest/storage_settings.go | 62 - plugin/pkg/admission/podpreset/BUILD | 65 - plugin/pkg/admission/podpreset/admission.go | 455 ------- .../pkg/admission/podpreset/admission_test.go | 890 -------------- staging/src/k8s.io/api/roundtrip_test.go | 2 - .../src/k8s.io/api/settings/v1alpha1/BUILD | 40 - .../src/k8s.io/api/settings/v1alpha1/doc.go | 23 - .../api/settings/v1alpha1/generated.pb.go | 1053 ----------------- .../api/settings/v1alpha1/generated.proto | 75 -- .../k8s.io/api/settings/v1alpha1/register.go | 52 - .../src/k8s.io/api/settings/v1alpha1/types.go | 70 -- .../v1alpha1/types_swagger_doc_generated.go | 61 - .../v1alpha1/zz_generated.deepcopy.go | 131 -- .../src/k8s.io/client-go/informers/factory.go | 6 - .../src/k8s.io/client-go/informers/generic.go | 5 - .../k8s.io/client-go/kubernetes/clientset.go | 14 - .../kubernetes/fake/clientset_generated.go | 7 - .../client-go/kubernetes/fake/register.go | 2 - .../client-go/kubernetes/scheme/register.go | 2 - .../src/k8s.io/kubectl/pkg/scheme/install.go | 2 - test/e2e/e2e_test.go | 1 - test/e2e/servicecatalog/BUILD | 39 - test/e2e/servicecatalog/framework.go | 24 - test/e2e/servicecatalog/podpreset.go | 294 ----- test/integration/apiserver/print_test.go | 2 - test/integration/etcd/data.go | 7 - .../resources/start-kubemark-master.sh | 1 - 63 files changed, 3 insertions(+), 5018 deletions(-) delete mode 100644 pkg/apis/settings/BUILD delete mode 100644 pkg/apis/settings/doc.go delete mode 100644 pkg/apis/settings/fuzzer/BUILD delete mode 100644 pkg/apis/settings/fuzzer/fuzzer.go delete mode 100644 pkg/apis/settings/install/BUILD delete mode 100644 pkg/apis/settings/install/install.go delete mode 100644 pkg/apis/settings/register.go delete mode 100644 pkg/apis/settings/types.go delete mode 100644 pkg/apis/settings/v1alpha1/BUILD delete mode 100644 pkg/apis/settings/v1alpha1/doc.go delete mode 100644 pkg/apis/settings/v1alpha1/register.go delete mode 100644 pkg/apis/settings/v1alpha1/zz_generated.conversion.go delete mode 100644 pkg/apis/settings/v1alpha1/zz_generated.defaults.go delete mode 100644 pkg/apis/settings/validation/BUILD delete mode 100644 pkg/apis/settings/validation/validation.go delete mode 100644 pkg/apis/settings/validation/validation_test.go delete mode 100644 pkg/apis/settings/zz_generated.deepcopy.go delete mode 100644 pkg/registry/settings/podpreset/BUILD delete mode 100644 pkg/registry/settings/podpreset/doc.go delete mode 100644 pkg/registry/settings/podpreset/storage/BUILD delete mode 100644 pkg/registry/settings/podpreset/storage/storage.go delete mode 100644 pkg/registry/settings/podpreset/storage/storage_test.go delete mode 100644 pkg/registry/settings/podpreset/strategy.go delete mode 100644 pkg/registry/settings/rest/BUILD delete mode 100644 pkg/registry/settings/rest/storage_settings.go delete mode 100644 plugin/pkg/admission/podpreset/BUILD delete mode 100644 plugin/pkg/admission/podpreset/admission.go delete mode 100644 plugin/pkg/admission/podpreset/admission_test.go delete mode 100644 staging/src/k8s.io/api/settings/v1alpha1/BUILD delete mode 100644 staging/src/k8s.io/api/settings/v1alpha1/doc.go delete mode 100644 staging/src/k8s.io/api/settings/v1alpha1/generated.pb.go delete mode 100644 staging/src/k8s.io/api/settings/v1alpha1/generated.proto delete mode 100644 staging/src/k8s.io/api/settings/v1alpha1/register.go delete mode 100644 staging/src/k8s.io/api/settings/v1alpha1/types.go delete mode 100644 staging/src/k8s.io/api/settings/v1alpha1/types_swagger_doc_generated.go delete mode 100644 staging/src/k8s.io/api/settings/v1alpha1/zz_generated.deepcopy.go delete mode 100644 test/e2e/servicecatalog/BUILD delete mode 100644 test/e2e/servicecatalog/framework.go delete mode 100644 test/e2e/servicecatalog/podpreset.go diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 1bb211d3e09..cd2c37013bc 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -233,7 +233,7 @@ fi if [[ "${MASTER_OS_DISTRIBUTION}" = 'gci' ]] || [[ "${MASTER_OS_DISTRIBUTION}" = 'ubuntu' ]]; then MASTER_KUBELET_TEST_ARGS="${MASTER_KUBELET_TEST_ARGS:-} --kernel-memcg-notification=true" fi -APISERVER_TEST_ARGS="${APISERVER_TEST_ARGS:-} --runtime-config=extensions/v1beta1,scheduling.k8s.io/v1alpha1,settings.k8s.io/v1alpha1 ${TEST_CLUSTER_DELETE_COLLECTION_WORKERS} ${TEST_CLUSTER_MAX_REQUESTS_INFLIGHT}" +APISERVER_TEST_ARGS="${APISERVER_TEST_ARGS:-} --runtime-config=extensions/v1beta1,scheduling.k8s.io/v1alpha1 ${TEST_CLUSTER_DELETE_COLLECTION_WORKERS} ${TEST_CLUSTER_MAX_REQUESTS_INFLIGHT}" CONTROLLER_MANAGER_TEST_ARGS="${CONTROLLER_MANAGER_TEST_ARGS:-} ${TEST_CLUSTER_RESYNC_PERIOD} ${TEST_CLUSTER_API_CONTENT_TYPE}" SCHEDULER_TEST_ARGS="${SCHEDULER_TEST_ARGS:-} ${TEST_CLUSTER_API_CONTENT_TYPE}" KUBEPROXY_TEST_ARGS="${KUBEPROXY_TEST_ARGS:-} ${TEST_CLUSTER_API_CONTENT_TYPE}" @@ -405,7 +405,7 @@ fi CUSTOM_INGRESS_YAML=${CUSTOM_INGRESS_YAML:-} if [[ -z "${KUBE_ADMISSION_CONTROL:-}" ]]; then - ADMISSION_CONTROL='NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,PodPreset,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,Priority,StorageObjectInUseProtection,PersistentVolumeClaimResize,RuntimeClass' + ADMISSION_CONTROL='NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,Priority,StorageObjectInUseProtection,PersistentVolumeClaimResize,RuntimeClass' if [[ "${ENABLE_POD_SECURITY_POLICY:-}" = 'true' ]]; then ADMISSION_CONTROL="${ADMISSION_CONTROL},PodSecurityPolicy" fi diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 8de8eafafd9..eb470432ac8 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -1040,7 +1040,6 @@ function create-master-audit-policy { - group: "policy" - group: "rbac.authorization.k8s.io" - group: "scheduling.k8s.io" - - group: "settings.k8s.io" - group: "storage.k8s.io"' cat <"${path}" diff --git a/cmd/kube-apiserver/app/aggregator.go b/cmd/kube-apiserver/app/aggregator.go index f4a1bcc5a89..535cf517bfe 100644 --- a/cmd/kube-apiserver/app/aggregator.go +++ b/cmd/kube-apiserver/app/aggregator.go @@ -257,7 +257,6 @@ var apiVersionPriorities = map[schema.GroupVersion]priority{ {Group: "rbac.authorization.k8s.io", Version: "v1"}: {group: 17000, version: 15}, {Group: "rbac.authorization.k8s.io", Version: "v1beta1"}: {group: 17000, version: 12}, {Group: "rbac.authorization.k8s.io", Version: "v1alpha1"}: {group: 17000, version: 9}, - {Group: "settings.k8s.io", Version: "v1alpha1"}: {group: 16900, version: 9}, {Group: "storage.k8s.io", Version: "v1"}: {group: 16800, version: 15}, {Group: "storage.k8s.io", Version: "v1beta1"}: {group: 16800, version: 9}, {Group: "storage.k8s.io", Version: "v1alpha1"}: {group: 16800, version: 1}, diff --git a/cmd/kube-controller-manager/app/import_known_versions.go b/cmd/kube-controller-manager/app/import_known_versions.go index e92bd0dbe31..a76ce309970 100644 --- a/cmd/kube-controller-manager/app/import_known_versions.go +++ b/cmd/kube-controller-manager/app/import_known_versions.go @@ -34,6 +34,5 @@ import ( _ "k8s.io/kubernetes/pkg/apis/policy/install" _ "k8s.io/kubernetes/pkg/apis/rbac/install" _ "k8s.io/kubernetes/pkg/apis/scheduling/install" - _ "k8s.io/kubernetes/pkg/apis/settings/install" _ "k8s.io/kubernetes/pkg/apis/storage/install" ) diff --git a/hack/lib/init.sh b/hack/lib/init.sh index e8f81d32630..0148b05d1c4 100755 --- a/hack/lib/init.sh +++ b/hack/lib/init.sh @@ -101,7 +101,6 @@ rbac.authorization.k8s.io/v1alpha1 \ scheduling.k8s.io/v1alpha1 \ scheduling.k8s.io/v1beta1 \ scheduling.k8s.io/v1 \ -settings.k8s.io/v1alpha1 \ storage.k8s.io/v1beta1 \ storage.k8s.io/v1 \ storage.k8s.io/v1alpha1 \ diff --git a/pkg/api/testing/install.go b/pkg/api/testing/install.go index 800fcd3ee93..78b9a1a987e 100644 --- a/pkg/api/testing/install.go +++ b/pkg/api/testing/install.go @@ -38,6 +38,5 @@ import ( _ "k8s.io/kubernetes/pkg/apis/policy/install" _ "k8s.io/kubernetes/pkg/apis/rbac/install" _ "k8s.io/kubernetes/pkg/apis/scheduling/install" - _ "k8s.io/kubernetes/pkg/apis/settings/install" _ "k8s.io/kubernetes/pkg/apis/storage/install" ) diff --git a/pkg/apis/settings/BUILD b/pkg/apis/settings/BUILD deleted file mode 100644 index 8a10548bf06..00000000000 --- a/pkg/apis/settings/BUILD +++ /dev/null @@ -1,42 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = [ - "doc.go", - "register.go", - "types.go", - "zz_generated.deepcopy.go", - ], - importpath = "k8s.io/kubernetes/pkg/apis/settings", - deps = [ - "//pkg/apis/core:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [ - ":package-srcs", - "//pkg/apis/settings/fuzzer:all-srcs", - "//pkg/apis/settings/install:all-srcs", - "//pkg/apis/settings/v1alpha1:all-srcs", - "//pkg/apis/settings/validation:all-srcs", - ], - tags = ["automanaged"], -) diff --git a/pkg/apis/settings/doc.go b/pkg/apis/settings/doc.go deleted file mode 100644 index 297432dceb4..00000000000 --- a/pkg/apis/settings/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -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 -// +groupName=settings.k8s.io - -package settings // import "k8s.io/kubernetes/pkg/apis/settings" diff --git a/pkg/apis/settings/fuzzer/BUILD b/pkg/apis/settings/fuzzer/BUILD deleted file mode 100644 index d3e346b2d61..00000000000 --- a/pkg/apis/settings/fuzzer/BUILD +++ /dev/null @@ -1,26 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = ["fuzzer.go"], - importpath = "k8s.io/kubernetes/pkg/apis/settings/fuzzer", - deps = ["//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/apis/settings/fuzzer/fuzzer.go b/pkg/apis/settings/fuzzer/fuzzer.go deleted file mode 100644 index be5a228f5a1..00000000000 --- a/pkg/apis/settings/fuzzer/fuzzer.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2017 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 fuzzer - -import ( - runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" -) - -// Funcs returns the fuzzer functions for the settings api group. -var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} { - return []interface{}{} -} diff --git a/pkg/apis/settings/install/BUILD b/pkg/apis/settings/install/BUILD deleted file mode 100644 index 23618dee95c..00000000000 --- a/pkg/apis/settings/install/BUILD +++ /dev/null @@ -1,32 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = ["install.go"], - importpath = "k8s.io/kubernetes/pkg/apis/settings/install", - deps = [ - "//pkg/api/legacyscheme:go_default_library", - "//pkg/apis/settings:go_default_library", - "//pkg/apis/settings/v1alpha1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/apis/settings/install/install.go b/pkg/apis/settings/install/install.go deleted file mode 100644 index c4cf5e788a5..00000000000 --- a/pkg/apis/settings/install/install.go +++ /dev/null @@ -1,38 +0,0 @@ -/* -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 settings API group, making it available as -// an option to all of the API encoding/decoding machinery. -package install - -import ( - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/apis/settings" - "k8s.io/kubernetes/pkg/apis/settings/v1alpha1" -) - -func init() { - Install(legacyscheme.Scheme) -} - -// Install registers the API group and adds types to a scheme -func Install(scheme *runtime.Scheme) { - utilruntime.Must(settings.AddToScheme(scheme)) - utilruntime.Must(v1alpha1.AddToScheme(scheme)) - utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion)) -} diff --git a/pkg/apis/settings/register.go b/pkg/apis/settings/register.go deleted file mode 100644 index 893e3960504..00000000000 --- a/pkg/apis/settings/register.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -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 settings - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -var ( - // SchemeBuilder points to a list of functions added to Scheme. - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // AddToScheme applies all the stored functions to the scheme. - AddToScheme = SchemeBuilder.AddToScheme -) - -// GroupName is the group name use in this package -const GroupName = "settings.k8s.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} - -// Kind takes an unqualified kind and returns a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &PodPreset{}, - &PodPresetList{}, - ) - return nil -} diff --git a/pkg/apis/settings/types.go b/pkg/apis/settings/types.go deleted file mode 100644 index ae48cb3a7fd..00000000000 --- a/pkg/apis/settings/types.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -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 settings - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - api "k8s.io/kubernetes/pkg/apis/core" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodPreset is a policy resource that defines additional runtime -// requirements for a Pod. -type PodPreset struct { - metav1.TypeMeta - // +optional - metav1.ObjectMeta - - // +optional - Spec PodPresetSpec -} - -// PodPresetSpec is a description of a pod preset. -type PodPresetSpec struct { - // Selector is a label query over a set of resources, in this case pods. - // Required. - Selector metav1.LabelSelector - // Env defines the collection of EnvVar to inject into containers. - // +optional - Env []api.EnvVar - // EnvFrom defines the collection of EnvFromSource to inject into containers. - // +optional - EnvFrom []api.EnvFromSource - // Volumes defines the collection of Volume to inject into the pod. - // +optional - Volumes []api.Volume - // VolumeMounts defines the collection of VolumeMount to inject into containers. - // +optional - VolumeMounts []api.VolumeMount -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodPresetList is a list of PodPreset objects. -type PodPresetList struct { - metav1.TypeMeta - // +optional - metav1.ListMeta - - Items []PodPreset -} diff --git a/pkg/apis/settings/v1alpha1/BUILD b/pkg/apis/settings/v1alpha1/BUILD deleted file mode 100644 index 4614a28a96e..00000000000 --- a/pkg/apis/settings/v1alpha1/BUILD +++ /dev/null @@ -1,40 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = [ - "doc.go", - "register.go", - "zz_generated.conversion.go", - "zz_generated.defaults.go", - ], - importpath = "k8s.io/kubernetes/pkg/apis/settings/v1alpha1", - deps = [ - "//pkg/apis/core:go_default_library", - "//pkg/apis/core/v1:go_default_library", - "//pkg/apis/settings:go_default_library", - "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/settings/v1alpha1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/apis/settings/v1alpha1/doc.go b/pkg/apis/settings/v1alpha1/doc.go deleted file mode 100644 index 998e91f833c..00000000000 --- a/pkg/apis/settings/v1alpha1/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2017 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:conversion-gen=k8s.io/kubernetes/pkg/apis/settings -// +k8s:conversion-gen-external-types=k8s.io/api/settings/v1alpha1 -// +k8s:defaulter-gen=TypeMeta -// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/settings/v1alpha1 - -// +groupName=settings.k8s.io - -package v1alpha1 // import "k8s.io/kubernetes/pkg/apis/settings/v1alpha1" diff --git a/pkg/apis/settings/v1alpha1/register.go b/pkg/apis/settings/v1alpha1/register.go deleted file mode 100644 index f4980117516..00000000000 --- a/pkg/apis/settings/v1alpha1/register.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2017 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 ( - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name use in this package -const GroupName = "settings.k8s.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - localSchemeBuilder = &settingsv1alpha1.SchemeBuilder - // AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme - AddToScheme = localSchemeBuilder.AddToScheme -) - -func init() { - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - localSchemeBuilder.Register(RegisterDefaults) -} diff --git a/pkg/apis/settings/v1alpha1/zz_generated.conversion.go b/pkg/apis/settings/v1alpha1/zz_generated.conversion.go deleted file mode 100644 index acfb800d33e..00000000000 --- a/pkg/apis/settings/v1alpha1/zz_generated.conversion.go +++ /dev/null @@ -1,189 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 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 conversion-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - unsafe "unsafe" - - corev1 "k8s.io/api/core/v1" - v1alpha1 "k8s.io/api/settings/v1alpha1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - core "k8s.io/kubernetes/pkg/apis/core" - v1 "k8s.io/kubernetes/pkg/apis/core/v1" - settings "k8s.io/kubernetes/pkg/apis/settings" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*v1alpha1.PodPreset)(nil), (*settings.PodPreset)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PodPreset_To_settings_PodPreset(a.(*v1alpha1.PodPreset), b.(*settings.PodPreset), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*settings.PodPreset)(nil), (*v1alpha1.PodPreset)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_settings_PodPreset_To_v1alpha1_PodPreset(a.(*settings.PodPreset), b.(*v1alpha1.PodPreset), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha1.PodPresetList)(nil), (*settings.PodPresetList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PodPresetList_To_settings_PodPresetList(a.(*v1alpha1.PodPresetList), b.(*settings.PodPresetList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*settings.PodPresetList)(nil), (*v1alpha1.PodPresetList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_settings_PodPresetList_To_v1alpha1_PodPresetList(a.(*settings.PodPresetList), b.(*v1alpha1.PodPresetList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha1.PodPresetSpec)(nil), (*settings.PodPresetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PodPresetSpec_To_settings_PodPresetSpec(a.(*v1alpha1.PodPresetSpec), b.(*settings.PodPresetSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*settings.PodPresetSpec)(nil), (*v1alpha1.PodPresetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_settings_PodPresetSpec_To_v1alpha1_PodPresetSpec(a.(*settings.PodPresetSpec), b.(*v1alpha1.PodPresetSpec), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha1_PodPreset_To_settings_PodPreset(in *v1alpha1.PodPreset, out *settings.PodPreset, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha1_PodPresetSpec_To_settings_PodPresetSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_PodPreset_To_settings_PodPreset is an autogenerated conversion function. -func Convert_v1alpha1_PodPreset_To_settings_PodPreset(in *v1alpha1.PodPreset, out *settings.PodPreset, s conversion.Scope) error { - return autoConvert_v1alpha1_PodPreset_To_settings_PodPreset(in, out, s) -} - -func autoConvert_settings_PodPreset_To_v1alpha1_PodPreset(in *settings.PodPreset, out *v1alpha1.PodPreset, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_settings_PodPresetSpec_To_v1alpha1_PodPresetSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_settings_PodPreset_To_v1alpha1_PodPreset is an autogenerated conversion function. -func Convert_settings_PodPreset_To_v1alpha1_PodPreset(in *settings.PodPreset, out *v1alpha1.PodPreset, s conversion.Scope) error { - return autoConvert_settings_PodPreset_To_v1alpha1_PodPreset(in, out, s) -} - -func autoConvert_v1alpha1_PodPresetList_To_settings_PodPresetList(in *v1alpha1.PodPresetList, out *settings.PodPresetList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]settings.PodPreset, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_PodPreset_To_settings_PodPreset(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha1_PodPresetList_To_settings_PodPresetList is an autogenerated conversion function. -func Convert_v1alpha1_PodPresetList_To_settings_PodPresetList(in *v1alpha1.PodPresetList, out *settings.PodPresetList, s conversion.Scope) error { - return autoConvert_v1alpha1_PodPresetList_To_settings_PodPresetList(in, out, s) -} - -func autoConvert_settings_PodPresetList_To_v1alpha1_PodPresetList(in *settings.PodPresetList, out *v1alpha1.PodPresetList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1alpha1.PodPreset, len(*in)) - for i := range *in { - if err := Convert_settings_PodPreset_To_v1alpha1_PodPreset(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_settings_PodPresetList_To_v1alpha1_PodPresetList is an autogenerated conversion function. -func Convert_settings_PodPresetList_To_v1alpha1_PodPresetList(in *settings.PodPresetList, out *v1alpha1.PodPresetList, s conversion.Scope) error { - return autoConvert_settings_PodPresetList_To_v1alpha1_PodPresetList(in, out, s) -} - -func autoConvert_v1alpha1_PodPresetSpec_To_settings_PodPresetSpec(in *v1alpha1.PodPresetSpec, out *settings.PodPresetSpec, s conversion.Scope) error { - out.Selector = in.Selector - out.Env = *(*[]core.EnvVar)(unsafe.Pointer(&in.Env)) - out.EnvFrom = *(*[]core.EnvFromSource)(unsafe.Pointer(&in.EnvFrom)) - if in.Volumes != nil { - in, out := &in.Volumes, &out.Volumes - *out = make([]core.Volume, len(*in)) - for i := range *in { - if err := v1.Convert_v1_Volume_To_core_Volume(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Volumes = nil - } - out.VolumeMounts = *(*[]core.VolumeMount)(unsafe.Pointer(&in.VolumeMounts)) - return nil -} - -// Convert_v1alpha1_PodPresetSpec_To_settings_PodPresetSpec is an autogenerated conversion function. -func Convert_v1alpha1_PodPresetSpec_To_settings_PodPresetSpec(in *v1alpha1.PodPresetSpec, out *settings.PodPresetSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_PodPresetSpec_To_settings_PodPresetSpec(in, out, s) -} - -func autoConvert_settings_PodPresetSpec_To_v1alpha1_PodPresetSpec(in *settings.PodPresetSpec, out *v1alpha1.PodPresetSpec, s conversion.Scope) error { - out.Selector = in.Selector - out.Env = *(*[]corev1.EnvVar)(unsafe.Pointer(&in.Env)) - out.EnvFrom = *(*[]corev1.EnvFromSource)(unsafe.Pointer(&in.EnvFrom)) - if in.Volumes != nil { - in, out := &in.Volumes, &out.Volumes - *out = make([]corev1.Volume, len(*in)) - for i := range *in { - if err := v1.Convert_core_Volume_To_v1_Volume(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Volumes = nil - } - out.VolumeMounts = *(*[]corev1.VolumeMount)(unsafe.Pointer(&in.VolumeMounts)) - return nil -} - -// Convert_settings_PodPresetSpec_To_v1alpha1_PodPresetSpec is an autogenerated conversion function. -func Convert_settings_PodPresetSpec_To_v1alpha1_PodPresetSpec(in *settings.PodPresetSpec, out *v1alpha1.PodPresetSpec, s conversion.Scope) error { - return autoConvert_settings_PodPresetSpec_To_v1alpha1_PodPresetSpec(in, out, s) -} diff --git a/pkg/apis/settings/v1alpha1/zz_generated.defaults.go b/pkg/apis/settings/v1alpha1/zz_generated.defaults.go deleted file mode 100644 index bb91dd766fa..00000000000 --- a/pkg/apis/settings/v1alpha1/zz_generated.defaults.go +++ /dev/null @@ -1,112 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 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 defaulter-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "k8s.io/api/settings/v1alpha1" - runtime "k8s.io/apimachinery/pkg/runtime" - v1 "k8s.io/kubernetes/pkg/apis/core/v1" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - scheme.AddTypeDefaultingFunc(&v1alpha1.PodPreset{}, func(obj interface{}) { SetObjectDefaults_PodPreset(obj.(*v1alpha1.PodPreset)) }) - scheme.AddTypeDefaultingFunc(&v1alpha1.PodPresetList{}, func(obj interface{}) { SetObjectDefaults_PodPresetList(obj.(*v1alpha1.PodPresetList)) }) - return nil -} - -func SetObjectDefaults_PodPreset(in *v1alpha1.PodPreset) { - for i := range in.Spec.Env { - a := &in.Spec.Env[i] - if a.ValueFrom != nil { - if a.ValueFrom.FieldRef != nil { - v1.SetDefaults_ObjectFieldSelector(a.ValueFrom.FieldRef) - } - } - } - for i := range in.Spec.Volumes { - a := &in.Spec.Volumes[i] - v1.SetDefaults_Volume(a) - if a.VolumeSource.HostPath != nil { - v1.SetDefaults_HostPathVolumeSource(a.VolumeSource.HostPath) - } - if a.VolumeSource.Secret != nil { - v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret) - } - if a.VolumeSource.ISCSI != nil { - v1.SetDefaults_ISCSIVolumeSource(a.VolumeSource.ISCSI) - } - if a.VolumeSource.RBD != nil { - v1.SetDefaults_RBDVolumeSource(a.VolumeSource.RBD) - } - if a.VolumeSource.DownwardAPI != nil { - v1.SetDefaults_DownwardAPIVolumeSource(a.VolumeSource.DownwardAPI) - for j := range a.VolumeSource.DownwardAPI.Items { - b := &a.VolumeSource.DownwardAPI.Items[j] - if b.FieldRef != nil { - v1.SetDefaults_ObjectFieldSelector(b.FieldRef) - } - } - } - if a.VolumeSource.ConfigMap != nil { - v1.SetDefaults_ConfigMapVolumeSource(a.VolumeSource.ConfigMap) - } - if a.VolumeSource.AzureDisk != nil { - v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk) - } - if a.VolumeSource.Projected != nil { - v1.SetDefaults_ProjectedVolumeSource(a.VolumeSource.Projected) - for j := range a.VolumeSource.Projected.Sources { - b := &a.VolumeSource.Projected.Sources[j] - if b.DownwardAPI != nil { - for k := range b.DownwardAPI.Items { - c := &b.DownwardAPI.Items[k] - if c.FieldRef != nil { - v1.SetDefaults_ObjectFieldSelector(c.FieldRef) - } - } - } - if b.ServiceAccountToken != nil { - v1.SetDefaults_ServiceAccountTokenProjection(b.ServiceAccountToken) - } - } - } - if a.VolumeSource.ScaleIO != nil { - v1.SetDefaults_ScaleIOVolumeSource(a.VolumeSource.ScaleIO) - } - if a.VolumeSource.Ephemeral != nil { - if a.VolumeSource.Ephemeral.VolumeClaimTemplate != nil { - v1.SetDefaults_PersistentVolumeClaimSpec(&a.VolumeSource.Ephemeral.VolumeClaimTemplate.Spec) - v1.SetDefaults_ResourceList(&a.VolumeSource.Ephemeral.VolumeClaimTemplate.Spec.Resources.Limits) - v1.SetDefaults_ResourceList(&a.VolumeSource.Ephemeral.VolumeClaimTemplate.Spec.Resources.Requests) - } - } - } -} - -func SetObjectDefaults_PodPresetList(in *v1alpha1.PodPresetList) { - for i := range in.Items { - a := &in.Items[i] - SetObjectDefaults_PodPreset(a) - } -} diff --git a/pkg/apis/settings/validation/BUILD b/pkg/apis/settings/validation/BUILD deleted file mode 100644 index b938b1d7743..00000000000 --- a/pkg/apis/settings/validation/BUILD +++ /dev/null @@ -1,44 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_test( - name = "go_default_test", - srcs = ["validation_test.go"], - embed = [":go_default_library"], - deps = [ - "//pkg/apis/core:go_default_library", - "//pkg/apis/settings:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - ], -) - -go_library( - name = "go_default_library", - srcs = ["validation.go"], - importpath = "k8s.io/kubernetes/pkg/apis/settings/validation", - deps = [ - "//pkg/apis/core/validation:go_default_library", - "//pkg/apis/settings:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/api/validation:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/apis/settings/validation/validation.go b/pkg/apis/settings/validation/validation.go deleted file mode 100644 index f0a8db49b21..00000000000 --- a/pkg/apis/settings/validation/validation.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -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 validation - -import ( - apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation" - unversionedvalidation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" - "k8s.io/apimachinery/pkg/util/validation/field" - apivalidation "k8s.io/kubernetes/pkg/apis/core/validation" - "k8s.io/kubernetes/pkg/apis/settings" -) - -// ValidatePodPresetName can be used to check whether the given PodPreset name is valid. -// Prefix indicates this name will be used as part of generation, in which case -// trailing dashes are allowed. -func ValidatePodPresetName(name string, prefix bool) []string { - // TODO: Validate that there's name for the suffix inserted by the pods. - // Currently this is just "-index". In the future we may allow a user - // specified list of suffixes and we need to validate the longest one. - return apimachineryvalidation.NameIsDNSSubdomain(name, prefix) -} - -// ValidatePodPresetSpec tests if required fields in the PodPreset spec are set. -func ValidatePodPresetSpec(spec *settings.PodPresetSpec, fldPath *field.Path) field.ErrorList { - allErrs := field.ErrorList{} - - allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(&spec.Selector, fldPath.Child("selector"))...) - - if spec.Env == nil && spec.EnvFrom == nil && spec.VolumeMounts == nil && spec.Volumes == nil { - allErrs = append(allErrs, field.Required(fldPath.Child("volumes", "env", "envFrom", "volumeMounts"), "must specify at least one")) - } - - vols, vErrs := apivalidation.ValidateVolumes(spec.Volumes, nil, fldPath.Child("volumes")) - allErrs = append(allErrs, vErrs...) - allErrs = append(allErrs, apivalidation.ValidateEnv(spec.Env, fldPath.Child("env"))...) - allErrs = append(allErrs, apivalidation.ValidateEnvFrom(spec.EnvFrom, fldPath.Child("envFrom"))...) - allErrs = append(allErrs, apivalidation.ValidateVolumeMounts(spec.VolumeMounts, nil, vols, nil, fldPath.Child("volumeMounts"))...) - - return allErrs -} - -// ValidatePodPreset validates a PodPreset. -func ValidatePodPreset(pip *settings.PodPreset) field.ErrorList { - allErrs := apivalidation.ValidateObjectMeta(&pip.ObjectMeta, true, ValidatePodPresetName, field.NewPath("metadata")) - allErrs = append(allErrs, ValidatePodPresetSpec(&pip.Spec, field.NewPath("spec"))...) - return allErrs -} - -// ValidatePodPresetUpdate tests if required fields in the PodPreset are set. -func ValidatePodPresetUpdate(pip, oldPip *settings.PodPreset) field.ErrorList { - allErrs := apivalidation.ValidateObjectMetaUpdate(&pip.ObjectMeta, &oldPip.ObjectMeta, field.NewPath("metadata")) - allErrs = append(allErrs, ValidatePodPresetSpec(&pip.Spec, field.NewPath("spec"))...) - - return allErrs -} diff --git a/pkg/apis/settings/validation/validation_test.go b/pkg/apis/settings/validation/validation_test.go deleted file mode 100644 index 884b15f2b7a..00000000000 --- a/pkg/apis/settings/validation/validation_test.go +++ /dev/null @@ -1,190 +0,0 @@ -/* -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 validation - -import ( - "strings" - "testing" - - "k8s.io/apimachinery/pkg/apis/meta/v1" - api "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/apis/settings" -) - -func TestValidateEmptyPodPreset(t *testing.T) { - emptyPodPreset := &settings.PodPreset{ - Spec: settings.PodPresetSpec{}, - } - - errList := ValidatePodPreset(emptyPodPreset) - if errList == nil { - t.Fatal("empty pod preset should return an error") - } -} - -func TestValidateEmptyPodPresetItems(t *testing.T) { - emptyPodPreset := &settings.PodPreset{ - ObjectMeta: v1.ObjectMeta{ - Name: "hello", - Namespace: "sample", - }, - Spec: settings.PodPresetSpec{ - Selector: v1.LabelSelector{ - MatchExpressions: []v1.LabelSelectorRequirement{ - { - Key: "security", - Operator: v1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - }, - } - - errList := ValidatePodPreset(emptyPodPreset) - if !strings.Contains(errList.ToAggregate().Error(), "must specify at least one") { - t.Fatal("empty pod preset with label selector should return an error") - } -} - -func TestValidatePodPresets(t *testing.T) { - p := &settings.PodPreset{ - ObjectMeta: v1.ObjectMeta{ - Name: "hello", - Namespace: "sample", - }, - Spec: settings.PodPresetSpec{ - Selector: v1.LabelSelector{ - MatchExpressions: []v1.LabelSelectorRequirement{ - { - Key: "security", - Operator: v1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []api.Volume{{Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}}, - Env: []api.EnvVar{{Name: "abc", Value: "value"}, {Name: "ABC", Value: "value"}}, - EnvFrom: []api.EnvFromSource{ - { - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - }, - }, - } - - errList := ValidatePodPreset(p) - if errList != nil { - if errList.ToAggregate() != nil { - t.Fatalf("errors: %#v", errList.ToAggregate().Error()) - } - } - - p = &settings.PodPreset{ - ObjectMeta: v1.ObjectMeta{ - Name: "hello", - Namespace: "sample", - }, - Spec: settings.PodPresetSpec{ - Selector: v1.LabelSelector{ - MatchExpressions: []v1.LabelSelectorRequirement{ - { - Key: "security", - Operator: v1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []api.Volume{{Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}}, - Env: []api.EnvVar{{Name: "abc", Value: "value"}, {Name: "ABC", Value: "value"}}, - VolumeMounts: []api.VolumeMount{ - {Name: "vol", MountPath: "/foo"}, - }, - EnvFrom: []api.EnvFromSource{ - { - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - }, - }, - } - - errList = ValidatePodPreset(p) - if errList != nil { - if errList.ToAggregate() != nil { - t.Fatalf("errors: %#v", errList.ToAggregate().Error()) - } - } -} - -func TestValidatePodPresetsiVolumeMountError(t *testing.T) { - p := &settings.PodPreset{ - ObjectMeta: v1.ObjectMeta{ - Name: "hello", - Namespace: "sample", - }, - Spec: settings.PodPresetSpec{ - Selector: v1.LabelSelector{ - MatchExpressions: []v1.LabelSelectorRequirement{ - { - Key: "security", - Operator: v1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []api.Volume{{Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}}, - VolumeMounts: []api.VolumeMount{ - {Name: "dne", MountPath: "/foo"}, - }, - Env: []api.EnvVar{{Name: "abc", Value: "value"}, {Name: "ABC", Value: "value"}}, - EnvFrom: []api.EnvFromSource{ - { - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - }, - }, - } - - errList := ValidatePodPreset(p) - if !strings.Contains(errList.ToAggregate().Error(), "spec.volumeMounts[0].name: Not found") { - t.Fatal("should have returned error for volume that does not exist") - } -} diff --git a/pkg/apis/settings/zz_generated.deepcopy.go b/pkg/apis/settings/zz_generated.deepcopy.go deleted file mode 100644 index 7df999b824a..00000000000 --- a/pkg/apis/settings/zz_generated.deepcopy.go +++ /dev/null @@ -1,131 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 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 deepcopy-gen. DO NOT EDIT. - -package settings - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" - core "k8s.io/kubernetes/pkg/apis/core" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodPreset) DeepCopyInto(out *PodPreset) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodPreset. -func (in *PodPreset) DeepCopy() *PodPreset { - if in == nil { - return nil - } - out := new(PodPreset) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodPreset) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodPresetList) DeepCopyInto(out *PodPresetList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PodPreset, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodPresetList. -func (in *PodPresetList) DeepCopy() *PodPresetList { - if in == nil { - return nil - } - out := new(PodPresetList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodPresetList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodPresetSpec) DeepCopyInto(out *PodPresetSpec) { - *out = *in - in.Selector.DeepCopyInto(&out.Selector) - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]core.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.EnvFrom != nil { - in, out := &in.EnvFrom, &out.EnvFrom - *out = make([]core.EnvFromSource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Volumes != nil { - in, out := &in.Volumes, &out.Volumes - *out = make([]core.Volume, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.VolumeMounts != nil { - in, out := &in.VolumeMounts, &out.VolumeMounts - *out = make([]core.VolumeMount, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodPresetSpec. -func (in *PodPresetSpec) DeepCopy() *PodPresetSpec { - if in == nil { - return nil - } - out := new(PodPresetSpec) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/controller/deployment/deployment_controller_test.go b/pkg/controller/deployment/deployment_controller_test.go index 3c63ab7be7b..65eff29b78b 100644 --- a/pkg/controller/deployment/deployment_controller_test.go +++ b/pkg/controller/deployment/deployment_controller_test.go @@ -22,7 +22,7 @@ import ( "testing" apps "k8s.io/api/apps/v1" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" extensions "k8s.io/api/extensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -42,7 +42,6 @@ import ( _ "k8s.io/kubernetes/pkg/apis/core/install" _ "k8s.io/kubernetes/pkg/apis/policy/install" _ "k8s.io/kubernetes/pkg/apis/rbac/install" - _ "k8s.io/kubernetes/pkg/apis/settings/install" _ "k8s.io/kubernetes/pkg/apis/storage/install" "k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/controller/deployment/util" diff --git a/pkg/controlplane/import_known_versions.go b/pkg/controlplane/import_known_versions.go index 564e26b6779..b4b275ce82f 100644 --- a/pkg/controlplane/import_known_versions.go +++ b/pkg/controlplane/import_known_versions.go @@ -39,6 +39,5 @@ import ( _ "k8s.io/kubernetes/pkg/apis/policy/install" _ "k8s.io/kubernetes/pkg/apis/rbac/install" _ "k8s.io/kubernetes/pkg/apis/scheduling/install" - _ "k8s.io/kubernetes/pkg/apis/settings/install" _ "k8s.io/kubernetes/pkg/apis/storage/install" ) diff --git a/pkg/controlplane/instance.go b/pkg/controlplane/instance.go index 85be9a77946..4acd4edad99 100644 --- a/pkg/controlplane/instance.go +++ b/pkg/controlplane/instance.go @@ -60,7 +60,6 @@ import ( schedulingapiv1 "k8s.io/api/scheduling/v1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" schedulingapiv1beta1 "k8s.io/api/scheduling/v1beta1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" storageapiv1 "k8s.io/api/storage/v1" storageapiv1alpha1 "k8s.io/api/storage/v1alpha1" storageapiv1beta1 "k8s.io/api/storage/v1beta1" @@ -112,7 +111,6 @@ import ( policyrest "k8s.io/kubernetes/pkg/registry/policy/rest" rbacrest "k8s.io/kubernetes/pkg/registry/rbac/rest" schedulingrest "k8s.io/kubernetes/pkg/registry/scheduling/rest" - settingsrest "k8s.io/kubernetes/pkg/registry/settings/rest" storagerest "k8s.io/kubernetes/pkg/registry/storage/rest" ) @@ -431,7 +429,6 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) policyrest.RESTStorageProvider{}, rbacrest.RESTStorageProvider{Authorizer: c.GenericConfig.Authorization.Authorizer}, schedulingrest.RESTStorageProvider{}, - settingsrest.RESTStorageProvider{}, storagerest.RESTStorageProvider{}, flowcontrolrest.RESTStorageProvider{}, // keep apps after extensions so legacy clients resolve the extensions versions of shared resource names. @@ -641,7 +638,6 @@ func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig { nodev1alpha1.SchemeGroupVersion, rbacv1alpha1.SchemeGroupVersion, schedulingv1alpha1.SchemeGroupVersion, - settingsv1alpha1.SchemeGroupVersion, storageapiv1alpha1.SchemeGroupVersion, flowcontrolv1alpha1.SchemeGroupVersion, ) diff --git a/pkg/kubeapiserver/options/plugins.go b/pkg/kubeapiserver/options/plugins.go index f3c60636d62..f36bdcade03 100644 --- a/pkg/kubeapiserver/options/plugins.go +++ b/pkg/kubeapiserver/options/plugins.go @@ -41,7 +41,6 @@ import ( "k8s.io/kubernetes/plugin/pkg/admission/noderestriction" "k8s.io/kubernetes/plugin/pkg/admission/nodetaint" "k8s.io/kubernetes/plugin/pkg/admission/podnodeselector" - "k8s.io/kubernetes/plugin/pkg/admission/podpreset" "k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction" podpriority "k8s.io/kubernetes/plugin/pkg/admission/priority" "k8s.io/kubernetes/plugin/pkg/admission/resourcequota" @@ -69,7 +68,6 @@ var AllOrderedPlugins = []string{ exists.PluginName, // NamespaceExists scdeny.PluginName, // SecurityContextDeny antiaffinity.PluginName, // LimitPodHardAntiAffinityTopology - podpreset.PluginName, // PodPreset limitranger.PluginName, // LimitRanger serviceaccount.PluginName, // ServiceAccount noderestriction.PluginName, // NodeRestriction @@ -126,7 +124,6 @@ func RegisterAllAdmissionPlugins(plugins *admission.Plugins) { nodetaint.Register(plugins) label.Register(plugins) // DEPRECATED, future PVs should not rely on labels for zone topology podnodeselector.Register(plugins) - podpreset.Register(plugins) podtolerationrestriction.Register(plugins) runtimeclass.Register(plugins) resourcequota.Register(plugins) diff --git a/pkg/kubectl/cmd/convert/import_known_versions.go b/pkg/kubectl/cmd/convert/import_known_versions.go index 2da5f1aadd1..6de9e20c643 100644 --- a/pkg/kubectl/cmd/convert/import_known_versions.go +++ b/pkg/kubectl/cmd/convert/import_known_versions.go @@ -32,6 +32,5 @@ import ( _ "k8s.io/kubernetes/pkg/apis/policy/install" _ "k8s.io/kubernetes/pkg/apis/rbac/install" _ "k8s.io/kubernetes/pkg/apis/scheduling/install" - _ "k8s.io/kubernetes/pkg/apis/settings/install" _ "k8s.io/kubernetes/pkg/apis/storage/install" ) diff --git a/pkg/printers/internalversion/import_known_versions.go b/pkg/printers/internalversion/import_known_versions.go index d6877600e97..726845fbcbd 100644 --- a/pkg/printers/internalversion/import_known_versions.go +++ b/pkg/printers/internalversion/import_known_versions.go @@ -33,6 +33,5 @@ import ( _ "k8s.io/kubernetes/pkg/apis/policy/install" _ "k8s.io/kubernetes/pkg/apis/rbac/install" _ "k8s.io/kubernetes/pkg/apis/scheduling/install" - _ "k8s.io/kubernetes/pkg/apis/settings/install" _ "k8s.io/kubernetes/pkg/apis/storage/install" ) diff --git a/pkg/registry/settings/podpreset/BUILD b/pkg/registry/settings/podpreset/BUILD deleted file mode 100644 index 56a3d37db1b..00000000000 --- a/pkg/registry/settings/podpreset/BUILD +++ /dev/null @@ -1,39 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = [ - "doc.go", - "strategy.go", - ], - importpath = "k8s.io/kubernetes/pkg/registry/settings/podpreset", - deps = [ - "//pkg/api/legacyscheme:go_default_library", - "//pkg/apis/settings:go_default_library", - "//pkg/apis/settings/validation:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/storage/names:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [ - ":package-srcs", - "//pkg/registry/settings/podpreset/storage:all-srcs", - ], - tags = ["automanaged"], -) diff --git a/pkg/registry/settings/podpreset/doc.go b/pkg/registry/settings/podpreset/doc.go deleted file mode 100644 index 30c955a50dc..00000000000 --- a/pkg/registry/settings/podpreset/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2015 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 podpreset // import "k8s.io/kubernetes/pkg/registry/settings/podpreset" diff --git a/pkg/registry/settings/podpreset/storage/BUILD b/pkg/registry/settings/podpreset/storage/BUILD deleted file mode 100644 index c106c75cf4e..00000000000 --- a/pkg/registry/settings/podpreset/storage/BUILD +++ /dev/null @@ -1,53 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = ["storage.go"], - importpath = "k8s.io/kubernetes/pkg/registry/settings/podpreset/storage", - deps = [ - "//pkg/apis/settings:go_default_library", - "//pkg/registry/settings/podpreset:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/registry/generic:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) - -go_test( - name = "go_default_test", - srcs = ["storage_test.go"], - embed = [":go_default_library"], - deps = [ - "//pkg/apis/core:go_default_library", - "//pkg/apis/settings:go_default_library", - "//pkg/apis/settings/install:go_default_library", - "//pkg/registry/registrytest:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/fields:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/registry/generic:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/registry/generic/testing:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/storage/etcd3/testing:go_default_library", - ], -) diff --git a/pkg/registry/settings/podpreset/storage/storage.go b/pkg/registry/settings/podpreset/storage/storage.go deleted file mode 100644 index 9fdd46bda9f..00000000000 --- a/pkg/registry/settings/podpreset/storage/storage.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2015 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 storage - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apiserver/pkg/registry/generic" - genericregistry "k8s.io/apiserver/pkg/registry/generic/registry" - "k8s.io/apiserver/pkg/registry/rest" - settingsapi "k8s.io/kubernetes/pkg/apis/settings" - "k8s.io/kubernetes/pkg/registry/settings/podpreset" -) - -// REST implements a RESTStorage for pod presets against etcd. -type REST struct { - *genericregistry.Store -} - -// NewREST returns a RESTStorage object that will work against pod presets. -func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) { - store := &genericregistry.Store{ - NewFunc: func() runtime.Object { return &settingsapi.PodPreset{} }, - NewListFunc: func() runtime.Object { return &settingsapi.PodPresetList{} }, - DefaultQualifiedResource: settingsapi.Resource("podpresets"), - - CreateStrategy: podpreset.Strategy, - UpdateStrategy: podpreset.Strategy, - DeleteStrategy: podpreset.Strategy, - - // TODO: define table converter that exposes more than name/creation timestamp - TableConvertor: rest.NewDefaultTableConvertor(settingsapi.Resource("podpresets")), - } - options := &generic.StoreOptions{RESTOptions: optsGetter} - if err := store.CompleteWithOptions(options); err != nil { - return nil, err - } - - return &REST{store}, nil -} diff --git a/pkg/registry/settings/podpreset/storage/storage_test.go b/pkg/registry/settings/podpreset/storage/storage_test.go deleted file mode 100644 index 04d372f6573..00000000000 --- a/pkg/registry/settings/podpreset/storage/storage_test.go +++ /dev/null @@ -1,186 +0,0 @@ -/* -Copyright 2017 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 storage - -import ( - "testing" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apiserver/pkg/registry/generic" - genericregistrytest "k8s.io/apiserver/pkg/registry/generic/testing" - etcd3testing "k8s.io/apiserver/pkg/storage/etcd3/testing" - api "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/apis/settings" - _ "k8s.io/kubernetes/pkg/apis/settings/install" - "k8s.io/kubernetes/pkg/registry/registrytest" -) - -func newStorage(t *testing.T) (*REST, *etcd3testing.EtcdTestServer) { - etcdStorage, server := registrytest.NewEtcdStorage(t, settings.GroupName) - restOptions := generic.RESTOptions{ - StorageConfig: etcdStorage, - Decorator: generic.UndecoratedStorage, - DeleteCollectionWorkers: 1, - ResourcePrefix: "podpresets", - } - rest, err := NewREST(restOptions) - if err != nil { - t.Fatalf("unexpected error from REST storage: %v", err) - } - return rest, server -} - -func validNewPodPreset(namespace string) *settings.PodPreset { - return &settings.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "podPreset", - Namespace: namespace, - Labels: map[string]string{"a": "b"}, - }, - Spec: settings.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchLabels: map[string]string{ - "role": "frontend", - }, - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Env: []api.EnvVar{ - { - Name: "DB_PORT", - Value: "6379", - }, - }, - EnvFrom: []api.EnvFromSource{ - { - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - }, - VolumeMounts: []api.VolumeMount{ - { - MountPath: "/cache", - Name: "cache-volume", - }, - }, - Volumes: []api.Volume{ - { - Name: "cache-volume", - VolumeSource: api.VolumeSource{ - EmptyDir: &api.EmptyDirVolumeSource{}, - }, - }, - }, - }, - } -} - -func TestCreate(t *testing.T) { - storage, server := newStorage(t) - defer server.Terminate(t) - defer storage.Store.DestroyFunc() - test := genericregistrytest.New(t, storage.Store) - invalidPodPreset := validNewPodPreset(test.TestNamespace()) - invalidPodPreset.Spec.VolumeMounts[0].Name = "/cache/VolumeMounts" - test.TestCreate( - validNewPodPreset(test.TestNamespace()), - // invalid cases - invalidPodPreset, - ) -} - -func TestUpdate(t *testing.T) { - storage, server := newStorage(t) - defer server.Terminate(t) - defer storage.Store.DestroyFunc() - test := genericregistrytest.New(t, storage.Store) - test.TestUpdate( - // valid - validNewPodPreset(test.TestNamespace()), - // invalid updates - func(obj runtime.Object) runtime.Object { - pp := obj.(*settings.PodPreset) - pp.Labels = map[string]string{"c": "d"} - return pp - }, - ) -} - -func TestDelete(t *testing.T) { - storage, server := newStorage(t) - defer server.Terminate(t) - defer storage.Store.DestroyFunc() - test := genericregistrytest.New(t, storage.Store) - test.TestDelete(validNewPodPreset(test.TestNamespace())) -} - -func TestGet(t *testing.T) { - storage, server := newStorage(t) - defer server.Terminate(t) - defer storage.Store.DestroyFunc() - test := genericregistrytest.New(t, storage.Store) - test.TestGet(validNewPodPreset(test.TestNamespace())) -} - -func TestList(t *testing.T) { - storage, server := newStorage(t) - defer server.Terminate(t) - defer storage.Store.DestroyFunc() - test := genericregistrytest.New(t, storage.Store) - test.TestList(validNewPodPreset(test.TestNamespace())) -} - -func TestWatch(t *testing.T) { - storage, server := newStorage(t) - defer server.Terminate(t) - defer storage.Store.DestroyFunc() - test := genericregistrytest.New(t, storage.Store) - test.TestWatch( - validNewPodPreset(test.TestNamespace()), - // matching labels - []labels.Set{}, - // not matching labels - // not matching labels - []labels.Set{ - {"foo": "bar"}, - }, - - // matching fields - []fields.Set{ - {"metadata.name": "podPreset"}, - }, - // not matching fields - []fields.Set{ - {"metadata.name": "bar"}, - }, - ) -} diff --git a/pkg/registry/settings/podpreset/strategy.go b/pkg/registry/settings/podpreset/strategy.go deleted file mode 100644 index 658f5696483..00000000000 --- a/pkg/registry/settings/podpreset/strategy.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright 2014 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 podpreset - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/apiserver/pkg/storage/names" - "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/apis/settings" - "k8s.io/kubernetes/pkg/apis/settings/validation" -) - -// podPresetStrategy implements verification logic for Pod Presets. -type podPresetStrategy struct { - runtime.ObjectTyper - names.NameGenerator -} - -// Strategy is the default logic that applies when creating and updating Pod Preset objects. -var Strategy = podPresetStrategy{legacyscheme.Scheme, names.SimpleNameGenerator} - -// NamespaceScoped returns true because all Pod Presets need to be within a namespace. -func (podPresetStrategy) NamespaceScoped() bool { - return true -} - -// PrepareForCreate clears the status of a Pod Preset before creation. -func (podPresetStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { - pip := obj.(*settings.PodPreset) - pip.Generation = 1 -} - -// PrepareForUpdate clears fields that are not allowed to be set by end users on update. -func (podPresetStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { - newPodPreset := obj.(*settings.PodPreset) - oldPodPreset := old.(*settings.PodPreset) - - // Update is not allowed - newPodPreset.Spec = oldPodPreset.Spec -} - -// Validate validates a new PodPreset. -func (podPresetStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { - pip := obj.(*settings.PodPreset) - return validation.ValidatePodPreset(pip) -} - -// Canonicalize normalizes the object after validation. -func (podPresetStrategy) Canonicalize(obj runtime.Object) {} - -// AllowCreateOnUpdate is false for PodPreset; this means POST is needed to create one. -func (podPresetStrategy) AllowCreateOnUpdate() bool { - return false -} - -// ValidateUpdate is the default update validation for an end user. -func (podPresetStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { - validationErrorList := validation.ValidatePodPreset(obj.(*settings.PodPreset)) - updateErrorList := validation.ValidatePodPresetUpdate(obj.(*settings.PodPreset), old.(*settings.PodPreset)) - return append(validationErrorList, updateErrorList...) -} - -// AllowUnconditionalUpdate is the default update policy for Pod Preset objects. -func (podPresetStrategy) AllowUnconditionalUpdate() bool { - return true -} diff --git a/pkg/registry/settings/rest/BUILD b/pkg/registry/settings/rest/BUILD deleted file mode 100644 index 8f26dda82f0..00000000000 --- a/pkg/registry/settings/rest/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = ["storage_settings.go"], - importpath = "k8s.io/kubernetes/pkg/registry/settings/rest", - deps = [ - "//pkg/api/legacyscheme:go_default_library", - "//pkg/apis/settings:go_default_library", - "//pkg/registry/settings/podpreset/storage:go_default_library", - "//staging/src/k8s.io/api/settings/v1alpha1:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/registry/generic:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/server:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/server/storage:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/registry/settings/rest/storage_settings.go b/pkg/registry/settings/rest/storage_settings.go deleted file mode 100644 index de21b8659ea..00000000000 --- a/pkg/registry/settings/rest/storage_settings.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -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 rest - -import ( - settingsapiv1alpha1 "k8s.io/api/settings/v1alpha1" - "k8s.io/apiserver/pkg/registry/generic" - "k8s.io/apiserver/pkg/registry/rest" - genericapiserver "k8s.io/apiserver/pkg/server" - serverstorage "k8s.io/apiserver/pkg/server/storage" - "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/apis/settings" - podpresetstore "k8s.io/kubernetes/pkg/registry/settings/podpreset/storage" -) - -type RESTStorageProvider struct{} - -func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (genericapiserver.APIGroupInfo, bool, error) { - apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(settings.GroupName, legacyscheme.Scheme, legacyscheme.ParameterCodec, legacyscheme.Codecs) - // If you add a version here, be sure to add an entry in `k8s.io/kubernetes/cmd/kube-apiserver/app/aggregator.go with specific priorities. - // TODO refactor the plumbing to provide the information in the APIGroupInfo - - if apiResourceConfigSource.VersionEnabled(settingsapiv1alpha1.SchemeGroupVersion) { - if storageMap, err := p.v1alpha1Storage(apiResourceConfigSource, restOptionsGetter); err != nil { - return genericapiserver.APIGroupInfo{}, false, nil - } else { - apiGroupInfo.VersionedResourcesStorageMap[settingsapiv1alpha1.SchemeGroupVersion.Version] = storageMap - } - } - - return apiGroupInfo, true, nil -} - -func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (map[string]rest.Storage, error) { - storage := map[string]rest.Storage{} - // podpresets - podPresetStorage, err := podpresetstore.NewREST(restOptionsGetter) - if err != nil { - return storage, err - } - storage["podpresets"] = podPresetStorage - - return storage, err -} - -func (p RESTStorageProvider) GroupName() string { - return settings.GroupName -} diff --git a/plugin/pkg/admission/podpreset/BUILD b/plugin/pkg/admission/podpreset/BUILD deleted file mode 100644 index b1ffd757c43..00000000000 --- a/plugin/pkg/admission/podpreset/BUILD +++ /dev/null @@ -1,65 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_test( - name = "go_default_test", - srcs = ["admission_test.go"], - embed = [":go_default_library"], - deps = [ - "//pkg/apis/core:go_default_library", - "//pkg/controller:go_default_library", - "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/settings/v1alpha1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/admission:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/admission/testing:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/authentication/user:go_default_library", - "//staging/src/k8s.io/client-go/informers:go_default_library", - "//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library", - "//staging/src/k8s.io/client-go/listers/settings/v1alpha1:go_default_library", - "//vendor/github.com/google/gofuzz:go_default_library", - ], -) - -go_library( - name = "go_default_library", - srcs = ["admission.go"], - importpath = "k8s.io/kubernetes/plugin/pkg/admission/podpreset", - deps = [ - "//pkg/apis/core:go_default_library", - "//pkg/apis/core/pods:go_default_library", - "//pkg/apis/core/v1:go_default_library", - "//staging/src/k8s.io/api/settings/v1alpha1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/admission:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/admission/initializer:go_default_library", - "//staging/src/k8s.io/client-go/informers:go_default_library", - "//staging/src/k8s.io/client-go/kubernetes:go_default_library", - "//staging/src/k8s.io/client-go/listers/settings/v1alpha1:go_default_library", - "//vendor/k8s.io/klog/v2:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/plugin/pkg/admission/podpreset/admission.go b/plugin/pkg/admission/podpreset/admission.go deleted file mode 100644 index 833acbe43de..00000000000 --- a/plugin/pkg/admission/podpreset/admission.go +++ /dev/null @@ -1,455 +0,0 @@ -/* -Copyright 2017 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 podpreset - -import ( - "context" - "fmt" - "io" - "reflect" - "strings" - - "k8s.io/klog/v2" - - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - utilerrors "k8s.io/apimachinery/pkg/util/errors" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/apiserver/pkg/admission" - genericadmissioninitializer "k8s.io/apiserver/pkg/admission/initializer" - "k8s.io/client-go/informers" - "k8s.io/client-go/kubernetes" - settingsv1alpha1listers "k8s.io/client-go/listers/settings/v1alpha1" - api "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/apis/core/pods" - apiscorev1 "k8s.io/kubernetes/pkg/apis/core/v1" -) - -const ( - annotationPrefix = "podpreset.admission.kubernetes.io" - // PluginName is a string with the name of the plugin - PluginName = "PodPreset" -) - -// Register registers a plugin -func Register(plugins *admission.Plugins) { - plugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) { - return NewPlugin(), nil - }) -} - -// Plugin is an implementation of admission.Interface. -type Plugin struct { - *admission.Handler - client kubernetes.Interface - - lister settingsv1alpha1listers.PodPresetLister -} - -var _ admission.MutationInterface = &Plugin{} -var _ = genericadmissioninitializer.WantsExternalKubeInformerFactory(&Plugin{}) -var _ = genericadmissioninitializer.WantsExternalKubeClientSet(&Plugin{}) - -// NewPlugin creates a new pod preset admission plugin. -func NewPlugin() *Plugin { - return &Plugin{ - Handler: admission.NewHandler(admission.Create, admission.Update), - } -} - -// ValidateInitialization validates the Plugin was initialized properly -func (p *Plugin) ValidateInitialization() error { - if p.client == nil { - return fmt.Errorf("%s requires a client", PluginName) - } - if p.lister == nil { - return fmt.Errorf("%s requires a lister", PluginName) - } - return nil -} - -// SetExternalKubeClientSet registers the client into Plugin -func (p *Plugin) SetExternalKubeClientSet(client kubernetes.Interface) { - p.client = client -} - -// SetExternalKubeInformerFactory registers an informer factory into Plugin -func (p *Plugin) SetExternalKubeInformerFactory(f informers.SharedInformerFactory) { - podPresetInformer := f.Settings().V1alpha1().PodPresets() - p.lister = podPresetInformer.Lister() - p.SetReadyFunc(podPresetInformer.Informer().HasSynced) -} - -// Admit injects a pod with the specific fields for each pod preset it matches. -func (p *Plugin) Admit(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) error { - // Ignore all calls to subresources or resources other than pods. - // Ignore all operations other than CREATE. - if len(a.GetSubresource()) != 0 || a.GetResource().GroupResource() != api.Resource("pods") || a.GetOperation() != admission.Create { - return nil - } - - pod, ok := a.GetObject().(*api.Pod) - if !ok { - return errors.NewBadRequest("Resource was marked with kind Pod but was unable to be converted") - } - - if _, isMirrorPod := pod.Annotations[api.MirrorPodAnnotationKey]; isMirrorPod { - return nil - } - - // Ignore if exclusion annotation is present - if podAnnotations := pod.GetAnnotations(); podAnnotations != nil { - klog.V(5).Infof("Looking at pod annotations, found: %v", podAnnotations) - if podAnnotations[api.PodPresetOptOutAnnotationKey] == "true" { - return nil - } - } - - list, err := p.lister.PodPresets(a.GetNamespace()).List(labels.Everything()) - if err != nil { - return fmt.Errorf("listing pod presets failed: %v", err) - } - - matchingPPs, err := filterPodPresets(list, pod) - if err != nil { - return fmt.Errorf("filtering pod presets failed: %v", err) - } - - if len(matchingPPs) == 0 { - return nil - } - - presetNames := make([]string, len(matchingPPs)) - for i, pp := range matchingPPs { - presetNames[i] = pp.GetName() - } - - // detect merge conflict - err = safeToApplyPodPresetsOnPod(pod, matchingPPs) - if err != nil { - // conflict, ignore the error, but raise an event - klog.Warningf("conflict occurred while applying podpresets: %s on pod: %v err: %v", - strings.Join(presetNames, ","), pod.GetGenerateName(), err) - return nil - } - - applyPodPresetsOnPod(pod, matchingPPs) - - klog.Infof("applied podpresets: %s successfully on Pod: %+v ", strings.Join(presetNames, ","), pod.GetGenerateName()) - - return nil -} - -// filterPodPresets returns list of PodPresets which match given Pod. -func filterPodPresets(list []*settingsv1alpha1.PodPreset, pod *api.Pod) ([]*settingsv1alpha1.PodPreset, error) { - var matchingPPs []*settingsv1alpha1.PodPreset - - for _, pp := range list { - selector, err := metav1.LabelSelectorAsSelector(&pp.Spec.Selector) - if err != nil { - return nil, fmt.Errorf("label selector conversion failed: %v for selector: %v", pp.Spec.Selector, err) - } - - // check if the pod labels match the selector - if !selector.Matches(labels.Set(pod.Labels)) { - continue - } - klog.V(4).Infof("PodPreset %s matches pod %s labels", pp.GetName(), pod.GetName()) - matchingPPs = append(matchingPPs, pp) - } - return matchingPPs, nil -} - -// safeToApplyPodPresetsOnPod determines if there is any conflict in information -// injected by given PodPresets in the Pod. -func safeToApplyPodPresetsOnPod(pod *api.Pod, podPresets []*settingsv1alpha1.PodPreset) error { - var errs []error - - // volumes attribute is defined at the Pod level, so determine if volumes - // injection is causing any conflict. - if _, err := mergeVolumes(pod.Spec.Volumes, podPresets); err != nil { - errs = append(errs, err) - } - pods.VisitContainersWithPath(&pod.Spec, field.NewPath("spec"), func(c *api.Container, _ *field.Path) bool { - if err := safeToApplyPodPresetsOnContainer(c, podPresets); err != nil { - errs = append(errs, err) - } - return true - }) - - return utilerrors.NewAggregate(errs) -} - -// safeToApplyPodPresetsOnContainer determines if there is any conflict in -// information injected by given PodPresets in the given container. -func safeToApplyPodPresetsOnContainer(ctr *api.Container, podPresets []*settingsv1alpha1.PodPreset) error { - var errs []error - // check if it is safe to merge env vars and volume mounts from given podpresets and - // container's existing env vars. - if _, err := mergeEnv(ctr.Env, podPresets); err != nil { - errs = append(errs, err) - } - if _, err := mergeVolumeMounts(ctr.VolumeMounts, podPresets); err != nil { - errs = append(errs, err) - } - - return utilerrors.NewAggregate(errs) -} - -// mergeEnv merges a list of env vars with the env vars injected by given list podPresets. -// It returns an error if it detects any conflict during the merge. -func mergeEnv(envVars []api.EnvVar, podPresets []*settingsv1alpha1.PodPreset) ([]api.EnvVar, error) { - origEnv := map[string]api.EnvVar{} - for _, v := range envVars { - origEnv[v.Name] = v - } - - mergedEnv := make([]api.EnvVar, len(envVars)) - copy(mergedEnv, envVars) - - var errs []error - - for _, pp := range podPresets { - for _, v := range pp.Spec.Env { - internalEnv := api.EnvVar{} - if err := apiscorev1.Convert_v1_EnvVar_To_core_EnvVar(&v, &internalEnv, nil); err != nil { - return nil, err - } - - found, ok := origEnv[v.Name] - if !ok { - // if we don't already have it append it and continue - origEnv[v.Name] = internalEnv - mergedEnv = append(mergedEnv, internalEnv) - continue - } - - // make sure they are identical or throw an error - if !reflect.DeepEqual(found, internalEnv) { - errs = append(errs, fmt.Errorf("merging env for %s has a conflict on %s: \n%#v\ndoes not match\n%#v\n in container", pp.GetName(), v.Name, v, found)) - } - } - } - - err := utilerrors.NewAggregate(errs) - if err != nil { - return nil, err - } - - return mergedEnv, err -} - -type envFromMergeKey struct { - prefix string - configMapRefName string - secretRefName string -} - -func newEnvFromMergeKey(e api.EnvFromSource) envFromMergeKey { - k := envFromMergeKey{prefix: e.Prefix} - if e.ConfigMapRef != nil { - k.configMapRefName = e.ConfigMapRef.Name - } - if e.SecretRef != nil { - k.secretRefName = e.SecretRef.Name - } - return k -} - -func mergeEnvFrom(envSources []api.EnvFromSource, podPresets []*settingsv1alpha1.PodPreset) ([]api.EnvFromSource, error) { - var mergedEnvFrom []api.EnvFromSource - - // merge envFrom using a identify key to ensure Admit reinvocations are idempotent - origEnvSources := map[envFromMergeKey]api.EnvFromSource{} - for _, envSource := range envSources { - origEnvSources[newEnvFromMergeKey(envSource)] = envSource - } - mergedEnvFrom = append(mergedEnvFrom, envSources...) - var errs []error - for _, pp := range podPresets { - for _, envFromSource := range pp.Spec.EnvFrom { - internalEnvFrom := api.EnvFromSource{} - if err := apiscorev1.Convert_v1_EnvFromSource_To_core_EnvFromSource(&envFromSource, &internalEnvFrom, nil); err != nil { - return nil, err - } - found, ok := origEnvSources[newEnvFromMergeKey(internalEnvFrom)] - if !ok { - mergedEnvFrom = append(mergedEnvFrom, internalEnvFrom) - continue - } - if !reflect.DeepEqual(found, internalEnvFrom) { - errs = append(errs, fmt.Errorf("merging envFrom for %s has a conflict: \n%#v\ndoes not match\n%#v\n in container", pp.GetName(), internalEnvFrom, found)) - } - } - - } - - err := utilerrors.NewAggregate(errs) - if err != nil { - return nil, err - } - - return mergedEnvFrom, nil -} - -// mergeVolumeMounts merges given list of VolumeMounts with the volumeMounts -// injected by given podPresets. It returns an error if it detects any conflict during the merge. -func mergeVolumeMounts(volumeMounts []api.VolumeMount, podPresets []*settingsv1alpha1.PodPreset) ([]api.VolumeMount, error) { - - origVolumeMounts := map[string]api.VolumeMount{} - volumeMountsByPath := map[string]api.VolumeMount{} - for _, v := range volumeMounts { - origVolumeMounts[v.Name] = v - volumeMountsByPath[v.MountPath] = v - } - - mergedVolumeMounts := make([]api.VolumeMount, len(volumeMounts)) - copy(mergedVolumeMounts, volumeMounts) - - var errs []error - - for _, pp := range podPresets { - for _, v := range pp.Spec.VolumeMounts { - internalVolumeMount := api.VolumeMount{} - if err := apiscorev1.Convert_v1_VolumeMount_To_core_VolumeMount(&v, &internalVolumeMount, nil); err != nil { - return nil, err - } - found, ok := origVolumeMounts[v.Name] - if !ok { - // if we don't already have it append it and continue - origVolumeMounts[v.Name] = internalVolumeMount - mergedVolumeMounts = append(mergedVolumeMounts, internalVolumeMount) - } else { - // make sure they are identical or throw an error - // shall we throw an error for identical volumeMounts ? - if !reflect.DeepEqual(found, internalVolumeMount) { - errs = append(errs, fmt.Errorf("merging volume mounts for %s has a conflict on %s: \n%#v\ndoes not match\n%#v\n in container", pp.GetName(), v.Name, v, found)) - } - } - - found, ok = volumeMountsByPath[v.MountPath] - if !ok { - // if we don't already have it append it and continue - volumeMountsByPath[v.MountPath] = internalVolumeMount - } else { - // make sure they are identical or throw an error - if !reflect.DeepEqual(found, internalVolumeMount) { - errs = append(errs, fmt.Errorf("merging volume mounts for %s has a conflict on mount path %s: \n%#v\ndoes not match\n%#v\n in container", pp.GetName(), v.MountPath, v, found)) - } - } - } - } - - err := utilerrors.NewAggregate(errs) - if err != nil { - return nil, err - } - - return mergedVolumeMounts, err -} - -// mergeVolumes merges given list of Volumes with the volumes injected by given -// podPresets. It returns an error if it detects any conflict during the merge. -func mergeVolumes(volumes []api.Volume, podPresets []*settingsv1alpha1.PodPreset) ([]api.Volume, error) { - origVolumes := map[string]api.Volume{} - for _, v := range volumes { - origVolumes[v.Name] = v - } - - mergedVolumes := make([]api.Volume, len(volumes)) - copy(mergedVolumes, volumes) - - var errs []error - - for _, pp := range podPresets { - for _, v := range pp.Spec.Volumes { - internalVolume := api.Volume{} - if err := apiscorev1.Convert_v1_Volume_To_core_Volume(&v, &internalVolume, nil); err != nil { - return nil, err - } - found, ok := origVolumes[v.Name] - if !ok { - // if we don't already have it append it and continue - origVolumes[v.Name] = internalVolume - mergedVolumes = append(mergedVolumes, internalVolume) - continue - } - - // make sure they are identical or throw an error - if !reflect.DeepEqual(found, internalVolume) { - errs = append(errs, fmt.Errorf("merging volumes for %s has a conflict on %s: \n%#v\ndoes not match\n%#v\n in container", pp.GetName(), v.Name, v, found)) - } - } - } - - err := utilerrors.NewAggregate(errs) - if err != nil { - return nil, err - } - - if len(mergedVolumes) == 0 { - return nil, nil - } - - return mergedVolumes, err -} - -// applyPodPresetsOnPod updates the PodSpec with merged information from all the -// applicable PodPresets. It ignores the errors of merge functions because merge -// errors have already been checked in safeToApplyPodPresetsOnPod function. -func applyPodPresetsOnPod(pod *api.Pod, podPresets []*settingsv1alpha1.PodPreset) { - if len(podPresets) == 0 { - return - } - - volumes, _ := mergeVolumes(pod.Spec.Volumes, podPresets) - pod.Spec.Volumes = volumes - - for i, ctr := range pod.Spec.Containers { - applyPodPresetsOnContainer(&ctr, podPresets) - pod.Spec.Containers[i] = ctr - } - for i, iCtr := range pod.Spec.InitContainers { - applyPodPresetsOnContainer(&iCtr, podPresets) - pod.Spec.InitContainers[i] = iCtr - } - - // add annotation - if pod.ObjectMeta.Annotations == nil { - pod.ObjectMeta.Annotations = map[string]string{} - } - - for _, pp := range podPresets { - pod.ObjectMeta.Annotations[fmt.Sprintf("%s/podpreset-%s", annotationPrefix, pp.GetName())] = pp.GetResourceVersion() - } -} - -// applyPodPresetsOnContainer injects envVars, VolumeMounts and envFrom from -// given podPresets in to the given container. It ignores conflict errors -// because it assumes those have been checked already by the caller. -func applyPodPresetsOnContainer(ctr *api.Container, podPresets []*settingsv1alpha1.PodPreset) { - envVars, _ := mergeEnv(ctr.Env, podPresets) - ctr.Env = envVars - - volumeMounts, _ := mergeVolumeMounts(ctr.VolumeMounts, podPresets) - ctr.VolumeMounts = volumeMounts - - envFrom, _ := mergeEnvFrom(ctr.EnvFrom, podPresets) - ctr.EnvFrom = envFrom -} diff --git a/plugin/pkg/admission/podpreset/admission_test.go b/plugin/pkg/admission/podpreset/admission_test.go deleted file mode 100644 index 4b883b70376..00000000000 --- a/plugin/pkg/admission/podpreset/admission_test.go +++ /dev/null @@ -1,890 +0,0 @@ -/* -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 podpreset - -import ( - "context" - "fmt" - "reflect" - "testing" - - fuzz "github.com/google/gofuzz" - corev1 "k8s.io/api/core/v1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/diff" - kadmission "k8s.io/apiserver/pkg/admission" - admissiontesting "k8s.io/apiserver/pkg/admission/testing" - "k8s.io/apiserver/pkg/authentication/user" - "k8s.io/client-go/informers" - "k8s.io/client-go/kubernetes/fake" - settingsv1alpha1listers "k8s.io/client-go/listers/settings/v1alpha1" - api "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/controller" -) - -func TestMergeEnv(t *testing.T) { - tests := map[string]struct { - orig []api.EnvVar - mod []corev1.EnvVar - result []api.EnvVar - shouldFail bool - }{ - "empty original": { - mod: []corev1.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - result: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - shouldFail: false, - }, - "good merge": { - orig: []api.EnvVar{{Name: "abcd", Value: "value2"}, {Name: "hello", Value: "value3"}}, - mod: []corev1.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - result: []api.EnvVar{{Name: "abcd", Value: "value2"}, {Name: "hello", Value: "value3"}, {Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - shouldFail: false, - }, - "conflict": { - orig: []api.EnvVar{{Name: "abc", Value: "value3"}}, - mod: []corev1.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - shouldFail: true, - }, - "one is exact same": { - orig: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "hello", Value: "value3"}}, - mod: []corev1.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - result: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "hello", Value: "value3"}, {Name: "ABC", Value: "value3"}}, - shouldFail: false, - }, - } - - for name, test := range tests { - result, err := mergeEnv( - test.orig, - []*settingsv1alpha1.PodPreset{{Spec: settingsv1alpha1.PodPresetSpec{Env: test.mod}}}, - ) - if test.shouldFail && err == nil { - t.Fatalf("expected test %q to fail but got nil", name) - } - if !test.shouldFail && err != nil { - t.Fatalf("test %q failed: %v", name, err) - } - if !reflect.DeepEqual(test.result, result) { - t.Fatalf("results were not equal for test %q: got %#v; expected: %#v", name, result, test.result) - } - } -} - -func TestMergeEnvFrom(t *testing.T) { - tests := map[string]struct { - orig []api.EnvFromSource - mod []corev1.EnvFromSource - result []api.EnvFromSource - shouldFail bool - }{ - "empty original": { - mod: []corev1.EnvFromSource{ - { - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - }, - result: []api.EnvFromSource{ - { - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - }, - shouldFail: false, - }, - "good merge": { - orig: []api.EnvFromSource{ - { - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "thing"}, - }, - }, - }, - mod: []corev1.EnvFromSource{ - { - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - }, - result: []api.EnvFromSource{ - { - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "thing"}, - }, - }, - { - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{Name: "abc"}, - }, - }, - }, - shouldFail: false, - }, - } - - for name, test := range tests { - result, err := mergeEnvFrom( - test.orig, - []*settingsv1alpha1.PodPreset{{Spec: settingsv1alpha1.PodPresetSpec{EnvFrom: test.mod}}}, - ) - if test.shouldFail && err == nil { - t.Fatalf("expected test %q to fail but got nil", name) - } - if !test.shouldFail && err != nil { - t.Fatalf("test %q failed: %v", name, err) - } - if !reflect.DeepEqual(test.result, result) { - t.Fatalf("results were not equal for test %q: got %#v; expected: %#v", name, result, test.result) - } - } -} - -func TestMergeVolumeMounts(t *testing.T) { - tests := map[string]struct { - orig []api.VolumeMount - mod []corev1.VolumeMount - result []api.VolumeMount - shouldFail bool - }{ - "empty original": { - mod: []corev1.VolumeMount{ - { - Name: "simply-mounted-volume", - MountPath: "/opt/", - }, - }, - result: []api.VolumeMount{ - { - Name: "simply-mounted-volume", - MountPath: "/opt/", - }, - }, - shouldFail: false, - }, - "good merge": { - mod: []corev1.VolumeMount{ - { - Name: "simply-mounted-volume", - MountPath: "/opt/", - }, - }, - orig: []api.VolumeMount{ - { - Name: "etc-volume", - MountPath: "/etc/", - }, - }, - result: []api.VolumeMount{ - { - Name: "etc-volume", - MountPath: "/etc/", - }, - { - Name: "simply-mounted-volume", - MountPath: "/opt/", - }, - }, - shouldFail: false, - }, - "conflict": { - mod: []corev1.VolumeMount{ - { - Name: "simply-mounted-volume", - MountPath: "/opt/", - }, - { - Name: "etc-volume", - MountPath: "/things/", - }, - }, - orig: []api.VolumeMount{ - { - Name: "etc-volume", - MountPath: "/etc/", - }, - }, - shouldFail: true, - }, - "conflict on mount path": { - mod: []corev1.VolumeMount{ - { - Name: "simply-mounted-volume", - MountPath: "/opt/", - }, - { - Name: "things-volume", - MountPath: "/etc/", - }, - }, - orig: []api.VolumeMount{ - { - Name: "etc-volume", - MountPath: "/etc/", - }, - }, - shouldFail: true, - }, - "one is exact same": { - mod: []corev1.VolumeMount{ - { - Name: "simply-mounted-volume", - MountPath: "/opt/", - }, - { - Name: "etc-volume", - MountPath: "/etc/", - }, - }, - orig: []api.VolumeMount{ - { - Name: "etc-volume", - MountPath: "/etc/", - }, - }, - result: []api.VolumeMount{ - { - Name: "etc-volume", - MountPath: "/etc/", - }, - { - Name: "simply-mounted-volume", - MountPath: "/opt/", - }, - }, - shouldFail: false, - }, - } - - for name, test := range tests { - result, err := mergeVolumeMounts( - test.orig, - []*settingsv1alpha1.PodPreset{{Spec: settingsv1alpha1.PodPresetSpec{VolumeMounts: test.mod}}}, - ) - if test.shouldFail && err == nil { - t.Fatalf("expected test %q to fail but got nil", name) - } - if !test.shouldFail && err != nil { - t.Fatalf("test %q failed: %v", name, err) - } - if !reflect.DeepEqual(test.result, result) { - t.Fatalf("results were not equal for test %q: got %#v; expected: %#v", name, result, test.result) - } - } -} - -func TestMergeVolumes(t *testing.T) { - tests := map[string]struct { - orig []api.Volume - mod []corev1.Volume - result []api.Volume - shouldFail bool - }{ - "empty original": { - mod: []corev1.Volume{ - {Name: "vol", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, - {Name: "vol2", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, - }, - result: []api.Volume{ - {Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol2", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - }, - shouldFail: false, - }, - "good merge": { - orig: []api.Volume{ - {Name: "vol3", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol4", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - }, - mod: []corev1.Volume{ - {Name: "vol", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, - {Name: "vol2", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, - }, - result: []api.Volume{ - {Name: "vol3", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol4", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol2", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - }, - shouldFail: false, - }, - "conflict": { - orig: []api.Volume{ - {Name: "vol3", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol4", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - }, - mod: []corev1.Volume{ - {Name: "vol3", VolumeSource: corev1.VolumeSource{HostPath: &corev1.HostPathVolumeSource{Path: "/etc/apparmor.d"}}}, - {Name: "vol2", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, - }, - shouldFail: true, - }, - "one is exact same": { - orig: []api.Volume{ - {Name: "vol3", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol4", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - }, - mod: []corev1.Volume{ - {Name: "vol3", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, - {Name: "vol2", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, - }, - result: []api.Volume{ - {Name: "vol3", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol4", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - {Name: "vol2", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, - }, - shouldFail: false, - }, - } - - for name, test := range tests { - result, err := mergeVolumes( - test.orig, - []*settingsv1alpha1.PodPreset{{Spec: settingsv1alpha1.PodPresetSpec{Volumes: test.mod}}}, - ) - if test.shouldFail && err == nil { - t.Fatalf("expected test %q to fail but got nil", name) - } - if !test.shouldFail && err != nil { - t.Fatalf("test %q failed: %v", name, err) - } - if !reflect.DeepEqual(test.result, result) { - t.Fatalf("results were not equal for test %q: got %#v; expected: %#v", name, result, test.result) - } - } -} - -// NewTestAdmission provides an admission plugin with test implementations of internal structs. It uses -// an authorizer that always returns true. -func NewTestAdmission(lister settingsv1alpha1listers.PodPresetLister, objects ...runtime.Object) kadmission.MutationInterface { - // Build a test client that the admission plugin can use to look up the service account missing from its cache - client := fake.NewSimpleClientset(objects...) - - return &Plugin{ - client: client, - Handler: kadmission.NewHandler(kadmission.Create), - lister: lister, - } -} - -func TestAdmitConflictWithDifferentNamespaceShouldDoNothing(t *testing.T) { - containerName := "container" - - pod := &api.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mypod", - Namespace: "namespace", - Labels: map[string]string{ - "security": "S2", - }, - }, - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Name: containerName, - Env: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - }, - }, - }, - } - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: "othernamespace", - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Env: []corev1.EnvVar{{Name: "abc", Value: "value"}, {Name: "ABC", Value: "value"}}, - }, - } - - err := admitPod(t, pod, pip) - if err != nil { - t.Fatal(err) - } -} - -func TestAdmitConflictWithNonMatchingLabelsShouldNotError(t *testing.T) { - containerName := "container" - - pod := &api.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mypod", - Namespace: "namespace", - Labels: map[string]string{ - "security": "S2", - }, - }, - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Name: containerName, - Env: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - }, - }, - }, - } - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: "namespace", - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S3"}, - }, - }, - }, - Env: []corev1.EnvVar{{Name: "abc", Value: "value"}, {Name: "ABC", Value: "value"}}, - }, - } - - err := admitPod(t, pod, pip) - if err != nil { - t.Fatal(err) - } -} - -func TestAdmitConflictShouldNotModifyPod(t *testing.T) { - containerName := "container" - - pod := &api.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mypod", - Namespace: "namespace", - Labels: map[string]string{ - "security": "S2", - }, - }, - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Name: containerName, - Env: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value3"}}, - }, - }, - }, - } - origPod := *pod - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: "namespace", - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Env: []corev1.EnvVar{{Name: "abc", Value: "value"}, {Name: "ABC", Value: "value"}}, - }, - } - - err := admitPod(t, pod, pip) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(&origPod, pod) { - t.Fatalf("pod should not get modified in case of conflict origPod: %+v got: %+v", &origPod, pod) - } -} - -func TestAdmit(t *testing.T) { - containerName := "container" - - pod := &api.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mypod", - Namespace: "namespace", - Labels: map[string]string{ - "security": "S2", - }, - }, - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Name: containerName, - Env: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABCD", Value: "value3"}}, - }, - }, - }, - } - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: "namespace", - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []corev1.Volume{{Name: "vol", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}}, - Env: []corev1.EnvVar{{Name: "abcd", Value: "value"}, {Name: "ABC", Value: "value"}}, - EnvFrom: []corev1.EnvFromSource{ - { - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - }, - }, - } - - err := admitPod(t, pod, pip) - if err != nil { - t.Fatal(err) - } -} - -func TestAdmitMirrorPod(t *testing.T) { - containerName := "container" - - mirrorPod := &api.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mypod", - Namespace: "namespace", - Labels: map[string]string{ - "security": "S2", - }, - Annotations: map[string]string{api.MirrorPodAnnotationKey: "mirror"}, - }, - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Name: containerName, - }, - }, - }, - } - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: "namespace", - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []corev1.Volume{{Name: "vol", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}}, - Env: []corev1.EnvVar{{Name: "abcd", Value: "value"}, {Name: "ABC", Value: "value"}}, - EnvFrom: []corev1.EnvFromSource{ - { - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - }, - }, - } - - if err := admitPod(t, mirrorPod, pip); err != nil { - t.Fatal(err) - } - - container := mirrorPod.Spec.Containers[0] - if len(mirrorPod.Spec.Volumes) != 0 || - len(container.VolumeMounts) != 0 || - len(container.Env) != 0 || - len(container.EnvFrom) != 0 { - t.Fatalf("mirror pod is updated by PodPreset admission:\n\tVolumes got %d, expected 0\n\tVolumeMounts go %d, expected 0\n\tEnv got, %d expected 0\n\tEnvFrom got %d, expected 0", len(mirrorPod.Spec.Volumes), len(container.VolumeMounts), len(container.Env), len(container.EnvFrom)) - } -} - -func TestExclusionNoAdmit(t *testing.T) { - containerName := "container" - - pod := &api.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mypod", - Namespace: "namespace", - Labels: map[string]string{ - "security": "S2", - }, - Annotations: map[string]string{ - api.PodPresetOptOutAnnotationKey: "true", - }, - }, - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Name: containerName, - Env: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABCD", Value: "value3"}}, - }, - }, - }, - } - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: "namespace", - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []corev1.Volume{{Name: "vol", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}}, - Env: []corev1.EnvVar{{Name: "abcd", Value: "value"}, {Name: "ABC", Value: "value"}}, - EnvFrom: []corev1.EnvFromSource{ - { - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - }, - }, - } - originalPod := pod.DeepCopy() - err := admitPod(t, pod, pip) - if err != nil { - t.Fatal(err) - } - - // verify PodSpec has not been mutated - if !reflect.DeepEqual(pod, originalPod) { - t.Fatalf("Expected pod spec of '%v' to be unchanged", pod.Name) - } -} - -func TestAdmitEmptyPodNamespace(t *testing.T) { - containerName := "container" - - pod := &api.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mypod", - Labels: map[string]string{ - "security": "S2", - }, - }, - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Name: containerName, - Env: []api.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABCD", Value: "value3"}}, - }, - }, - }, - } - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: "different", // (pod will be submitted to namespace 'namespace') - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []corev1.Volume{{Name: "vol", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}}, - Env: []corev1.EnvVar{{Name: "abcd", Value: "value"}, {Name: "ABC", Value: "value"}}, - EnvFrom: []corev1.EnvFromSource{ - { - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - { - Prefix: "pre_", - ConfigMapRef: &corev1.ConfigMapEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{Name: "abc"}, - }, - }, - }, - }, - } - originalPod := pod.DeepCopy() - err := admitPod(t, pod, pip) - if err != nil { - t.Fatal(err) - } - - // verify PodSpec has not been mutated - if !reflect.DeepEqual(pod, originalPod) { - t.Fatalf("pod should not get modified in case of emptyNamespace origPod: %+v got: %+v", originalPod, pod) - } -} - -func admitPod(t *testing.T, pod *api.Pod, pip *settingsv1alpha1.PodPreset) error { - informerFactory := informers.NewSharedInformerFactory(nil, controller.NoResyncPeriodFunc()) - store := informerFactory.Settings().V1alpha1().PodPresets().Informer().GetStore() - store.Add(pip) - plugin := admissiontesting.WithReinvocationTesting(t, NewTestAdmission(informerFactory.Settings().V1alpha1().PodPresets().Lister())) - attrs := kadmission.NewAttributesRecord( - pod, - nil, - api.Kind("Pod").WithVersion("version"), - "namespace", - "", - api.Resource("pods").WithVersion("version"), - "", - kadmission.Create, - &metav1.CreateOptions{}, - false, - &user.DefaultInfo{}, - ) - - err := plugin.Admit(context.TODO(), attrs, nil) - if err != nil { - return err - } - - return nil -} - -func TestEnvFromMergeKey(t *testing.T) { - f := fuzz.New() - for i := 0; i < 100; i++ { - t.Run(fmt.Sprintf("Run %d/100", i), func(t *testing.T) { - orig := api.EnvFromSource{} - f.Fuzz(&orig) - clone := api.EnvFromSource{} - f.Fuzz(&clone) - - key := newEnvFromMergeKey(orig) - - // copy all key fields into the clone so it only differs by fields not from the key - clone.Prefix = key.prefix - if orig.ConfigMapRef == nil { - clone.ConfigMapRef = nil - } else { - if clone.ConfigMapRef == nil { - clone.ConfigMapRef = &api.ConfigMapEnvSource{ - LocalObjectReference: api.LocalObjectReference{}, - } - } - clone.ConfigMapRef.Name = key.configMapRefName - } - if orig.SecretRef == nil { - clone.SecretRef = nil - } else { - if clone.SecretRef == nil { - clone.SecretRef = &api.SecretEnvSource{ - LocalObjectReference: api.LocalObjectReference{}, - } - } - clone.SecretRef.Name = key.secretRefName - } - - // zero out known non-identifying fields - for _, e := range []api.EnvFromSource{orig, clone} { - if e.ConfigMapRef != nil { - e.ConfigMapRef.Optional = nil - } - if e.SecretRef != nil { - e.SecretRef.Optional = nil - } - } - - if !reflect.DeepEqual(orig, clone) { - t.Errorf("expected all but known non-identifying fields for envFrom to be in envFromMergeKey but found unaccounted for differences, diff:\n%s", diff.ObjectReflectDiff(orig, clone)) - } - - }) - } -} diff --git a/staging/src/k8s.io/api/roundtrip_test.go b/staging/src/k8s.io/api/roundtrip_test.go index 0bc318a5da4..a23b778df94 100644 --- a/staging/src/k8s.io/api/roundtrip_test.go +++ b/staging/src/k8s.io/api/roundtrip_test.go @@ -58,7 +58,6 @@ import ( schedulingv1 "k8s.io/api/scheduling/v1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" @@ -110,7 +109,6 @@ var groups = []runtime.SchemeBuilder{ schedulingv1alpha1.SchemeBuilder, schedulingv1beta1.SchemeBuilder, schedulingv1.SchemeBuilder, - settingsv1alpha1.SchemeBuilder, storagev1alpha1.SchemeBuilder, storagev1beta1.SchemeBuilder, storagev1.SchemeBuilder, diff --git a/staging/src/k8s.io/api/settings/v1alpha1/BUILD b/staging/src/k8s.io/api/settings/v1alpha1/BUILD deleted file mode 100644 index 16e48959bdf..00000000000 --- a/staging/src/k8s.io/api/settings/v1alpha1/BUILD +++ /dev/null @@ -1,40 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = [ - "doc.go", - "generated.pb.go", - "register.go", - "types.go", - "types_swagger_doc_generated.go", - "zz_generated.deepcopy.go", - ], - importmap = "k8s.io/kubernetes/vendor/k8s.io/api/settings/v1alpha1", - importpath = "k8s.io/api/settings/v1alpha1", - deps = [ - "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", - "//vendor/github.com/gogo/protobuf/proto:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/staging/src/k8s.io/api/settings/v1alpha1/doc.go b/staging/src/k8s.io/api/settings/v1alpha1/doc.go deleted file mode 100644 index 60066bb6dbd..00000000000 --- a/staging/src/k8s.io/api/settings/v1alpha1/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2017 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 -// +k8s:protobuf-gen=package -// +k8s:openapi-gen=true - -// +groupName=settings.k8s.io - -package v1alpha1 // import "k8s.io/api/settings/v1alpha1" diff --git a/staging/src/k8s.io/api/settings/v1alpha1/generated.pb.go b/staging/src/k8s.io/api/settings/v1alpha1/generated.pb.go deleted file mode 100644 index 7ed066d31c6..00000000000 --- a/staging/src/k8s.io/api/settings/v1alpha1/generated.pb.go +++ /dev/null @@ -1,1053 +0,0 @@ -/* -Copyright 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. DO NOT EDIT. -// source: k8s.io/kubernetes/vendor/k8s.io/api/settings/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - v11 "k8s.io/api/core/v1" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *PodPreset) Reset() { *m = PodPreset{} } -func (*PodPreset) ProtoMessage() {} -func (*PodPreset) Descriptor() ([]byte, []int) { - return fileDescriptor_48fab0a6ea4b79ce, []int{0} -} -func (m *PodPreset) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodPreset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodPreset) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodPreset.Merge(m, src) -} -func (m *PodPreset) XXX_Size() int { - return m.Size() -} -func (m *PodPreset) XXX_DiscardUnknown() { - xxx_messageInfo_PodPreset.DiscardUnknown(m) -} - -var xxx_messageInfo_PodPreset proto.InternalMessageInfo - -func (m *PodPresetList) Reset() { *m = PodPresetList{} } -func (*PodPresetList) ProtoMessage() {} -func (*PodPresetList) Descriptor() ([]byte, []int) { - return fileDescriptor_48fab0a6ea4b79ce, []int{1} -} -func (m *PodPresetList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodPresetList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodPresetList) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodPresetList.Merge(m, src) -} -func (m *PodPresetList) XXX_Size() int { - return m.Size() -} -func (m *PodPresetList) XXX_DiscardUnknown() { - xxx_messageInfo_PodPresetList.DiscardUnknown(m) -} - -var xxx_messageInfo_PodPresetList proto.InternalMessageInfo - -func (m *PodPresetSpec) Reset() { *m = PodPresetSpec{} } -func (*PodPresetSpec) ProtoMessage() {} -func (*PodPresetSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_48fab0a6ea4b79ce, []int{2} -} -func (m *PodPresetSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodPresetSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodPresetSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodPresetSpec.Merge(m, src) -} -func (m *PodPresetSpec) XXX_Size() int { - return m.Size() -} -func (m *PodPresetSpec) XXX_DiscardUnknown() { - xxx_messageInfo_PodPresetSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_PodPresetSpec proto.InternalMessageInfo - -func init() { - proto.RegisterType((*PodPreset)(nil), "k8s.io.api.settings.v1alpha1.PodPreset") - proto.RegisterType((*PodPresetList)(nil), "k8s.io.api.settings.v1alpha1.PodPresetList") - proto.RegisterType((*PodPresetSpec)(nil), "k8s.io.api.settings.v1alpha1.PodPresetSpec") -} - -func init() { - proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/api/settings/v1alpha1/generated.proto", fileDescriptor_48fab0a6ea4b79ce) -} - -var fileDescriptor_48fab0a6ea4b79ce = []byte{ - // 542 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x8e, 0xd2, 0x40, - 0x1c, 0xc6, 0xe9, 0xb2, 0x04, 0x1c, 0xd8, 0x68, 0x1a, 0x0f, 0x0d, 0x31, 0x65, 0xe5, 0xe2, 0x26, - 0xc6, 0x19, 0x59, 0x8d, 0xd1, 0x6b, 0x13, 0x4c, 0x4c, 0x20, 0x6e, 0x4a, 0xb2, 0x89, 0xc6, 0x83, - 0x43, 0xf9, 0x5b, 0x2a, 0xb4, 0xd3, 0xcc, 0x4c, 0x9b, 0x78, 0xf3, 0x11, 0x7c, 0x01, 0x9f, 0x44, - 0x1f, 0x80, 0xe3, 0x1e, 0xf7, 0xb4, 0x91, 0xfa, 0x22, 0x66, 0x86, 0x29, 0xa0, 0x88, 0x72, 0x9b, - 0xff, 0x9f, 0xef, 0xfb, 0xcd, 0xf7, 0x31, 0x45, 0xfd, 0xd9, 0x73, 0x81, 0x23, 0x46, 0x66, 0xd9, - 0x18, 0x78, 0x02, 0x12, 0x04, 0xc9, 0x21, 0x99, 0x30, 0x4e, 0xcc, 0x0f, 0x34, 0x8d, 0x88, 0x00, - 0x29, 0xa3, 0x24, 0x14, 0x24, 0xef, 0xd1, 0x79, 0x3a, 0xa5, 0x3d, 0x12, 0x42, 0x02, 0x9c, 0x4a, - 0x98, 0xe0, 0x94, 0x33, 0xc9, 0xec, 0x7b, 0x2b, 0x35, 0xa6, 0x69, 0x84, 0x4b, 0x35, 0x2e, 0xd5, - 0xed, 0x47, 0x61, 0x24, 0xa7, 0xd9, 0x18, 0x07, 0x2c, 0x26, 0x21, 0x0b, 0x19, 0xd1, 0xa6, 0x71, - 0xf6, 0x41, 0x4f, 0x7a, 0xd0, 0xa7, 0x15, 0xac, 0xdd, 0xdd, 0xba, 0x3a, 0x60, 0x1c, 0x48, 0xbe, - 0x73, 0x61, 0xfb, 0xe9, 0x46, 0x13, 0xd3, 0x60, 0x1a, 0x25, 0xc0, 0x3f, 0x91, 0x74, 0x16, 0xaa, - 0x85, 0x20, 0x31, 0x48, 0xfa, 0x37, 0x17, 0xd9, 0xe7, 0xe2, 0x59, 0x22, 0xa3, 0x18, 0x76, 0x0c, - 0xcf, 0xfe, 0x67, 0x10, 0xc1, 0x14, 0x62, 0xfa, 0xa7, 0xaf, 0xfb, 0xdd, 0x42, 0xb7, 0x2e, 0xd8, - 0xe4, 0x82, 0x83, 0x00, 0x69, 0xbf, 0x47, 0x0d, 0x95, 0x68, 0x42, 0x25, 0x75, 0xac, 0x53, 0xeb, - 0xac, 0x79, 0xfe, 0x18, 0x6f, 0xfe, 0xb0, 0x35, 0x18, 0xa7, 0xb3, 0x50, 0x2d, 0x04, 0x56, 0x6a, - 0x9c, 0xf7, 0xf0, 0xeb, 0xf1, 0x47, 0x08, 0xe4, 0x10, 0x24, 0xf5, 0xec, 0xc5, 0x4d, 0xa7, 0x52, - 0xdc, 0x74, 0xd0, 0x66, 0xe7, 0xaf, 0xa9, 0xf6, 0x10, 0x1d, 0x8b, 0x14, 0x02, 0xe7, 0x48, 0xd3, - 0x1f, 0xe2, 0x7f, 0x3d, 0x07, 0x5e, 0x07, 0x1b, 0xa5, 0x10, 0x78, 0x2d, 0x03, 0x3e, 0x56, 0x93, - 0xaf, 0x31, 0xdd, 0x6f, 0x16, 0x3a, 0x59, 0xab, 0x06, 0x91, 0x90, 0xf6, 0xbb, 0x9d, 0x0a, 0xf8, - 0xb0, 0x0a, 0xca, 0xad, 0x0b, 0xdc, 0x31, 0xf7, 0x34, 0xca, 0xcd, 0x56, 0xfc, 0x01, 0xaa, 0x45, - 0x12, 0x62, 0xe1, 0x1c, 0x9d, 0x56, 0xcf, 0x9a, 0xe7, 0x0f, 0x0e, 0xcc, 0xef, 0x9d, 0x18, 0x66, - 0xed, 0x95, 0x72, 0xfb, 0x2b, 0x48, 0xf7, 0x6b, 0x75, 0x2b, 0xbd, 0x6a, 0x65, 0x53, 0xd4, 0x10, - 0x30, 0x87, 0x40, 0x32, 0x6e, 0xd2, 0x3f, 0x39, 0x30, 0x3d, 0x1d, 0xc3, 0x7c, 0x64, 0xac, 0x9b, - 0x0a, 0xe5, 0xc6, 0x5f, 0x63, 0xed, 0x17, 0xa8, 0x0a, 0x49, 0x6e, 0x0a, 0xb4, 0xb7, 0x0b, 0xa8, - 0x4f, 0x58, 0xb1, 0xfa, 0x49, 0x7e, 0x49, 0xb9, 0xd7, 0x34, 0x90, 0x6a, 0x3f, 0xc9, 0x7d, 0xe5, - 0xb1, 0x07, 0xa8, 0x0e, 0x49, 0xfe, 0x92, 0xb3, 0xd8, 0xa9, 0x6a, 0xfb, 0xfd, 0x3d, 0x76, 0x25, - 0x19, 0xb1, 0x8c, 0x07, 0xe0, 0xdd, 0x36, 0x94, 0xba, 0x59, 0xfb, 0x25, 0xc2, 0xee, 0xa3, 0x7a, - 0xce, 0xe6, 0x59, 0x0c, 0xc2, 0x39, 0xde, 0x1f, 0xe6, 0x52, 0x4b, 0x36, 0x98, 0xd5, 0x2c, 0xfc, - 0xd2, 0x6b, 0xbf, 0x41, 0xad, 0xd5, 0x71, 0xc8, 0xb2, 0x44, 0x0a, 0xa7, 0xa6, 0x59, 0x9d, 0xfd, - 0x2c, 0xad, 0xf3, 0xee, 0x1a, 0x60, 0x6b, 0x6b, 0x29, 0xfc, 0xdf, 0x50, 0x1e, 0x5e, 0x2c, 0xdd, - 0xca, 0xd5, 0xd2, 0xad, 0x5c, 0x2f, 0xdd, 0xca, 0xe7, 0xc2, 0xb5, 0x16, 0x85, 0x6b, 0x5d, 0x15, - 0xae, 0x75, 0x5d, 0xb8, 0xd6, 0x8f, 0xc2, 0xb5, 0xbe, 0xfc, 0x74, 0x2b, 0x6f, 0x1b, 0xe5, 0x7b, - 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x46, 0x15, 0xf2, 0x97, 0xa4, 0x04, 0x00, 0x00, -} - -func (m *PodPreset) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodPreset) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodPreset) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodPresetList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodPresetList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodPresetList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodPresetSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodPresetSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodPresetSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.VolumeMounts) > 0 { - for iNdEx := len(m.VolumeMounts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.VolumeMounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.Volumes) > 0 { - for iNdEx := len(m.Volumes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Volumes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.EnvFrom) > 0 { - for iNdEx := len(m.EnvFrom) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.EnvFrom[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Env) > 0 { - for iNdEx := len(m.Env) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Env[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PodPreset) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PodPresetList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *PodPresetSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Selector.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Env) > 0 { - for _, e := range m.Env { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.EnvFrom) > 0 { - for _, e := range m.EnvFrom { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Volumes) > 0 { - for _, e := range m.Volumes { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.VolumeMounts) > 0 { - for _, e := range m.VolumeMounts { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *PodPreset) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodPreset{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "PodPresetSpec", "PodPresetSpec", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *PodPresetList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]PodPreset{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PodPreset", "PodPreset", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&PodPresetList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *PodPresetSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForEnv := "[]EnvVar{" - for _, f := range this.Env { - repeatedStringForEnv += fmt.Sprintf("%v", f) + "," - } - repeatedStringForEnv += "}" - repeatedStringForEnvFrom := "[]EnvFromSource{" - for _, f := range this.EnvFrom { - repeatedStringForEnvFrom += fmt.Sprintf("%v", f) + "," - } - repeatedStringForEnvFrom += "}" - repeatedStringForVolumes := "[]Volume{" - for _, f := range this.Volumes { - repeatedStringForVolumes += fmt.Sprintf("%v", f) + "," - } - repeatedStringForVolumes += "}" - repeatedStringForVolumeMounts := "[]VolumeMount{" - for _, f := range this.VolumeMounts { - repeatedStringForVolumeMounts += fmt.Sprintf("%v", f) + "," - } - repeatedStringForVolumeMounts += "}" - s := strings.Join([]string{`&PodPresetSpec{`, - `Selector:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1), `&`, ``, 1) + `,`, - `Env:` + repeatedStringForEnv + `,`, - `EnvFrom:` + repeatedStringForEnvFrom + `,`, - `Volumes:` + repeatedStringForVolumes + `,`, - `VolumeMounts:` + repeatedStringForVolumeMounts + `,`, - `}`, - }, "") - 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 *PodPreset) 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: PodPreset: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodPreset: 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 < 0 { - return ErrInvalidLengthGenerated - } - 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 < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.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) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodPresetList) 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: PodPresetList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodPresetList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", 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 < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", 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 < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, PodPreset{}) - if err := m.Items[len(m.Items)-1].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) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodPresetSpec) 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: PodPresetSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodPresetSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", 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 < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Env", 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 < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Env = append(m.Env, v11.EnvVar{}) - if err := m.Env[len(m.Env)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EnvFrom", 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 < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EnvFrom = append(m.EnvFrom, v11.EnvFromSource{}) - if err := m.EnvFrom[len(m.EnvFrom)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Volumes", 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 < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Volumes = append(m.Volumes, v11.Volume{}) - if err := m.Volumes[len(m.Volumes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VolumeMounts", 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 < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VolumeMounts = append(m.VolumeMounts, v11.VolumeMount{}) - if err := m.VolumeMounts[len(m.VolumeMounts)-1].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) < 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 - depth := 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 - } - } - case 1: - iNdEx += 8 - 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 - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/staging/src/k8s.io/api/settings/v1alpha1/generated.proto b/staging/src/k8s.io/api/settings/v1alpha1/generated.proto deleted file mode 100644 index 3e9bd0a6992..00000000000 --- a/staging/src/k8s.io/api/settings/v1alpha1/generated.proto +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 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.api.settings.v1alpha1; - -import "k8s.io/api/core/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "v1alpha1"; - -// PodPreset is a policy resource that defines additional runtime -// requirements for a Pod. -message PodPreset { - // +optional - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - // +optional - optional PodPresetSpec spec = 2; -} - -// PodPresetList is a list of PodPreset objects. -message PodPresetList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - // Items is a list of schema objects. - repeated PodPreset items = 2; -} - -// PodPresetSpec is a description of a pod preset. -message PodPresetSpec { - // Selector is a label query over a set of resources, in this case pods. - // Required. - optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 1; - - // Env defines the collection of EnvVar to inject into containers. - // +optional - repeated k8s.io.api.core.v1.EnvVar env = 2; - - // EnvFrom defines the collection of EnvFromSource to inject into containers. - // +optional - repeated k8s.io.api.core.v1.EnvFromSource envFrom = 3; - - // Volumes defines the collection of Volume to inject into the pod. - // +optional - repeated k8s.io.api.core.v1.Volume volumes = 4; - - // VolumeMounts defines the collection of VolumeMount to inject into containers. - // +optional - repeated k8s.io.api.core.v1.VolumeMount volumeMounts = 5; -} - diff --git a/staging/src/k8s.io/api/settings/v1alpha1/register.go b/staging/src/k8s.io/api/settings/v1alpha1/register.go deleted file mode 100644 index eee278d9592..00000000000 --- a/staging/src/k8s.io/api/settings/v1alpha1/register.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2017 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 ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name use in this package -const GroupName = "settings.k8s.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. - // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - localSchemeBuilder = &SchemeBuilder - AddToScheme = localSchemeBuilder.AddToScheme -) - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &PodPreset{}, - &PodPresetList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/staging/src/k8s.io/api/settings/v1alpha1/types.go b/staging/src/k8s.io/api/settings/v1alpha1/types.go deleted file mode 100644 index 8cc99d440d4..00000000000 --- a/staging/src/k8s.io/api/settings/v1alpha1/types.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2017 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/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodPreset is a policy resource that defines additional runtime -// requirements for a Pod. -type PodPreset struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // +optional - Spec PodPresetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` -} - -// PodPresetSpec is a description of a pod preset. -type PodPresetSpec struct { - // Selector is a label query over a set of resources, in this case pods. - // Required. - Selector metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,1,opt,name=selector"` - - // Env defines the collection of EnvVar to inject into containers. - // +optional - Env []v1.EnvVar `json:"env,omitempty" protobuf:"bytes,2,rep,name=env"` - // EnvFrom defines the collection of EnvFromSource to inject into containers. - // +optional - EnvFrom []v1.EnvFromSource `json:"envFrom,omitempty" protobuf:"bytes,3,rep,name=envFrom"` - // Volumes defines the collection of Volume to inject into the pod. - // +optional - Volumes []v1.Volume `json:"volumes,omitempty" protobuf:"bytes,4,rep,name=volumes"` - // VolumeMounts defines the collection of VolumeMount to inject into containers. - // +optional - VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty" protobuf:"bytes,5,rep,name=volumeMounts"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodPresetList is a list of PodPreset objects. -type PodPresetList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is a list of schema objects. - Items []PodPreset `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/staging/src/k8s.io/api/settings/v1alpha1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/settings/v1alpha1/types_swagger_doc_generated.go deleted file mode 100644 index 0501e0af357..00000000000 --- a/staging/src/k8s.io/api/settings/v1alpha1/types_swagger_doc_generated.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 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 - -// This file contains a collection of methods that can be used from go-restful to -// generate Swagger API documentation for its models. Please read this PR for more -// information on the implementation: https://github.com/emicklei/go-restful/pull/215 -// -// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if -// they are on one line! For multiple line or blocks that you want to ignore use ---. -// Any context after a --- is ignored. -// -// Those methods can be generated by using hack/update-generated-swagger-docs.sh - -// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. -var map_PodPreset = map[string]string{ - "": "PodPreset is a policy resource that defines additional runtime requirements for a Pod.", -} - -func (PodPreset) SwaggerDoc() map[string]string { - return map_PodPreset -} - -var map_PodPresetList = map[string]string{ - "": "PodPresetList is a list of PodPreset objects.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "items": "Items is a list of schema objects.", -} - -func (PodPresetList) SwaggerDoc() map[string]string { - return map_PodPresetList -} - -var map_PodPresetSpec = map[string]string{ - "": "PodPresetSpec is a description of a pod preset.", - "selector": "Selector is a label query over a set of resources, in this case pods. Required.", - "env": "Env defines the collection of EnvVar to inject into containers.", - "envFrom": "EnvFrom defines the collection of EnvFromSource to inject into containers.", - "volumes": "Volumes defines the collection of Volume to inject into the pod.", - "volumeMounts": "VolumeMounts defines the collection of VolumeMount to inject into containers.", -} - -func (PodPresetSpec) SwaggerDoc() map[string]string { - return map_PodPresetSpec -} - -// AUTO-GENERATED FUNCTIONS END HERE diff --git a/staging/src/k8s.io/api/settings/v1alpha1/zz_generated.deepcopy.go b/staging/src/k8s.io/api/settings/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index ed6c31a32c9..00000000000 --- a/staging/src/k8s.io/api/settings/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,131 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 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 deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodPreset) DeepCopyInto(out *PodPreset) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodPreset. -func (in *PodPreset) DeepCopy() *PodPreset { - if in == nil { - return nil - } - out := new(PodPreset) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodPreset) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodPresetList) DeepCopyInto(out *PodPresetList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PodPreset, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodPresetList. -func (in *PodPresetList) DeepCopy() *PodPresetList { - if in == nil { - return nil - } - out := new(PodPresetList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodPresetList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodPresetSpec) DeepCopyInto(out *PodPresetSpec) { - *out = *in - in.Selector.DeepCopyInto(&out.Selector) - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.EnvFrom != nil { - in, out := &in.EnvFrom, &out.EnvFrom - *out = make([]v1.EnvFromSource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Volumes != nil { - in, out := &in.Volumes, &out.Volumes - *out = make([]v1.Volume, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.VolumeMounts != nil { - in, out := &in.VolumeMounts, &out.VolumeMounts - *out = make([]v1.VolumeMount, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodPresetSpec. -func (in *PodPresetSpec) DeepCopy() *PodPresetSpec { - if in == nil { - return nil - } - out := new(PodPresetSpec) - in.DeepCopyInto(out) - return out -} diff --git a/staging/src/k8s.io/client-go/informers/factory.go b/staging/src/k8s.io/client-go/informers/factory.go index 495cedada66..c6e10269905 100644 --- a/staging/src/k8s.io/client-go/informers/factory.go +++ b/staging/src/k8s.io/client-go/informers/factory.go @@ -44,7 +44,6 @@ import ( policy "k8s.io/client-go/informers/policy" rbac "k8s.io/client-go/informers/rbac" scheduling "k8s.io/client-go/informers/scheduling" - settings "k8s.io/client-go/informers/settings" storage "k8s.io/client-go/informers/storage" kubernetes "k8s.io/client-go/kubernetes" cache "k8s.io/client-go/tools/cache" @@ -207,7 +206,6 @@ type SharedInformerFactory interface { Policy() policy.Interface Rbac() rbac.Interface Scheduling() scheduling.Interface - Settings() settings.Interface Storage() storage.Interface } @@ -279,10 +277,6 @@ func (f *sharedInformerFactory) Scheduling() scheduling.Interface { return scheduling.New(f, f.namespace, f.tweakListOptions) } -func (f *sharedInformerFactory) Settings() settings.Interface { - return settings.New(f, f.namespace, f.tweakListOptions) -} - func (f *sharedInformerFactory) Storage() storage.Interface { return storage.New(f, f.namespace, f.tweakListOptions) } diff --git a/staging/src/k8s.io/client-go/informers/generic.go b/staging/src/k8s.io/client-go/informers/generic.go index acbba12f347..0a764945a66 100644 --- a/staging/src/k8s.io/client-go/informers/generic.go +++ b/staging/src/k8s.io/client-go/informers/generic.go @@ -55,7 +55,6 @@ import ( schedulingv1 "k8s.io/api/scheduling/v1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" @@ -317,10 +316,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PriorityClasses().Informer()}, nil - // Group=settings.k8s.io, Version=v1alpha1 - case settingsv1alpha1.SchemeGroupVersion.WithResource("podpresets"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Settings().V1alpha1().PodPresets().Informer()}, nil - // Group=storage.k8s.io, Version=v1 case storagev1.SchemeGroupVersion.WithResource("csidrivers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIDrivers().Informer()}, nil diff --git a/staging/src/k8s.io/client-go/kubernetes/clientset.go b/staging/src/k8s.io/client-go/kubernetes/clientset.go index 4d8f2591cfc..2035f6bc2cf 100644 --- a/staging/src/k8s.io/client-go/kubernetes/clientset.go +++ b/staging/src/k8s.io/client-go/kubernetes/clientset.go @@ -60,7 +60,6 @@ import ( schedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" schedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" - settingsv1alpha1 "k8s.io/client-go/kubernetes/typed/settings/v1alpha1" storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1" storagev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1" @@ -108,7 +107,6 @@ type Interface interface { SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface SchedulingV1() schedulingv1.SchedulingV1Interface - SettingsV1alpha1() settingsv1alpha1.SettingsV1alpha1Interface StorageV1beta1() storagev1beta1.StorageV1beta1Interface StorageV1() storagev1.StorageV1Interface StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface @@ -156,7 +154,6 @@ type Clientset struct { schedulingV1alpha1 *schedulingv1alpha1.SchedulingV1alpha1Client schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client schedulingV1 *schedulingv1.SchedulingV1Client - settingsV1alpha1 *settingsv1alpha1.SettingsV1alpha1Client storageV1beta1 *storagev1beta1.StorageV1beta1Client storageV1 *storagev1.StorageV1Client storageV1alpha1 *storagev1alpha1.StorageV1alpha1Client @@ -352,11 +349,6 @@ func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { return c.schedulingV1 } -// SettingsV1alpha1 retrieves the SettingsV1alpha1Client -func (c *Clientset) SettingsV1alpha1() settingsv1alpha1.SettingsV1alpha1Interface { - return c.settingsV1alpha1 -} - // StorageV1beta1 retrieves the StorageV1beta1Client func (c *Clientset) StorageV1beta1() storagev1beta1.StorageV1beta1Interface { return c.storageV1beta1 @@ -545,10 +537,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.settingsV1alpha1, err = settingsv1alpha1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } cs.storageV1beta1, err = storagev1beta1.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -611,7 +599,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.schedulingV1alpha1 = schedulingv1alpha1.NewForConfigOrDie(c) cs.schedulingV1beta1 = schedulingv1beta1.NewForConfigOrDie(c) cs.schedulingV1 = schedulingv1.NewForConfigOrDie(c) - cs.settingsV1alpha1 = settingsv1alpha1.NewForConfigOrDie(c) cs.storageV1beta1 = storagev1beta1.NewForConfigOrDie(c) cs.storageV1 = storagev1.NewForConfigOrDie(c) cs.storageV1alpha1 = storagev1alpha1.NewForConfigOrDie(c) @@ -661,7 +648,6 @@ func New(c rest.Interface) *Clientset { cs.schedulingV1alpha1 = schedulingv1alpha1.New(c) cs.schedulingV1beta1 = schedulingv1beta1.New(c) cs.schedulingV1 = schedulingv1.New(c) - cs.settingsV1alpha1 = settingsv1alpha1.New(c) cs.storageV1beta1 = storagev1beta1.New(c) cs.storageV1 = storagev1.New(c) cs.storageV1alpha1 = storagev1alpha1.New(c) diff --git a/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go b/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go index ce4bb3344cc..8b88d88ce21 100644 --- a/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go +++ b/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go @@ -100,8 +100,6 @@ import ( fakeschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake" schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" fakeschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake" - settingsv1alpha1 "k8s.io/client-go/kubernetes/typed/settings/v1alpha1" - fakesettingsv1alpha1 "k8s.io/client-go/kubernetes/typed/settings/v1alpha1/fake" storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1" fakestoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1/fake" storagev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" @@ -348,11 +346,6 @@ func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { return &fakeschedulingv1.FakeSchedulingV1{Fake: &c.Fake} } -// SettingsV1alpha1 retrieves the SettingsV1alpha1Client -func (c *Clientset) SettingsV1alpha1() settingsv1alpha1.SettingsV1alpha1Interface { - return &fakesettingsv1alpha1.FakeSettingsV1alpha1{Fake: &c.Fake} -} - // StorageV1beta1 retrieves the StorageV1beta1Client func (c *Clientset) StorageV1beta1() storagev1beta1.StorageV1beta1Interface { return &fakestoragev1beta1.FakeStorageV1beta1{Fake: &c.Fake} diff --git a/staging/src/k8s.io/client-go/kubernetes/fake/register.go b/staging/src/k8s.io/client-go/kubernetes/fake/register.go index fcbeb629f01..9937b2af11d 100644 --- a/staging/src/k8s.io/client-go/kubernetes/fake/register.go +++ b/staging/src/k8s.io/client-go/kubernetes/fake/register.go @@ -57,7 +57,6 @@ import ( schedulingv1 "k8s.io/api/scheduling/v1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" @@ -110,7 +109,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{ schedulingv1alpha1.AddToScheme, schedulingv1beta1.AddToScheme, schedulingv1.AddToScheme, - settingsv1alpha1.AddToScheme, storagev1beta1.AddToScheme, storagev1.AddToScheme, storagev1alpha1.AddToScheme, diff --git a/staging/src/k8s.io/client-go/kubernetes/scheme/register.go b/staging/src/k8s.io/client-go/kubernetes/scheme/register.go index 6beaab3dac4..71766fe48c0 100644 --- a/staging/src/k8s.io/client-go/kubernetes/scheme/register.go +++ b/staging/src/k8s.io/client-go/kubernetes/scheme/register.go @@ -57,7 +57,6 @@ import ( schedulingv1 "k8s.io/api/scheduling/v1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" @@ -110,7 +109,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{ schedulingv1alpha1.AddToScheme, schedulingv1beta1.AddToScheme, schedulingv1.AddToScheme, - settingsv1alpha1.AddToScheme, storagev1beta1.AddToScheme, storagev1.AddToScheme, storagev1alpha1.AddToScheme, diff --git a/staging/src/k8s.io/kubectl/pkg/scheme/install.go b/staging/src/k8s.io/kubectl/pkg/scheme/install.go index 06dc0a2a619..8640c70216c 100644 --- a/staging/src/k8s.io/kubectl/pkg/scheme/install.go +++ b/staging/src/k8s.io/kubectl/pkg/scheme/install.go @@ -44,7 +44,6 @@ import ( rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" rbacv1beta1 "k8s.io/api/rbac/v1beta1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" storagev1 "k8s.io/api/storage/v1" storagev1beta1 "k8s.io/api/storage/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -79,6 +78,5 @@ func init() { utilruntime.Must(Scheme.SetVersionPriority(policyv1beta1.SchemeGroupVersion)) utilruntime.Must(Scheme.SetVersionPriority(rbacv1.SchemeGroupVersion, rbacv1beta1.SchemeGroupVersion, rbacv1alpha1.SchemeGroupVersion)) utilruntime.Must(Scheme.SetVersionPriority(schedulingv1alpha1.SchemeGroupVersion)) - utilruntime.Must(Scheme.SetVersionPriority(settingsv1alpha1.SchemeGroupVersion)) utilruntime.Must(Scheme.SetVersionPriority(storagev1.SchemeGroupVersion, storagev1beta1.SchemeGroupVersion)) } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index ebf5228018e..61f7f61727e 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -53,7 +53,6 @@ import ( _ "k8s.io/kubernetes/test/e2e/network" _ "k8s.io/kubernetes/test/e2e/node" _ "k8s.io/kubernetes/test/e2e/scheduling" - _ "k8s.io/kubernetes/test/e2e/servicecatalog" _ "k8s.io/kubernetes/test/e2e/storage" _ "k8s.io/kubernetes/test/e2e/storage/external" _ "k8s.io/kubernetes/test/e2e/ui" diff --git a/test/e2e/servicecatalog/BUILD b/test/e2e/servicecatalog/BUILD deleted file mode 100644 index cfcdf65bf4f..00000000000 --- a/test/e2e/servicecatalog/BUILD +++ /dev/null @@ -1,39 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = [ - "framework.go", - "podpreset.go", - ], - importpath = "k8s.io/kubernetes/test/e2e/servicecatalog", - visibility = ["//visibility:public"], - deps = [ - "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/settings/v1alpha1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library", - "//staging/src/k8s.io/client-go/kubernetes:go_default_library", - "//test/e2e/framework:go_default_library", - "//test/e2e/framework/pod:go_default_library", - "//test/e2e/framework/skipper:go_default_library", - "//test/utils/image:go_default_library", - "//vendor/github.com/onsi/ginkgo:go_default_library", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], - visibility = ["//visibility:public"], -) diff --git a/test/e2e/servicecatalog/framework.go b/test/e2e/servicecatalog/framework.go deleted file mode 100644 index 39af84e65ba..00000000000 --- a/test/e2e/servicecatalog/framework.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2017 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 servicecatalog - -import "github.com/onsi/ginkgo" - -// SIGDescribe annotates the test with the SIG label. -func SIGDescribe(text string, body func()) bool { - return ginkgo.Describe("[sig-service-catalog] "+text, body) -} diff --git a/test/e2e/servicecatalog/podpreset.go b/test/e2e/servicecatalog/podpreset.go deleted file mode 100644 index edd2564f1a9..00000000000 --- a/test/e2e/servicecatalog/podpreset.go +++ /dev/null @@ -1,294 +0,0 @@ -/* -Copyright 2015 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 servicecatalog - -import ( - "context" - "reflect" - "strconv" - "time" - - "k8s.io/api/core/v1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/watch" - clientset "k8s.io/client-go/kubernetes" - "k8s.io/kubernetes/test/e2e/framework" - e2epod "k8s.io/kubernetes/test/e2e/framework/pod" - e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper" - imageutils "k8s.io/kubernetes/test/utils/image" - - "github.com/onsi/ginkgo" -) - -var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() { - f := framework.NewDefaultFramework("podpreset") - - var podClient *framework.PodClient - ginkgo.BeforeEach(func() { - // only run on gce for the time being til we find an easier way to update - // the admission controllers used on the others - e2eskipper.SkipUnlessProviderIs("gce") - podClient = f.PodClient() - }) - - // Simplest case: all pods succeed promptly - ginkgo.It("should create a pod preset", func() { - ginkgo.By("Creating a pod preset") - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: f.Namespace.Name, - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []v1.Volume{{Name: "vol", VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}}}, - VolumeMounts: []v1.VolumeMount{ - {Name: "vol", MountPath: "/foo"}, - }, - Env: []v1.EnvVar{{Name: "abc", Value: "value"}, {Name: "ABC", Value: "value"}}, - }, - } - - _, err := createPodPreset(f.ClientSet, f.Namespace.Name, pip) - if apierrors.IsNotFound(err) { - e2eskipper.Skipf("podpresets requires k8s.io/api/settings/v1alpha1 to be enabled") - } - framework.ExpectNoError(err) - - ginkgo.By("creating the pod") - name := "pod-preset-pod" - value := strconv.Itoa(time.Now().Nanosecond()) - pod := &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: f.Namespace.Name, - Labels: map[string]string{ - "name": "foo", - "time": value, - "security": "S2", - }, - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: "nginx", - Image: imageutils.GetE2EImage(imageutils.Nginx), - }, - }, - InitContainers: []v1.Container{ - { - Name: "init1", - Image: imageutils.GetE2EImage(imageutils.BusyBox), - Command: []string{"/bin/true"}, - }, - }, - }, - } - - ginkgo.By("setting up watch") - selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value})) - options := metav1.ListOptions{LabelSelector: selector.String()} - pods, err := podClient.List(context.TODO(), options) - framework.ExpectNoError(err, "failed to query for pod") - framework.ExpectEqual(len(pods.Items), 0) - options = metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: pods.ListMeta.ResourceVersion, - } - w, err := podClient.Watch(context.TODO(), options) - framework.ExpectNoError(err, "failed to set up watch") - - ginkgo.By("submitting the pod to kubernetes") - podClient.Create(pod) - - ginkgo.By("verifying the pod is in kubernetes") - selector = labels.SelectorFromSet(labels.Set(map[string]string{"time": value})) - options = metav1.ListOptions{LabelSelector: selector.String()} - pods, err = podClient.List(context.TODO(), options) - framework.ExpectNoError(err, "failed to query for pod") - framework.ExpectEqual(len(pods.Items), 1) - - ginkgo.By("verifying pod creation was observed") - select { - case event, _ := <-w.ResultChan(): - if event.Type != watch.Added { - framework.Failf("Failed to observe pod creation: %v", event) - } - case <-time.After(framework.PodStartTimeout): - framework.Failf("Timeout while waiting for pod creation") - } - - // We need to wait for the pod to be running, otherwise the deletion - // may be carried out immediately rather than gracefully. - framework.ExpectNoError(e2epod.WaitForPodNameRunningInNamespace(f.ClientSet, pod.Name, f.Namespace.Name)) - - ginkgo.By("ensuring pod is modified") - // save the running pod - pod, err = podClient.Get(context.TODO(), pod.Name, metav1.GetOptions{}) - framework.ExpectNoError(err, "failed to GET scheduled pod") - - // check the annotation is there - if _, ok := pod.Annotations["podpreset.admission.kubernetes.io/podpreset-hello"]; !ok { - framework.Failf("Annotation not found in pod annotations: \n%v\n", pod.Annotations) - } - - // verify the env is the same - if !reflect.DeepEqual(pip.Spec.Env, pod.Spec.Containers[0].Env) { - framework.Failf("env of pod container does not match the env of the pip: expected %#v, got: %#v", pip.Spec.Env, pod.Spec.Containers[0].Env) - } - if !reflect.DeepEqual(pip.Spec.Env, pod.Spec.InitContainers[0].Env) { - framework.Failf("env of pod init container does not match the env of the pip: expected %#v, got: %#v", pip.Spec.Env, pod.Spec.InitContainers[0].Env) - } - }) - - ginkgo.It("should not modify the pod on conflict", func() { - ginkgo.By("Creating a pod preset") - - pip := &settingsv1alpha1.PodPreset{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hello", - Namespace: f.Namespace.Name, - }, - Spec: settingsv1alpha1.PodPresetSpec{ - Selector: metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{ - { - Key: "security", - Operator: metav1.LabelSelectorOpIn, - Values: []string{"S2"}, - }, - }, - }, - Volumes: []v1.Volume{{Name: "vol", VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}}}, - VolumeMounts: []v1.VolumeMount{ - {Name: "vol", MountPath: "/foo"}, - }, - Env: []v1.EnvVar{{Name: "abc", Value: "value"}, {Name: "ABC", Value: "value"}}, - }, - } - - _, err := createPodPreset(f.ClientSet, f.Namespace.Name, pip) - if apierrors.IsNotFound(err) { - e2eskipper.Skipf("podpresets requires k8s.io/api/settings/v1alpha1 to be enabled") - } - framework.ExpectNoError(err) - - ginkgo.By("creating the pod") - name := "pod-preset-pod" - value := strconv.Itoa(time.Now().Nanosecond()) - originalPod := &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: f.Namespace.Name, - Labels: map[string]string{ - "name": "foo", - "time": value, - "security": "S2", - }, - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: "nginx", - Image: imageutils.GetE2EImage(imageutils.Nginx), - Env: []v1.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value"}}, - }, - }, - InitContainers: []v1.Container{ - { - Name: "init1", - Image: imageutils.GetE2EImage(imageutils.BusyBox), - Env: []v1.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value"}}, - Command: []string{"/bin/true"}, - }, - }, - }, - } - - ginkgo.By("setting up watch") - selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value})) - options := metav1.ListOptions{LabelSelector: selector.String()} - pods, err := podClient.List(context.TODO(), options) - framework.ExpectNoError(err, "failed to query for pod") - framework.ExpectEqual(len(pods.Items), 0) - options = metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: pods.ListMeta.ResourceVersion, - } - w, err := podClient.Watch(context.TODO(), options) - framework.ExpectNoError(err, "failed to set up watch") - - ginkgo.By("submitting the pod to kubernetes") - podClient.Create(originalPod) - - ginkgo.By("verifying the pod is in kubernetes") - selector = labels.SelectorFromSet(labels.Set(map[string]string{"time": value})) - options = metav1.ListOptions{LabelSelector: selector.String()} - pods, err = podClient.List(context.TODO(), options) - framework.ExpectNoError(err, "failed to query for pod") - framework.ExpectEqual(len(pods.Items), 1) - - ginkgo.By("verifying pod creation was observed") - select { - case event, _ := <-w.ResultChan(): - if event.Type != watch.Added { - framework.Failf("Failed to observe pod creation: %v", event) - } - case <-time.After(framework.PodStartTimeout): - framework.Failf("Timeout while waiting for pod creation") - } - - // We need to wait for the pod to be running, otherwise the deletion - // may be carried out immediately rather than gracefully. - framework.ExpectNoError(e2epod.WaitForPodNameRunningInNamespace(f.ClientSet, originalPod.Name, f.Namespace.Name)) - - ginkgo.By("ensuring pod is modified") - // save the running pod - pod, err := podClient.Get(context.TODO(), originalPod.Name, metav1.GetOptions{}) - framework.ExpectNoError(err, "failed to GET scheduled pod") - - // check the annotation is not there - if _, ok := pod.Annotations["podpreset.admission.kubernetes.io/podpreset-hello"]; ok { - framework.Failf("Annotation found in pod annotations and should not be: \n%v\n", pod.Annotations) - } - - // verify the env is the same - if !reflect.DeepEqual(originalPod.Spec.Containers[0].Env, pod.Spec.Containers[0].Env) { - framework.Failf("env of pod container does not match the env of the original pod: expected %#v, got: %#v", originalPod.Spec.Containers[0].Env, pod.Spec.Containers[0].Env) - } - if !reflect.DeepEqual(originalPod.Spec.InitContainers[0].Env, pod.Spec.InitContainers[0].Env) { - framework.Failf("env of pod init container does not match the env of the original pod: expected %#v, got: %#v", originalPod.Spec.InitContainers[0].Env, pod.Spec.InitContainers[0].Env) - } - - }) -}) - -func createPodPreset(c clientset.Interface, ns string, job *settingsv1alpha1.PodPreset) (*settingsv1alpha1.PodPreset, error) { - return c.SettingsV1alpha1().PodPresets(ns).Create(context.TODO(), job, metav1.CreateOptions{}) -} diff --git a/test/integration/apiserver/print_test.go b/test/integration/apiserver/print_test.go index e0520200144..73110c82efb 100644 --- a/test/integration/apiserver/print_test.go +++ b/test/integration/apiserver/print_test.go @@ -36,7 +36,6 @@ import ( nodev1alpha1 "k8s.io/api/node/v1alpha1" rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" schedulerapi "k8s.io/api/scheduling/v1" - settingsv1alpha1 "k8s.io/api/settings/v1alpha1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" "k8s.io/apimachinery/pkg/api/meta" metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1" @@ -167,7 +166,6 @@ func TestServerSidePrint(t *testing.T) { discoveryv1alpha1.SchemeGroupVersion, discoveryv1beta1.SchemeGroupVersion, rbacv1alpha1.SchemeGroupVersion, - settingsv1alpha1.SchemeGroupVersion, schedulerapi.SchemeGroupVersion, storagev1alpha1.SchemeGroupVersion, extensionsv1beta1.SchemeGroupVersion, diff --git a/test/integration/etcd/data.go b/test/integration/etcd/data.go index b8525f4c3dd..2c3e10e76eb 100644 --- a/test/integration/etcd/data.go +++ b/test/integration/etcd/data.go @@ -321,13 +321,6 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes }, // -- - // k8s.io/kubernetes/pkg/apis/settings/v1alpha1 - gvr("settings.k8s.io", "v1alpha1", "podpresets"): { - Stub: `{"metadata": {"name": "podpre1"}, "spec": {"env": [{"name": "FOO"}]}}`, - ExpectedEtcdPath: "/registry/podpresets/" + namespace + "/podpre1", - }, - // -- - // k8s.io/kubernetes/pkg/apis/rbac/v1alpha1 gvr("rbac.authorization.k8s.io", "v1alpha1", "roles"): { Stub: `{"metadata": {"name": "role1"}, "rules": [{"apiGroups": ["v1"], "resources": ["events"], "verbs": ["watch"]}]}`, diff --git a/test/kubemark/resources/start-kubemark-master.sh b/test/kubemark/resources/start-kubemark-master.sh index 8010f5d181a..692ee5caff0 100755 --- a/test/kubemark/resources/start-kubemark-master.sh +++ b/test/kubemark/resources/start-kubemark-master.sh @@ -368,7 +368,6 @@ function create-master-audit-policy { - group: "networking.k8s.io" - group: "policy" - group: "rbac.authorization.k8s.io" - - group: "settings.k8s.io" - group: "storage.k8s.io"' cat <"${path}"