Merge pull request #46294 from caesarxuchao/dynamic-registration-prototype

Automatic merge from submit-queue (batch tested with PRs 46383, 45645, 45923, 44884, 46294)

Dynamic registration prototype

Implementing the api proposed in https://github.com/kubernetes/community/pull/611.
Wiring the code to serve the api via apiserver.
```release-note
Adding admissionregistration API group which enables dynamic registration of initializers and external admission webhooks. It is an alpha feature.
```
pull/6/head
Kubernetes Submit Queue 2017-05-26 12:58:07 -07:00 committed by GitHub
commit 7bc6da0b77
194 changed files with 30909 additions and 120 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,114 @@
{
"swaggerVersion": "1.2",
"apiVersion": "",
"basePath": "https://10.10.10.10:6443",
"resourcePath": "/apis/admissionregistration.k8s.io",
"info": {
"title": "",
"description": ""
},
"apis": [
{
"path": "/apis/admissionregistration.k8s.io",
"description": "get information of a group",
"operations": [
{
"type": "v1.APIGroup",
"method": "GET",
"summary": "get information of a group",
"nickname": "getAPIGroup",
"parameters": [],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
]
}
]
}
],
"models": {
"v1.APIGroup": {
"id": "v1.APIGroup",
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
"required": [
"name",
"versions",
"serverAddressByClientCIDRs"
],
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"name": {
"type": "string",
"description": "name is the name of the group."
},
"versions": {
"type": "array",
"items": {
"$ref": "v1.GroupVersionForDiscovery"
},
"description": "versions are the versions supported in this group."
},
"preferredVersion": {
"$ref": "v1.GroupVersionForDiscovery",
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version."
},
"serverAddressByClientCIDRs": {
"type": "array",
"items": {
"$ref": "v1.ServerAddressByClientCIDR"
},
"description": "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP."
}
}
},
"v1.GroupVersionForDiscovery": {
"id": "v1.GroupVersionForDiscovery",
"description": "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.",
"required": [
"groupVersion",
"version"
],
"properties": {
"groupVersion": {
"type": "string",
"description": "groupVersion specifies the API group and version in the form \"group/version\""
},
"version": {
"type": "string",
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion."
}
}
},
"v1.ServerAddressByClientCIDR": {
"id": "v1.ServerAddressByClientCIDR",
"description": "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.",
"required": [
"clientCIDR",
"serverAddress"
],
"properties": {
"clientCIDR": {
"type": "string",
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use."
},
"serverAddress": {
"type": "string",
"description": "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port."
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -132,6 +132,14 @@
{
"path": "/apis/apps",
"description": "get information of a group"
},
{
"path": "/apis/admissionregistration.k8s.io/v1alpha1",
"description": "API at /apis/admissionregistration.k8s.io/v1alpha1"
},
{
"path": "/apis/admissionregistration.k8s.io",
"description": "get information of a group"
}
],
"apiVersion": "",

View File

@ -36,6 +36,7 @@ var (
test = flag.BoolP("test", "t", false, "set this flag to generate the client code for the testdata")
inputVersions = flag.StringSlice("input", []string{
"api/",
"admissionregistration/",
"authentication/",
"authorization/",
"autoscaling/",

View File

@ -91,6 +91,7 @@ func New() *Generator {
`k8s.io/kubernetes/pkg/apis/storage/v1beta1`,
`k8s.io/kubernetes/pkg/apis/storage/v1`,
`k8s.io/kubernetes/pkg/apis/admission/v1alpha1`,
`k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1`,
}, ","),
DropEmbeddedFields: "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta",
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,7 @@ pkg/api/v1/node
pkg/api/v1/service
pkg/apis/abac/v0
pkg/apis/abac/v1beta1
pkg/apis/admissionregistration/install
pkg/apis/apps/install
pkg/apis/apps/v1beta1
pkg/apis/authentication/install
@ -91,6 +92,8 @@ pkg/auth/nodeidentifier
pkg/bootstrap/api
pkg/client/conditions
pkg/client/informers/informers_generated/externalversions
pkg/client/informers/informers_generated/externalversions/admissionregistration
pkg/client/informers/informers_generated/externalversions/admissionregistration/v1alpha1
pkg/client/informers/informers_generated/externalversions/apps
pkg/client/informers/informers_generated/externalversions/apps/v1beta1
pkg/client/informers/informers_generated/externalversions/autoscaling
@ -116,6 +119,8 @@ pkg/client/informers/informers_generated/externalversions/storage
pkg/client/informers/informers_generated/externalversions/storage/v1
pkg/client/informers/informers_generated/externalversions/storage/v1beta1
pkg/client/informers/informers_generated/internalversion
pkg/client/informers/informers_generated/internalversion/admissionregistration
pkg/client/informers/informers_generated/internalversion/admissionregistration/internalversion
pkg/client/informers/informers_generated/internalversion/apps
pkg/client/informers/informers_generated/internalversion/apps/internalversion
pkg/client/informers/informers_generated/internalversion/autoscaling
@ -136,6 +141,8 @@ pkg/client/informers/informers_generated/internalversion/settings
pkg/client/informers/informers_generated/internalversion/settings/internalversion
pkg/client/informers/informers_generated/internalversion/storage
pkg/client/informers/informers_generated/internalversion/storage/internalversion
pkg/client/listers/admissionregistration/internalversion
pkg/client/listers/admissionregistration/v1alpha1
pkg/client/listers/apps/internalversion
pkg/client/listers/apps/v1beta1
pkg/client/listers/authentication/internalversion
@ -349,6 +356,8 @@ staging/src/k8s.io/client-go/examples/in-cluster
staging/src/k8s.io/client-go/examples/out-of-cluster
staging/src/k8s.io/client-go/examples/third-party-resources
staging/src/k8s.io/client-go/informers
staging/src/k8s.io/client-go/informers/admissionregistration
staging/src/k8s.io/client-go/informers/admissionregistration/v1alpha1
staging/src/k8s.io/client-go/informers/apps
staging/src/k8s.io/client-go/informers/apps/v1beta1
staging/src/k8s.io/client-go/informers/autoscaling
@ -373,6 +382,7 @@ staging/src/k8s.io/client-go/informers/settings/v1alpha1
staging/src/k8s.io/client-go/informers/storage
staging/src/k8s.io/client-go/informers/storage/v1
staging/src/k8s.io/client-go/informers/storage/v1beta1
staging/src/k8s.io/client-go/listers/admissionregistration/v1alpha1
staging/src/k8s.io/client-go/listers/apps/v1beta1
staging/src/k8s.io/client-go/listers/autoscaling/v1
staging/src/k8s.io/client-go/listers/autoscaling/v2alpha1

View File

@ -52,6 +52,7 @@ KUBE_OUTPUT_HOSTBIN="${KUBE_OUTPUT_BINPATH}/$(kube::util::host_platform)"
# most preferred version for a group should appear first
KUBE_AVAILABLE_GROUP_VERSIONS="${KUBE_AVAILABLE_GROUP_VERSIONS:-\
v1 \
admissionregistration.k8s.io/v1alpha1 \
apps/v1beta1 \
authentication.k8s.io/v1 \
authentication.k8s.io/v1beta1 \

View File

@ -58,7 +58,9 @@ API_HOST=${API_HOST:-127.0.0.1}
kube::etcd::start
# Start kube-apiserver, with alpha api versions on so we can harvest their swagger docs
# Set --runtime-config to all versions in KUBE_AVAILABLE_GROUP_VERSIONS to enable alpha features.
kube::log::status "Starting kube-apiserver"
"${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
--insecure-bind-address="${API_HOST}" \
@ -67,8 +69,7 @@ kube::log::status "Starting kube-apiserver"
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
--advertise-address="10.10.10.10" \
--cert-dir="${TMP_DIR}/certs" \
--runtime-config="batch/v2alpha1" \
--runtime-config="autoscaling/v2alpha1" \
--runtime-config=$(echo "${KUBE_AVAILABLE_GROUP_VERSIONS}" | sed "s|\s|,|g") \
--service-cluster-ip-range="10.0.0.0/24" >/tmp/swagger-api-server.log 2>&1 &
APISERVER_PID=$!

View File

@ -17,6 +17,7 @@ filegroup(
"//pkg/apimachinery/tests:all-srcs",
"//pkg/apis/abac:all-srcs",
"//pkg/apis/admission:all-srcs",
"//pkg/apis/admissionregistration:all-srcs",
"//pkg/apis/apps:all-srcs",
"//pkg/apis/authentication:all-srcs",
"//pkg/apis/authorization:all-srcs",
@ -43,6 +44,8 @@ filegroup(
"//pkg/client/informers/informers_generated/externalversions:all-srcs",
"//pkg/client/informers/informers_generated/internalversion:all-srcs",
"//pkg/client/leaderelection:all-srcs",
"//pkg/client/listers/admissionregistration/internalversion:all-srcs",
"//pkg/client/listers/admissionregistration/v1alpha1:all-srcs",
"//pkg/client/listers/apps/internalversion:all-srcs",
"//pkg/client/listers/apps/v1beta1:all-srcs",
"//pkg/client/listers/authentication/internalversion:all-srcs",

View File

@ -103,24 +103,28 @@ func TestDefaulting(t *testing.T) {
// This object contains only int fields which currently breaks the defaulting test because
// it's pretty stupid. Once we add non integer fields, we should uncomment this.
// {Group: "kubeadm.k8s.io", Version: "v1alpha1", Kind: "NodeConfiguration"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSet"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSetList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "Deployment"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "DeploymentList"}: {},
{Group: "apps", Version: "v1beta1", Kind: "Deployment"}: {},
{Group: "apps", Version: "v1beta1", Kind: "DeploymentList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "ReplicaSet"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "ReplicaSetList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRoleBinding"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRoleBindingList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "RoleBinding"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "RoleBindingList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRoleBinding"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRoleBindingList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "RoleBinding"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "RoleBindingList"}: {},
{Group: "settings.k8s.io", Version: "v1alpha1", Kind: "PodPreset"}: {},
{Group: "settings.k8s.io", Version: "v1alpha1", Kind: "PodPresetList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSet"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSetList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "Deployment"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "DeploymentList"}: {},
{Group: "apps", Version: "v1beta1", Kind: "Deployment"}: {},
{Group: "apps", Version: "v1beta1", Kind: "DeploymentList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "ReplicaSet"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "ReplicaSetList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRoleBinding"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRoleBindingList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "RoleBinding"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "RoleBindingList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRoleBinding"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "ClusterRoleBindingList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "RoleBinding"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Kind: "RoleBindingList"}: {},
{Group: "settings.k8s.io", Version: "v1alpha1", Kind: "PodPreset"}: {},
{Group: "settings.k8s.io", Version: "v1alpha1", Kind: "PodPresetList"}: {},
{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "InitializerConfiguration"}: {},
{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "InitializerConfigurationList"}: {},
{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ExternalAdmissionHookConfiguration"}: {},
{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ExternalAdmissionHookConfigurationList"}: {},
}
f := fuzz.New().NilChance(.5).NumElements(1, 1).RandSource(rand.NewSource(1))

View File

@ -17,6 +17,8 @@ go_library(
"//federation/apis/federation/install:go_default_library",
"//pkg/api:go_default_library",
"//pkg/api/install:go_default_library",
"//pkg/apis/admissionregistration:go_default_library",
"//pkg/apis/admissionregistration/install:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/apis/apps/install:go_default_library",
"//pkg/apis/authentication/install:go_default_library",

View File

@ -36,6 +36,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer/recognizer"
"k8s.io/kubernetes/federation/apis/federation"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/admissionregistration"
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/apis/authorization"
"k8s.io/kubernetes/pkg/apis/autoscaling"
@ -50,6 +51,7 @@ import (
_ "k8s.io/kubernetes/federation/apis/federation/install"
_ "k8s.io/kubernetes/pkg/api/install"
_ "k8s.io/kubernetes/pkg/apis/admissionregistration/install"
_ "k8s.io/kubernetes/pkg/apis/apps/install"
_ "k8s.io/kubernetes/pkg/apis/authentication/install"
_ "k8s.io/kubernetes/pkg/apis/authorization/install"
@ -278,7 +280,15 @@ func init() {
externalTypes: api.Scheme.KnownTypes(externalGroupVersion),
}
}
if _, ok := Groups[admissionregistration.GroupName]; !ok {
externalGroupVersion := schema.GroupVersion{Group: admissionregistration.GroupName, Version: api.Registry.GroupOrDie(admissionregistration.GroupName).GroupVersion.Version}
Groups[admissionregistration.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion,
internalGroupVersion: admissionregistration.SchemeGroupVersion,
internalTypes: api.Scheme.KnownTypes(admissionregistration.SchemeGroupVersion),
externalTypes: api.Scheme.KnownTypes(externalGroupVersion),
}
}
Default = Groups[api.GroupName]
Autoscaling = Groups[autoscaling.GroupName]
Batch = Groups[batch.GroupName]

View File

@ -20,6 +20,7 @@ go_library(
"//pkg/api:go_default_library",
"//pkg/api/testapi:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/apis/admissionregistration:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/batch:go_default_library",

View File

@ -36,6 +36,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/admissionregistration"
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/batch"
@ -738,6 +739,21 @@ func certificateFuncs(t apitesting.TestingCommon) []interface{} {
}
}
func admissionregistrationFuncs(t apitesting.TestingCommon) []interface{} {
return []interface{}{
func(obj *admissionregistration.ExternalAdmissionHook, c fuzz.Continue) {
c.FuzzNoCustom(obj) // fuzz self without calling this function again
p := admissionregistration.FailurePolicyType("Fail")
obj.FailurePolicy = &p
},
func(obj *admissionregistration.Initializer, c fuzz.Continue) {
c.FuzzNoCustom(obj) // fuzz self without calling this function again
p := admissionregistration.FailurePolicyType("Fail")
obj.FailurePolicy = &p
},
}
}
func FuzzerFuncs(t apitesting.TestingCommon, codecs runtimeserializer.CodecFactory) []interface{} {
return apitesting.MergeFuzzerFuncs(t,
apitesting.GenericFuzzerFuncs(t, codecs),
@ -751,6 +767,7 @@ func FuzzerFuncs(t apitesting.TestingCommon, codecs runtimeserializer.CodecFacto
kubeadmfuzzer.KubeadmFuzzerFuncs(t),
policyFuncs(t),
certificateFuncs(t),
admissionregistrationFuncs(t),
)
}

View File

@ -0,0 +1,43 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
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",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//pkg/apis/admissionregistration/install:all-srcs",
"//pkg/apis/admissionregistration/v1alpha1:all-srcs",
"//pkg/apis/admissionregistration/validation:all-srcs",
],
tags = ["automanaged"],
)

View File

@ -0,0 +1,24 @@
/*
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,register
// Package admissionregistration is the internal version of the API.
// AdmissionConfiguration and AdmissionPluginConfiguration are legacy static admission plugin configuration
// InitializerConfiguration and ExternalAdmissionHookConfiguration is for the
// new dynamic admission controller configuration.
// +groupName=admissionregistration.k8s.io
package admissionregistration // import "k8s.io/kubernetes/pkg/apis/admissionregistration"

View File

@ -0,0 +1,36 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["install.go"],
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/apis/admissionregistration:go_default_library",
"//pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apimachinery/announced:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,49 @@
/*
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 install
import (
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/admissionregistration"
"k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
)
func init() {
Install(api.GroupFactoryRegistry, api.Registry, api.Scheme)
}
// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: admissionregistration.GroupName,
RootScopedKinds: sets.NewString("InitializerConfiguration", "ExternalAdmissionHookConfiguration"),
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
ImportPrefix: "k8s.io/kubernetes/pkg/apis/admissionregistration",
AddInternalObjectsToScheme: admissionregistration.AddToScheme,
},
announced.VersionToSchemeFunc{
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme,
},
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
}
}

View File

@ -0,0 +1,53 @@
/*
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 admissionregistration
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const GroupName = "admissionregistration.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 back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&InitializerConfiguration{},
&InitializerConfigurationList{},
&ExternalAdmissionHookConfiguration{},
&ExternalAdmissionHookConfigurationList{},
)
return nil
}

View File

@ -0,0 +1,210 @@
/*
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 admissionregistration
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient=true
// InitializerConfiguration describes the configuration of initializers.
type InitializerConfiguration struct {
metav1.TypeMeta
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
// +optional
metav1.ObjectMeta
// Initializers is a list of resources and their default initializers
// Order-sensitive.
// When merging multiple InitializerConfigurations, we sort the initializers
// from different InitializerConfigurations by the name of the
// InitializerConfigurations; the order of the initializers from the same
// InitializerConfiguration is preserved.
// +optional
Initializers []Initializer
}
// InitializerConfigurationList is a list of InitializerConfiguration.
type InitializerConfigurationList struct {
metav1.TypeMeta
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
// +optional
metav1.ListMeta
// List of InitializerConfiguration.
Items []InitializerConfiguration
}
// Initializer describes the name and the failure policy of an initializer, and
// what resources it applies to.
type Initializer struct {
// Name is the identifier of the initializer. It will be added to the
// object that needs to be initialized.
// Name should be fully qualified, e.g., alwayspullimages.kubernetes.io, where
// "alwayspullimages" is the name of the webhook, and kubernetes.io is the name
// of the organization.
// Required
Name string
// Rules describes what resources/subresources the initializer cares about.
// The initializer cares about an operation if it matches _any_ Rule.
Rules []Rule
// FailurePolicy defines what happens if the responsible initializer controller
// fails to takes action. Allowed values are Ignore, or Fail. If "Ignore" is
// set, initializer is removed from the initializers list of an object if
// the timeout is reached; If "Fail" is set, admissionregistration returns timeout error
// if the timeout is reached.
FailurePolicy *FailurePolicyType
}
// Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended
// to make sure that all the tuple expansions are valid.
type Rule struct {
// APIGroups is the API groups the resources belong to. '*' is all groups.
// If '*' is present, the length of the slice must be one.
// Required.
APIGroups []string
// APIVersions is the API versions the resources belong to. '*' is all versions.
// If '*' is present, the length of the slice must be one.
// Required.
APIVersions []string
// Resources is a list of resources this rule applies to.
//
// For example:
// 'pods' means pods.
// 'pods/log' means the log subresource of pods.
// '*' means all resources, but not subresources.
// 'pods/*' means all subresources of pods.
// '*/scale' means all scale subresources.
// '*/*' means all resources and their subresources.
//
// If '*' or '*/*' is present, the length of the slice must be one.
// Required.
Resources []string
}
type FailurePolicyType string
const (
// Ignore means the initilizer is removed from the initializers list of an
// object if the initializer is timed out.
Ignore FailurePolicyType = "Ignore"
// For 1.7, only "Ignore" is allowed. "Fail" will be allowed when the
// extensible admission feature is beta.
Fail FailurePolicyType = "Fail"
)
// +genclient=true
// ExternalAdmissionHookConfiguration describes the configuration of initializers.
type ExternalAdmissionHookConfiguration struct {
metav1.TypeMeta
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
// +optional
metav1.ObjectMeta
// ExternalAdmissionHooks is a list of external admission webhooks and the
// affected resources and operations.
// +optional
ExternalAdmissionHooks []ExternalAdmissionHook
}
// ExternalAdmissionHookConfigurationList is a list of ExternalAdmissionHookConfiguration.
type ExternalAdmissionHookConfigurationList struct {
metav1.TypeMeta
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
// +optional
metav1.ListMeta
// List of ExternalAdmissionHookConfiguration.
Items []ExternalAdmissionHookConfiguration
}
// ExternalAdmissionHook describes an external admission webhook and the
// resources and operations it applies to.
type ExternalAdmissionHook struct {
// The name of the external admission webhook.
// Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where
// "imagepolicy" is the name of the webhook, and kubernetes.io is the name
// of the organization.
// Required.
Name string
// ClientConfig defines how to communicate with the hook.
// Required
ClientConfig AdmissionHookClientConfig
// Rules describes what operations on what resources/subresources the webhook cares about.
// The webhook cares about an operation if it matches _any_ Rule.
Rules []RuleWithOperations
// FailurePolicy defines how unrecognized errors from the admission endpoint are handled -
// allowed values are Ignore or Fail. Defaults to Ignore.
// +optional
FailurePolicy *FailurePolicyType
}
// RuleWithOperations is a tuple of Operations and Resources. It is recommended to make
// sure that all the tuple expansions are valid.
type RuleWithOperations struct {
// Operations is the operations the admission hook cares about - CREATE, UPDATE, or *
// for all operations.
// If '*' is present, the length of the slice must be one.
// Required.
Operations []OperationType
// Rule is embedded, it describes other criteria of the rule, like
// APIGroups, APIVersions, Resources, etc.
Rule
}
type OperationType string
// The constants should be kept in sync with those defined in k8s.io/kubernetes/pkg/admission/interface.go.
const (
OperationAll OperationType = "*"
Create OperationType = "CREATE"
Update OperationType = "UPDATE"
Delete OperationType = "DELETE"
Connect OperationType = "CONNECT"
)
// AdmissionHookClientConfig contains the information to make a TLS
// connection with the webhook
type AdmissionHookClientConfig struct {
// Service is a reference to the service for this webhook. If there is only
// one port open for the service, that port will be used. If there are multiple
// ports open, port 443 will be used if it is open, otherwise it is an error.
// Required
Service ServiceReference
// CABundle is a PEM encoded CA bundle which will be used to validate webhook's server certificate.
// Required
CABundle []byte
}
// ServiceReference holds a reference to Service.legacy.k8s.io
type ServiceReference struct {
// Namespace is the namespace of the service
// Required
Namespace string
// Name is the name of the service
// Required
Name string
}

View File

@ -0,0 +1,48 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"defaults.go",
"doc.go",
"generated.pb.go",
"register.go",
"types.generated.go",
"types.go",
"types_swagger_doc_generated.go",
"zz_generated.conversion.go",
"zz_generated.deepcopy.go",
"zz_generated.defaults.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/ugorji/go/codec:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,39 @@
/*
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/apimachinery/pkg/runtime"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
func SetDefaults_Initializer(obj *Initializer) {
if obj.FailurePolicy == nil {
policy := Ignore
obj.FailurePolicy = &policy
}
}
func SetDefaults_ExternalAdmissionHook(obj *ExternalAdmissionHook) {
if obj.FailurePolicy == nil {
policy := Ignore
obj.FailurePolicy = &policy
}
}

View File

@ -0,0 +1,27 @@
/*
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,register
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/admissionregistration
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta
// Package v1alpha1 is the v1alpha1 version of the API.
// AdmissionConfiguration and AdmissionPluginConfiguration are legacy static admission plugin configuration
// InitializerConfiguration and ExternalAdmissionHookConfiguration is for the
// new dynamic admission controller configuration.
// +groupName=admissionregistration.k8s.io
package v1alpha1 // import "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,200 @@
/*
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.
*/
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = 'proto2';
package k8s.io.kubernetes.pkg.apis.admissionregistration.v1alpha1;
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";
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1alpha1";
// AdmissionHookClientConfig contains the information to make a TLS
// connection with the webhook
message AdmissionHookClientConfig {
// Service is a reference to the service for this webhook. If there is only
// one port open for the service, that port will be used. If there are multiple
// ports open, port 443 will be used if it is open, otherwise it is an error.
// Required
optional ServiceReference service = 1;
// CABundle is a PEM encoded CA bundle which will be used to validate webhook's server certificate.
// Required
optional bytes caBundle = 2;
}
// ExternalAdmissionHook describes an external admission webhook and the
// resources and operations it applies to.
message ExternalAdmissionHook {
// The name of the external admission webhook.
// Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where
// "imagepolicy" is the name of the webhook, and kubernetes.io is the name
// of the organization.
// Required.
optional string name = 1;
// ClientConfig defines how to communicate with the hook.
// Required
optional AdmissionHookClientConfig clientConfig = 2;
// Rules describes what operations on what resources/subresources the webhook cares about.
// The webhook cares about an operation if it matches _any_ Rule.
repeated RuleWithOperations rules = 3;
// FailurePolicy defines how unrecognized errors from the admission endpoint are handled -
// allowed values are Ignore or Fail. Defaults to Ignore.
// +optional
optional string failurePolicy = 4;
}
// ExternalAdmissionHookConfiguration describes the configuration of initializers.
message ExternalAdmissionHookConfiguration {
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// ExternalAdmissionHooks is a list of external admission webhooks and the
// affected resources and operations.
// +optional
// +patchMergeKey=name
// +patchStrategy=merge
repeated ExternalAdmissionHook externalAdmissionHooks = 2;
}
// ExternalAdmissionHookConfigurationList is a list of ExternalAdmissionHookConfiguration.
message ExternalAdmissionHookConfigurationList {
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
// List of ExternalAdmissionHookConfiguration.
repeated ExternalAdmissionHookConfiguration items = 2;
}
// Initializer describes the name and the failure policy of an initializer, and
// what resources it applies to.
message Initializer {
// Name is the identifier of the initializer. It will be added to the
// object that needs to be initialized.
// Name should be fully qualified, e.g., alwayspullimages.kubernetes.io, where
// "alwayspullimages" is the name of the webhook, and kubernetes.io is the name
// of the organization.
// Required
optional string name = 1;
// Rules describes what resources/subresources the initializer cares about.
// The initializer cares about an operation if it matches _any_ Rule.
repeated Rule rules = 2;
// FailurePolicy defines what happens if the responsible initializer controller
// fails to takes action. Allowed values are Ignore, or Fail. If "Ignore" is
// set, initializer is removed from the initializers list of an object if
// the timeout is reached; If "Fail" is set, admissionregistration returns timeout error
// if the timeout is reached.
optional string failurePolicy = 3;
}
// InitializerConfiguration describes the configuration of initializers.
message InitializerConfiguration {
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Initializers is a list of resources and their default initializers
// Order-sensitive.
// When merging multiple InitializerConfigurations, we sort the initializers
// from different InitializerConfigurations by the name of the
// InitializerConfigurations; the order of the initializers from the same
// InitializerConfiguration is preserved.
// +patchMergeKey=name
// +patchStrategy=merge
// +optional
repeated Initializer initializers = 2;
}
// InitializerConfigurationList is a list of InitializerConfiguration.
message InitializerConfigurationList {
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
// List of InitializerConfiguration.
repeated InitializerConfiguration items = 2;
}
// Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended
// to make sure that all the tuple expansions are valid.
message Rule {
// APIGroups is the API groups the resources belong to. '*' is all groups.
// If '*' is present, the length of the slice must be one.
// Required.
repeated string apiGroups = 1;
// APIVersions is the API versions the resources belong to. '*' is all versions.
// If '*' is present, the length of the slice must be one.
// Required.
repeated string apiVersions = 2;
// Resources is a list of resources this rule applies to.
//
// For example:
// 'pods' means pods.
// 'pods/log' means the log subresource of pods.
// '*' means all resources, but not subresources.
// 'pods/*' means all subresources of pods.
// '*/scale' means all scale subresources.
// '*/*' means all resources and their subresources.
//
// If '*' or '*/*' is present, the length of the slice must be one.
// Required.
repeated string resources = 3;
}
// RuleWithOperations is a tuple of Operations and Resources. It is recommended to make
// sure that all the tuple expansions are valid.
message RuleWithOperations {
// Operations is the operations the admission hook cares about - CREATE, UPDATE, or *
// for all operations.
// If '*' is present, the length of the slice must be one.
// Required.
repeated string operations = 1;
// Rule is embedded, it describes other criteria of the rule, like
// APIGroups, APIVersions, Resources, etc.
optional Rule rule = 2;
}
// ServiceReference holds a reference to Service.legacy.k8s.io
message ServiceReference {
// Namespace is the namespace of the service
// Required
optional string namespace = 1;
// Name is the name of the service
// Required
optional string name = 2;
}

View File

@ -0,0 +1,60 @@
/*
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"
)
const GroupName = "admissionregistration.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.SchemeBuilder
localSchemeBuilder = &SchemeBuilder
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(addKnownTypes, addDefaultingFuncs)
}
// Adds the list of known types to scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&InitializerConfiguration{},
&InitializerConfigurationList{},
&ExternalAdmissionHookConfiguration{},
&ExternalAdmissionHookConfigurationList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,214 @@
/*
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"
)
// +genclient=true
// InitializerConfiguration describes the configuration of initializers.
type InitializerConfiguration struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Initializers is a list of resources and their default initializers
// Order-sensitive.
// When merging multiple InitializerConfigurations, we sort the initializers
// from different InitializerConfigurations by the name of the
// InitializerConfigurations; the order of the initializers from the same
// InitializerConfiguration is preserved.
// +patchMergeKey=name
// +patchStrategy=merge
// +optional
Initializers []Initializer `json:"initializers,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=initializers"`
}
// InitializerConfigurationList is a list of InitializerConfiguration.
type InitializerConfigurationList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of InitializerConfiguration.
Items []InitializerConfiguration `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// Initializer describes the name and the failure policy of an initializer, and
// what resources it applies to.
type Initializer struct {
// Name is the identifier of the initializer. It will be added to the
// object that needs to be initialized.
// Name should be fully qualified, e.g., alwayspullimages.kubernetes.io, where
// "alwayspullimages" is the name of the webhook, and kubernetes.io is the name
// of the organization.
// Required
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Rules describes what resources/subresources the initializer cares about.
// The initializer cares about an operation if it matches _any_ Rule.
Rules []Rule `json:"rules,omitempty" protobuf:"bytes,2,rep,name=rules"`
// FailurePolicy defines what happens if the responsible initializer controller
// fails to takes action. Allowed values are Ignore, or Fail. If "Ignore" is
// set, initializer is removed from the initializers list of an object if
// the timeout is reached; If "Fail" is set, admissionregistration returns timeout error
// if the timeout is reached.
FailurePolicy *FailurePolicyType `json:"failurePolicy,omitempty" protobuf:"bytes,3,opt,name=failurePolicy,casttype=FailurePolicyType"`
}
// Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended
// to make sure that all the tuple expansions are valid.
type Rule struct {
// APIGroups is the API groups the resources belong to. '*' is all groups.
// If '*' is present, the length of the slice must be one.
// Required.
APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,1,rep,name=apiGroups"`
// APIVersions is the API versions the resources belong to. '*' is all versions.
// If '*' is present, the length of the slice must be one.
// Required.
APIVersions []string `json:"apiVersions,omitempty" protobuf:"bytes,2,rep,name=apiVersions"`
// Resources is a list of resources this rule applies to.
//
// For example:
// 'pods' means pods.
// 'pods/log' means the log subresource of pods.
// '*' means all resources, but not subresources.
// 'pods/*' means all subresources of pods.
// '*/scale' means all scale subresources.
// '*/*' means all resources and their subresources.
//
// If '*' or '*/*' is present, the length of the slice must be one.
// Required.
Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"`
}
type FailurePolicyType string
const (
// Ignore means the initilizer is removed from the initializers list of an
// object if the initializer is timed out.
Ignore FailurePolicyType = "Ignore"
// For 1.7, only "Ignore" is allowed. "Fail" will be allowed when the
// extensible admission feature is beta.
Fail FailurePolicyType = "Fail"
)
// +genclient=true
// ExternalAdmissionHookConfiguration describes the configuration of initializers.
type ExternalAdmissionHookConfiguration struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// ExternalAdmissionHooks is a list of external admission webhooks and the
// affected resources and operations.
// +optional
// +patchMergeKey=name
// +patchStrategy=merge
ExternalAdmissionHooks []ExternalAdmissionHook `json:"externalAdmissionHooks,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=externalAdmissionHooks"`
}
// ExternalAdmissionHookConfigurationList is a list of ExternalAdmissionHookConfiguration.
type ExternalAdmissionHookConfigurationList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of ExternalAdmissionHookConfiguration.
Items []ExternalAdmissionHookConfiguration `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// ExternalAdmissionHook describes an external admission webhook and the
// resources and operations it applies to.
type ExternalAdmissionHook struct {
// The name of the external admission webhook.
// Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where
// "imagepolicy" is the name of the webhook, and kubernetes.io is the name
// of the organization.
// Required.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// ClientConfig defines how to communicate with the hook.
// Required
ClientConfig AdmissionHookClientConfig `json:"clientConfig" protobuf:"bytes,2,opt,name=clientConfig"`
// Rules describes what operations on what resources/subresources the webhook cares about.
// The webhook cares about an operation if it matches _any_ Rule.
Rules []RuleWithOperations `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"`
// FailurePolicy defines how unrecognized errors from the admission endpoint are handled -
// allowed values are Ignore or Fail. Defaults to Ignore.
// +optional
FailurePolicy *FailurePolicyType `json:"failurePolicy,omitempty" protobuf:"bytes,4,opt,name=failurePolicy,casttype=FailurePolicyType"`
}
// RuleWithOperations is a tuple of Operations and Resources. It is recommended to make
// sure that all the tuple expansions are valid.
type RuleWithOperations struct {
// Operations is the operations the admission hook cares about - CREATE, UPDATE, or *
// for all operations.
// If '*' is present, the length of the slice must be one.
// Required.
Operations []OperationType `json:"operations,omitempty" protobuf:"bytes,1,rep,name=operations,casttype=OperationType"`
// Rule is embedded, it describes other criteria of the rule, like
// APIGroups, APIVersions, Resources, etc.
Rule `json:",inline" protobuf:"bytes,2,opt,name=rule"`
}
type OperationType string
// The constants should be kept in sync with those defined in k8s.io/kubernetes/pkg/admission/interface.go.
const (
OperationAll OperationType = "*"
Create OperationType = "CREATE"
Update OperationType = "UPDATE"
Delete OperationType = "DELETE"
Connect OperationType = "CONNECT"
)
// AdmissionHookClientConfig contains the information to make a TLS
// connection with the webhook
type AdmissionHookClientConfig struct {
// Service is a reference to the service for this webhook. If there is only
// one port open for the service, that port will be used. If there are multiple
// ports open, port 443 will be used if it is open, otherwise it is an error.
// Required
Service ServiceReference `json:"service" protobuf:"bytes,1,opt,name=service"`
// CABundle is a PEM encoded CA bundle which will be used to validate webhook's server certificate.
// Required
CABundle []byte `json:"caBundle" protobuf:"bytes,2,opt,name=caBundle"`
}
// ServiceReference holds a reference to Service.legacy.k8s.io
type ServiceReference struct {
// Namespace is the namespace of the service
// Required
Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"`
// Name is the name of the service
// Required
Name string `json:"name" protobuf:"bytes,2,opt,name=name"`
}

View File

@ -0,0 +1,133 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
// 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
var map_AdmissionHookClientConfig = map[string]string{
"": "AdmissionHookClientConfig contains the information to make a TLS connection with the webhook",
"service": "Service is a reference to the service for this webhook. If there is only one port open for the service, that port will be used. If there are multiple ports open, port 443 will be used if it is open, otherwise it is an error. Required",
"caBundle": "CABundle is a PEM encoded CA bundle which will be used to validate webhook's server certificate. Required",
}
func (AdmissionHookClientConfig) SwaggerDoc() map[string]string {
return map_AdmissionHookClientConfig
}
var map_ExternalAdmissionHook = map[string]string{
"": "ExternalAdmissionHook describes an external admission webhook and the resources and operations it applies to.",
"name": "The name of the external admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.",
"clientConfig": "ClientConfig defines how to communicate with the hook. Required",
"rules": "Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule.",
"failurePolicy": "FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Ignore.",
}
func (ExternalAdmissionHook) SwaggerDoc() map[string]string {
return map_ExternalAdmissionHook
}
var map_ExternalAdmissionHookConfiguration = map[string]string{
"": "ExternalAdmissionHookConfiguration describes the configuration of initializers.",
"metadata": "Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.",
"externalAdmissionHooks": "ExternalAdmissionHooks is a list of external admission webhooks and the affected resources and operations.",
}
func (ExternalAdmissionHookConfiguration) SwaggerDoc() map[string]string {
return map_ExternalAdmissionHookConfiguration
}
var map_ExternalAdmissionHookConfigurationList = map[string]string{
"": "ExternalAdmissionHookConfigurationList is a list of ExternalAdmissionHookConfiguration.",
"metadata": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
"items": "List of ExternalAdmissionHookConfiguration.",
}
func (ExternalAdmissionHookConfigurationList) SwaggerDoc() map[string]string {
return map_ExternalAdmissionHookConfigurationList
}
var map_Initializer = map[string]string{
"": "Initializer describes the name and the failure policy of an initializer, and what resources it applies to.",
"name": "Name is the identifier of the initializer. It will be added to the object that needs to be initialized. Name should be fully qualified, e.g., alwayspullimages.kubernetes.io, where \"alwayspullimages\" is the name of the webhook, and kubernetes.io is the name of the organization. Required",
"rules": "Rules describes what resources/subresources the initializer cares about. The initializer cares about an operation if it matches _any_ Rule.",
"failurePolicy": "FailurePolicy defines what happens if the responsible initializer controller fails to takes action. Allowed values are Ignore, or Fail. If \"Ignore\" is set, initializer is removed from the initializers list of an object if the timeout is reached; If \"Fail\" is set, admissionregistration returns timeout error if the timeout is reached.",
}
func (Initializer) SwaggerDoc() map[string]string {
return map_Initializer
}
var map_InitializerConfiguration = map[string]string{
"": "InitializerConfiguration describes the configuration of initializers.",
"metadata": "Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.",
"initializers": "Initializers is a list of resources and their default initializers Order-sensitive. When merging multiple InitializerConfigurations, we sort the initializers from different InitializerConfigurations by the name of the InitializerConfigurations; the order of the initializers from the same InitializerConfiguration is preserved.",
}
func (InitializerConfiguration) SwaggerDoc() map[string]string {
return map_InitializerConfiguration
}
var map_InitializerConfigurationList = map[string]string{
"": "InitializerConfigurationList is a list of InitializerConfiguration.",
"metadata": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
"items": "List of InitializerConfiguration.",
}
func (InitializerConfigurationList) SwaggerDoc() map[string]string {
return map_InitializerConfigurationList
}
var map_Rule = map[string]string{
"": "Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended to make sure that all the tuple expansions are valid.",
"apiGroups": "APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required.",
"apiVersions": "APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required.",
"resources": "Resources is a list of resources this rule applies to.\n\nFor example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources.\n\nIf '*' or '*/*' is present, the length of the slice must be one. Required.",
}
func (Rule) SwaggerDoc() map[string]string {
return map_Rule
}
var map_RuleWithOperations = map[string]string{
"": "RuleWithOperations is a tuple of Operations and Resources. It is recommended to make sure that all the tuple expansions are valid.",
"operations": "Operations is the operations the admission hook cares about - CREATE, UPDATE, or * for all operations. If '*' is present, the length of the slice must be one. Required.",
}
func (RuleWithOperations) SwaggerDoc() map[string]string {
return map_RuleWithOperations
}
var map_ServiceReference = map[string]string{
"": "ServiceReference holds a reference to Service.legacy.k8s.io",
"namespace": "Namespace is the namespace of the service Required",
"name": "Name is the name of the service Required",
}
func (ServiceReference) SwaggerDoc() map[string]string {
return map_ServiceReference
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@ -0,0 +1,311 @@
// +build !ignore_autogenerated
/*
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.
*/
// This file was autogenerated by conversion-gen. Do not edit it manually!
package v1alpha1
import (
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
unsafe "unsafe"
)
func init() {
SchemeBuilder.Register(RegisterConversions)
}
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v1alpha1_AdmissionHookClientConfig_To_admissionregistration_AdmissionHookClientConfig,
Convert_admissionregistration_AdmissionHookClientConfig_To_v1alpha1_AdmissionHookClientConfig,
Convert_v1alpha1_ExternalAdmissionHook_To_admissionregistration_ExternalAdmissionHook,
Convert_admissionregistration_ExternalAdmissionHook_To_v1alpha1_ExternalAdmissionHook,
Convert_v1alpha1_ExternalAdmissionHookConfiguration_To_admissionregistration_ExternalAdmissionHookConfiguration,
Convert_admissionregistration_ExternalAdmissionHookConfiguration_To_v1alpha1_ExternalAdmissionHookConfiguration,
Convert_v1alpha1_ExternalAdmissionHookConfigurationList_To_admissionregistration_ExternalAdmissionHookConfigurationList,
Convert_admissionregistration_ExternalAdmissionHookConfigurationList_To_v1alpha1_ExternalAdmissionHookConfigurationList,
Convert_v1alpha1_Initializer_To_admissionregistration_Initializer,
Convert_admissionregistration_Initializer_To_v1alpha1_Initializer,
Convert_v1alpha1_InitializerConfiguration_To_admissionregistration_InitializerConfiguration,
Convert_admissionregistration_InitializerConfiguration_To_v1alpha1_InitializerConfiguration,
Convert_v1alpha1_InitializerConfigurationList_To_admissionregistration_InitializerConfigurationList,
Convert_admissionregistration_InitializerConfigurationList_To_v1alpha1_InitializerConfigurationList,
Convert_v1alpha1_Rule_To_admissionregistration_Rule,
Convert_admissionregistration_Rule_To_v1alpha1_Rule,
Convert_v1alpha1_RuleWithOperations_To_admissionregistration_RuleWithOperations,
Convert_admissionregistration_RuleWithOperations_To_v1alpha1_RuleWithOperations,
Convert_v1alpha1_ServiceReference_To_admissionregistration_ServiceReference,
Convert_admissionregistration_ServiceReference_To_v1alpha1_ServiceReference,
)
}
func autoConvert_v1alpha1_AdmissionHookClientConfig_To_admissionregistration_AdmissionHookClientConfig(in *AdmissionHookClientConfig, out *admissionregistration.AdmissionHookClientConfig, s conversion.Scope) error {
if err := Convert_v1alpha1_ServiceReference_To_admissionregistration_ServiceReference(&in.Service, &out.Service, s); err != nil {
return err
}
out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle))
return nil
}
// Convert_v1alpha1_AdmissionHookClientConfig_To_admissionregistration_AdmissionHookClientConfig is an autogenerated conversion function.
func Convert_v1alpha1_AdmissionHookClientConfig_To_admissionregistration_AdmissionHookClientConfig(in *AdmissionHookClientConfig, out *admissionregistration.AdmissionHookClientConfig, s conversion.Scope) error {
return autoConvert_v1alpha1_AdmissionHookClientConfig_To_admissionregistration_AdmissionHookClientConfig(in, out, s)
}
func autoConvert_admissionregistration_AdmissionHookClientConfig_To_v1alpha1_AdmissionHookClientConfig(in *admissionregistration.AdmissionHookClientConfig, out *AdmissionHookClientConfig, s conversion.Scope) error {
if err := Convert_admissionregistration_ServiceReference_To_v1alpha1_ServiceReference(&in.Service, &out.Service, s); err != nil {
return err
}
if in.CABundle == nil {
out.CABundle = make([]byte, 0)
} else {
out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle))
}
return nil
}
// Convert_admissionregistration_AdmissionHookClientConfig_To_v1alpha1_AdmissionHookClientConfig is an autogenerated conversion function.
func Convert_admissionregistration_AdmissionHookClientConfig_To_v1alpha1_AdmissionHookClientConfig(in *admissionregistration.AdmissionHookClientConfig, out *AdmissionHookClientConfig, s conversion.Scope) error {
return autoConvert_admissionregistration_AdmissionHookClientConfig_To_v1alpha1_AdmissionHookClientConfig(in, out, s)
}
func autoConvert_v1alpha1_ExternalAdmissionHook_To_admissionregistration_ExternalAdmissionHook(in *ExternalAdmissionHook, out *admissionregistration.ExternalAdmissionHook, s conversion.Scope) error {
out.Name = in.Name
if err := Convert_v1alpha1_AdmissionHookClientConfig_To_admissionregistration_AdmissionHookClientConfig(&in.ClientConfig, &out.ClientConfig, s); err != nil {
return err
}
out.Rules = *(*[]admissionregistration.RuleWithOperations)(unsafe.Pointer(&in.Rules))
out.FailurePolicy = (*admissionregistration.FailurePolicyType)(unsafe.Pointer(in.FailurePolicy))
return nil
}
// Convert_v1alpha1_ExternalAdmissionHook_To_admissionregistration_ExternalAdmissionHook is an autogenerated conversion function.
func Convert_v1alpha1_ExternalAdmissionHook_To_admissionregistration_ExternalAdmissionHook(in *ExternalAdmissionHook, out *admissionregistration.ExternalAdmissionHook, s conversion.Scope) error {
return autoConvert_v1alpha1_ExternalAdmissionHook_To_admissionregistration_ExternalAdmissionHook(in, out, s)
}
func autoConvert_admissionregistration_ExternalAdmissionHook_To_v1alpha1_ExternalAdmissionHook(in *admissionregistration.ExternalAdmissionHook, out *ExternalAdmissionHook, s conversion.Scope) error {
out.Name = in.Name
if err := Convert_admissionregistration_AdmissionHookClientConfig_To_v1alpha1_AdmissionHookClientConfig(&in.ClientConfig, &out.ClientConfig, s); err != nil {
return err
}
out.Rules = *(*[]RuleWithOperations)(unsafe.Pointer(&in.Rules))
out.FailurePolicy = (*FailurePolicyType)(unsafe.Pointer(in.FailurePolicy))
return nil
}
// Convert_admissionregistration_ExternalAdmissionHook_To_v1alpha1_ExternalAdmissionHook is an autogenerated conversion function.
func Convert_admissionregistration_ExternalAdmissionHook_To_v1alpha1_ExternalAdmissionHook(in *admissionregistration.ExternalAdmissionHook, out *ExternalAdmissionHook, s conversion.Scope) error {
return autoConvert_admissionregistration_ExternalAdmissionHook_To_v1alpha1_ExternalAdmissionHook(in, out, s)
}
func autoConvert_v1alpha1_ExternalAdmissionHookConfiguration_To_admissionregistration_ExternalAdmissionHookConfiguration(in *ExternalAdmissionHookConfiguration, out *admissionregistration.ExternalAdmissionHookConfiguration, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.ExternalAdmissionHooks = *(*[]admissionregistration.ExternalAdmissionHook)(unsafe.Pointer(&in.ExternalAdmissionHooks))
return nil
}
// Convert_v1alpha1_ExternalAdmissionHookConfiguration_To_admissionregistration_ExternalAdmissionHookConfiguration is an autogenerated conversion function.
func Convert_v1alpha1_ExternalAdmissionHookConfiguration_To_admissionregistration_ExternalAdmissionHookConfiguration(in *ExternalAdmissionHookConfiguration, out *admissionregistration.ExternalAdmissionHookConfiguration, s conversion.Scope) error {
return autoConvert_v1alpha1_ExternalAdmissionHookConfiguration_To_admissionregistration_ExternalAdmissionHookConfiguration(in, out, s)
}
func autoConvert_admissionregistration_ExternalAdmissionHookConfiguration_To_v1alpha1_ExternalAdmissionHookConfiguration(in *admissionregistration.ExternalAdmissionHookConfiguration, out *ExternalAdmissionHookConfiguration, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.ExternalAdmissionHooks = *(*[]ExternalAdmissionHook)(unsafe.Pointer(&in.ExternalAdmissionHooks))
return nil
}
// Convert_admissionregistration_ExternalAdmissionHookConfiguration_To_v1alpha1_ExternalAdmissionHookConfiguration is an autogenerated conversion function.
func Convert_admissionregistration_ExternalAdmissionHookConfiguration_To_v1alpha1_ExternalAdmissionHookConfiguration(in *admissionregistration.ExternalAdmissionHookConfiguration, out *ExternalAdmissionHookConfiguration, s conversion.Scope) error {
return autoConvert_admissionregistration_ExternalAdmissionHookConfiguration_To_v1alpha1_ExternalAdmissionHookConfiguration(in, out, s)
}
func autoConvert_v1alpha1_ExternalAdmissionHookConfigurationList_To_admissionregistration_ExternalAdmissionHookConfigurationList(in *ExternalAdmissionHookConfigurationList, out *admissionregistration.ExternalAdmissionHookConfigurationList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]admissionregistration.ExternalAdmissionHookConfiguration)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1alpha1_ExternalAdmissionHookConfigurationList_To_admissionregistration_ExternalAdmissionHookConfigurationList is an autogenerated conversion function.
func Convert_v1alpha1_ExternalAdmissionHookConfigurationList_To_admissionregistration_ExternalAdmissionHookConfigurationList(in *ExternalAdmissionHookConfigurationList, out *admissionregistration.ExternalAdmissionHookConfigurationList, s conversion.Scope) error {
return autoConvert_v1alpha1_ExternalAdmissionHookConfigurationList_To_admissionregistration_ExternalAdmissionHookConfigurationList(in, out, s)
}
func autoConvert_admissionregistration_ExternalAdmissionHookConfigurationList_To_v1alpha1_ExternalAdmissionHookConfigurationList(in *admissionregistration.ExternalAdmissionHookConfigurationList, out *ExternalAdmissionHookConfigurationList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
if in.Items == nil {
out.Items = make([]ExternalAdmissionHookConfiguration, 0)
} else {
out.Items = *(*[]ExternalAdmissionHookConfiguration)(unsafe.Pointer(&in.Items))
}
return nil
}
// Convert_admissionregistration_ExternalAdmissionHookConfigurationList_To_v1alpha1_ExternalAdmissionHookConfigurationList is an autogenerated conversion function.
func Convert_admissionregistration_ExternalAdmissionHookConfigurationList_To_v1alpha1_ExternalAdmissionHookConfigurationList(in *admissionregistration.ExternalAdmissionHookConfigurationList, out *ExternalAdmissionHookConfigurationList, s conversion.Scope) error {
return autoConvert_admissionregistration_ExternalAdmissionHookConfigurationList_To_v1alpha1_ExternalAdmissionHookConfigurationList(in, out, s)
}
func autoConvert_v1alpha1_Initializer_To_admissionregistration_Initializer(in *Initializer, out *admissionregistration.Initializer, s conversion.Scope) error {
out.Name = in.Name
out.Rules = *(*[]admissionregistration.Rule)(unsafe.Pointer(&in.Rules))
out.FailurePolicy = (*admissionregistration.FailurePolicyType)(unsafe.Pointer(in.FailurePolicy))
return nil
}
// Convert_v1alpha1_Initializer_To_admissionregistration_Initializer is an autogenerated conversion function.
func Convert_v1alpha1_Initializer_To_admissionregistration_Initializer(in *Initializer, out *admissionregistration.Initializer, s conversion.Scope) error {
return autoConvert_v1alpha1_Initializer_To_admissionregistration_Initializer(in, out, s)
}
func autoConvert_admissionregistration_Initializer_To_v1alpha1_Initializer(in *admissionregistration.Initializer, out *Initializer, s conversion.Scope) error {
out.Name = in.Name
out.Rules = *(*[]Rule)(unsafe.Pointer(&in.Rules))
out.FailurePolicy = (*FailurePolicyType)(unsafe.Pointer(in.FailurePolicy))
return nil
}
// Convert_admissionregistration_Initializer_To_v1alpha1_Initializer is an autogenerated conversion function.
func Convert_admissionregistration_Initializer_To_v1alpha1_Initializer(in *admissionregistration.Initializer, out *Initializer, s conversion.Scope) error {
return autoConvert_admissionregistration_Initializer_To_v1alpha1_Initializer(in, out, s)
}
func autoConvert_v1alpha1_InitializerConfiguration_To_admissionregistration_InitializerConfiguration(in *InitializerConfiguration, out *admissionregistration.InitializerConfiguration, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Initializers = *(*[]admissionregistration.Initializer)(unsafe.Pointer(&in.Initializers))
return nil
}
// Convert_v1alpha1_InitializerConfiguration_To_admissionregistration_InitializerConfiguration is an autogenerated conversion function.
func Convert_v1alpha1_InitializerConfiguration_To_admissionregistration_InitializerConfiguration(in *InitializerConfiguration, out *admissionregistration.InitializerConfiguration, s conversion.Scope) error {
return autoConvert_v1alpha1_InitializerConfiguration_To_admissionregistration_InitializerConfiguration(in, out, s)
}
func autoConvert_admissionregistration_InitializerConfiguration_To_v1alpha1_InitializerConfiguration(in *admissionregistration.InitializerConfiguration, out *InitializerConfiguration, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Initializers = *(*[]Initializer)(unsafe.Pointer(&in.Initializers))
return nil
}
// Convert_admissionregistration_InitializerConfiguration_To_v1alpha1_InitializerConfiguration is an autogenerated conversion function.
func Convert_admissionregistration_InitializerConfiguration_To_v1alpha1_InitializerConfiguration(in *admissionregistration.InitializerConfiguration, out *InitializerConfiguration, s conversion.Scope) error {
return autoConvert_admissionregistration_InitializerConfiguration_To_v1alpha1_InitializerConfiguration(in, out, s)
}
func autoConvert_v1alpha1_InitializerConfigurationList_To_admissionregistration_InitializerConfigurationList(in *InitializerConfigurationList, out *admissionregistration.InitializerConfigurationList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]admissionregistration.InitializerConfiguration)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1alpha1_InitializerConfigurationList_To_admissionregistration_InitializerConfigurationList is an autogenerated conversion function.
func Convert_v1alpha1_InitializerConfigurationList_To_admissionregistration_InitializerConfigurationList(in *InitializerConfigurationList, out *admissionregistration.InitializerConfigurationList, s conversion.Scope) error {
return autoConvert_v1alpha1_InitializerConfigurationList_To_admissionregistration_InitializerConfigurationList(in, out, s)
}
func autoConvert_admissionregistration_InitializerConfigurationList_To_v1alpha1_InitializerConfigurationList(in *admissionregistration.InitializerConfigurationList, out *InitializerConfigurationList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
if in.Items == nil {
out.Items = make([]InitializerConfiguration, 0)
} else {
out.Items = *(*[]InitializerConfiguration)(unsafe.Pointer(&in.Items))
}
return nil
}
// Convert_admissionregistration_InitializerConfigurationList_To_v1alpha1_InitializerConfigurationList is an autogenerated conversion function.
func Convert_admissionregistration_InitializerConfigurationList_To_v1alpha1_InitializerConfigurationList(in *admissionregistration.InitializerConfigurationList, out *InitializerConfigurationList, s conversion.Scope) error {
return autoConvert_admissionregistration_InitializerConfigurationList_To_v1alpha1_InitializerConfigurationList(in, out, s)
}
func autoConvert_v1alpha1_Rule_To_admissionregistration_Rule(in *Rule, out *admissionregistration.Rule, s conversion.Scope) error {
out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
out.APIVersions = *(*[]string)(unsafe.Pointer(&in.APIVersions))
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
return nil
}
// Convert_v1alpha1_Rule_To_admissionregistration_Rule is an autogenerated conversion function.
func Convert_v1alpha1_Rule_To_admissionregistration_Rule(in *Rule, out *admissionregistration.Rule, s conversion.Scope) error {
return autoConvert_v1alpha1_Rule_To_admissionregistration_Rule(in, out, s)
}
func autoConvert_admissionregistration_Rule_To_v1alpha1_Rule(in *admissionregistration.Rule, out *Rule, s conversion.Scope) error {
out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
out.APIVersions = *(*[]string)(unsafe.Pointer(&in.APIVersions))
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
return nil
}
// Convert_admissionregistration_Rule_To_v1alpha1_Rule is an autogenerated conversion function.
func Convert_admissionregistration_Rule_To_v1alpha1_Rule(in *admissionregistration.Rule, out *Rule, s conversion.Scope) error {
return autoConvert_admissionregistration_Rule_To_v1alpha1_Rule(in, out, s)
}
func autoConvert_v1alpha1_RuleWithOperations_To_admissionregistration_RuleWithOperations(in *RuleWithOperations, out *admissionregistration.RuleWithOperations, s conversion.Scope) error {
out.Operations = *(*[]admissionregistration.OperationType)(unsafe.Pointer(&in.Operations))
if err := Convert_v1alpha1_Rule_To_admissionregistration_Rule(&in.Rule, &out.Rule, s); err != nil {
return err
}
return nil
}
// Convert_v1alpha1_RuleWithOperations_To_admissionregistration_RuleWithOperations is an autogenerated conversion function.
func Convert_v1alpha1_RuleWithOperations_To_admissionregistration_RuleWithOperations(in *RuleWithOperations, out *admissionregistration.RuleWithOperations, s conversion.Scope) error {
return autoConvert_v1alpha1_RuleWithOperations_To_admissionregistration_RuleWithOperations(in, out, s)
}
func autoConvert_admissionregistration_RuleWithOperations_To_v1alpha1_RuleWithOperations(in *admissionregistration.RuleWithOperations, out *RuleWithOperations, s conversion.Scope) error {
out.Operations = *(*[]OperationType)(unsafe.Pointer(&in.Operations))
if err := Convert_admissionregistration_Rule_To_v1alpha1_Rule(&in.Rule, &out.Rule, s); err != nil {
return err
}
return nil
}
// Convert_admissionregistration_RuleWithOperations_To_v1alpha1_RuleWithOperations is an autogenerated conversion function.
func Convert_admissionregistration_RuleWithOperations_To_v1alpha1_RuleWithOperations(in *admissionregistration.RuleWithOperations, out *RuleWithOperations, s conversion.Scope) error {
return autoConvert_admissionregistration_RuleWithOperations_To_v1alpha1_RuleWithOperations(in, out, s)
}
func autoConvert_v1alpha1_ServiceReference_To_admissionregistration_ServiceReference(in *ServiceReference, out *admissionregistration.ServiceReference, s conversion.Scope) error {
out.Namespace = in.Namespace
out.Name = in.Name
return nil
}
// Convert_v1alpha1_ServiceReference_To_admissionregistration_ServiceReference is an autogenerated conversion function.
func Convert_v1alpha1_ServiceReference_To_admissionregistration_ServiceReference(in *ServiceReference, out *admissionregistration.ServiceReference, s conversion.Scope) error {
return autoConvert_v1alpha1_ServiceReference_To_admissionregistration_ServiceReference(in, out, s)
}
func autoConvert_admissionregistration_ServiceReference_To_v1alpha1_ServiceReference(in *admissionregistration.ServiceReference, out *ServiceReference, s conversion.Scope) error {
out.Namespace = in.Namespace
out.Name = in.Name
return nil
}
// Convert_admissionregistration_ServiceReference_To_v1alpha1_ServiceReference is an autogenerated conversion function.
func Convert_admissionregistration_ServiceReference_To_v1alpha1_ServiceReference(in *admissionregistration.ServiceReference, out *ServiceReference, s conversion.Scope) error {
return autoConvert_admissionregistration_ServiceReference_To_v1alpha1_ServiceReference(in, out, s)
}

View File

@ -0,0 +1,254 @@
// +build !ignore_autogenerated
/*
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.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
reflect "reflect"
)
func init() {
SchemeBuilder.Register(RegisterDeepCopies)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_AdmissionHookClientConfig, InType: reflect.TypeOf(&AdmissionHookClientConfig{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ExternalAdmissionHook, InType: reflect.TypeOf(&ExternalAdmissionHook{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ExternalAdmissionHookConfiguration, InType: reflect.TypeOf(&ExternalAdmissionHookConfiguration{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ExternalAdmissionHookConfigurationList, InType: reflect.TypeOf(&ExternalAdmissionHookConfigurationList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_Initializer, InType: reflect.TypeOf(&Initializer{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_InitializerConfiguration, InType: reflect.TypeOf(&InitializerConfiguration{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_InitializerConfigurationList, InType: reflect.TypeOf(&InitializerConfigurationList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_Rule, InType: reflect.TypeOf(&Rule{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_RuleWithOperations, InType: reflect.TypeOf(&RuleWithOperations{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ServiceReference, InType: reflect.TypeOf(&ServiceReference{})},
)
}
// DeepCopy_v1alpha1_AdmissionHookClientConfig is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_AdmissionHookClientConfig(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*AdmissionHookClientConfig)
out := out.(*AdmissionHookClientConfig)
*out = *in
if in.CABundle != nil {
in, out := &in.CABundle, &out.CABundle
*out = make([]byte, len(*in))
copy(*out, *in)
}
return nil
}
}
// DeepCopy_v1alpha1_ExternalAdmissionHook is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_ExternalAdmissionHook(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ExternalAdmissionHook)
out := out.(*ExternalAdmissionHook)
*out = *in
if err := DeepCopy_v1alpha1_AdmissionHookClientConfig(&in.ClientConfig, &out.ClientConfig, c); err != nil {
return err
}
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]RuleWithOperations, len(*in))
for i := range *in {
if err := DeepCopy_v1alpha1_RuleWithOperations(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
if in.FailurePolicy != nil {
in, out := &in.FailurePolicy, &out.FailurePolicy
*out = new(FailurePolicyType)
**out = **in
}
return nil
}
}
// DeepCopy_v1alpha1_ExternalAdmissionHookConfiguration is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_ExternalAdmissionHookConfiguration(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ExternalAdmissionHookConfiguration)
out := out.(*ExternalAdmissionHookConfiguration)
*out = *in
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
}
if in.ExternalAdmissionHooks != nil {
in, out := &in.ExternalAdmissionHooks, &out.ExternalAdmissionHooks
*out = make([]ExternalAdmissionHook, len(*in))
for i := range *in {
if err := DeepCopy_v1alpha1_ExternalAdmissionHook(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
return nil
}
}
// DeepCopy_v1alpha1_ExternalAdmissionHookConfigurationList is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_ExternalAdmissionHookConfigurationList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ExternalAdmissionHookConfigurationList)
out := out.(*ExternalAdmissionHookConfigurationList)
*out = *in
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ExternalAdmissionHookConfiguration, len(*in))
for i := range *in {
if err := DeepCopy_v1alpha1_ExternalAdmissionHookConfiguration(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
return nil
}
}
// DeepCopy_v1alpha1_Initializer is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_Initializer(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Initializer)
out := out.(*Initializer)
*out = *in
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]Rule, len(*in))
for i := range *in {
if err := DeepCopy_v1alpha1_Rule(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
if in.FailurePolicy != nil {
in, out := &in.FailurePolicy, &out.FailurePolicy
*out = new(FailurePolicyType)
**out = **in
}
return nil
}
}
// DeepCopy_v1alpha1_InitializerConfiguration is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_InitializerConfiguration(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*InitializerConfiguration)
out := out.(*InitializerConfiguration)
*out = *in
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
}
if in.Initializers != nil {
in, out := &in.Initializers, &out.Initializers
*out = make([]Initializer, len(*in))
for i := range *in {
if err := DeepCopy_v1alpha1_Initializer(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
return nil
}
}
// DeepCopy_v1alpha1_InitializerConfigurationList is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_InitializerConfigurationList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*InitializerConfigurationList)
out := out.(*InitializerConfigurationList)
*out = *in
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]InitializerConfiguration, len(*in))
for i := range *in {
if err := DeepCopy_v1alpha1_InitializerConfiguration(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
return nil
}
}
// DeepCopy_v1alpha1_Rule is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_Rule(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Rule)
out := out.(*Rule)
*out = *in
if in.APIGroups != nil {
in, out := &in.APIGroups, &out.APIGroups
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.APIVersions != nil {
in, out := &in.APIVersions, &out.APIVersions
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = make([]string, len(*in))
copy(*out, *in)
}
return nil
}
}
// DeepCopy_v1alpha1_RuleWithOperations is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_RuleWithOperations(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*RuleWithOperations)
out := out.(*RuleWithOperations)
*out = *in
if in.Operations != nil {
in, out := &in.Operations, &out.Operations
*out = make([]OperationType, len(*in))
copy(*out, *in)
}
if err := DeepCopy_v1alpha1_Rule(&in.Rule, &out.Rule, c); err != nil {
return err
}
return nil
}
}
// DeepCopy_v1alpha1_ServiceReference is an autogenerated deepcopy function.
func DeepCopy_v1alpha1_ServiceReference(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ServiceReference)
out := out.(*ServiceReference)
*out = *in
return nil
}
}

View File

@ -0,0 +1,70 @@
// +build !ignore_autogenerated
/*
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.
*/
// This file was autogenerated by defaulter-gen. Do not edit it manually!
package v1alpha1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// 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(&ExternalAdmissionHookConfiguration{}, func(obj interface{}) {
SetObjectDefaults_ExternalAdmissionHookConfiguration(obj.(*ExternalAdmissionHookConfiguration))
})
scheme.AddTypeDefaultingFunc(&ExternalAdmissionHookConfigurationList{}, func(obj interface{}) {
SetObjectDefaults_ExternalAdmissionHookConfigurationList(obj.(*ExternalAdmissionHookConfigurationList))
})
scheme.AddTypeDefaultingFunc(&InitializerConfiguration{}, func(obj interface{}) { SetObjectDefaults_InitializerConfiguration(obj.(*InitializerConfiguration)) })
scheme.AddTypeDefaultingFunc(&InitializerConfigurationList{}, func(obj interface{}) {
SetObjectDefaults_InitializerConfigurationList(obj.(*InitializerConfigurationList))
})
return nil
}
func SetObjectDefaults_ExternalAdmissionHookConfiguration(in *ExternalAdmissionHookConfiguration) {
for i := range in.ExternalAdmissionHooks {
a := &in.ExternalAdmissionHooks[i]
SetDefaults_ExternalAdmissionHook(a)
}
}
func SetObjectDefaults_ExternalAdmissionHookConfigurationList(in *ExternalAdmissionHookConfigurationList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_ExternalAdmissionHookConfiguration(a)
}
}
func SetObjectDefaults_InitializerConfiguration(in *InitializerConfiguration) {
for i := range in.Initializers {
a := &in.Initializers[i]
SetDefaults_Initializer(a)
}
}
func SetObjectDefaults_InitializerConfigurationList(in *InitializerConfigurationList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_InitializerConfiguration(a)
}
}

View File

@ -0,0 +1,46 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_test(
name = "go_default_test",
srcs = ["validation_test.go"],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
],
)
go_library(
name = "go_default_library",
srcs = ["validation.go"],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/validation:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation:go_default_library",
"//vendor/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"],
)

View File

@ -0,0 +1,174 @@
/*
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 validation
import (
"strings"
genericvalidation "k8s.io/apimachinery/pkg/api/validation"
"k8s.io/apimachinery/pkg/util/sets"
validationutil "k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/apis/admissionregistration"
)
func ValidateInitializerConfiguration(ic *admissionregistration.InitializerConfiguration) field.ErrorList {
allErrors := genericvalidation.ValidateObjectMeta(&ic.ObjectMeta, false, genericvalidation.NameIsDNSSubdomain, field.NewPath("metadata"))
for i, initializer := range ic.Initializers {
allErrors = append(allErrors, validateInitializer(&initializer, field.NewPath("initializers").Index(i))...)
}
return allErrors
}
func validateInitializer(initializer *admissionregistration.Initializer, fldPath *field.Path) field.ErrorList {
var allErrors field.ErrorList
// initlializer.Name must be fully qualified
if len(initializer.Name) == 0 {
allErrors = append(allErrors, field.Required(fldPath.Child("name"), ""))
}
if errs := validationutil.IsDNS1123Subdomain(initializer.Name); len(errs) > 0 {
allErrors = append(allErrors, field.Invalid(fldPath.Child("name"), initializer.Name, strings.Join(errs, ",")))
}
if len(strings.Split(initializer.Name, ".")) < 3 {
allErrors = append(allErrors, field.Invalid(fldPath.Child("name"), initializer.Name, "should be a domain with at least two dots"))
}
for i, rule := range initializer.Rules {
allErrors = append(allErrors, validateRule(&rule, fldPath.Child("rules").Index(i))...)
}
// TODO: relax the validation rule when admissionregistration is beta.
if initializer.FailurePolicy != nil && *initializer.FailurePolicy != admissionregistration.Ignore {
allErrors = append(allErrors, field.NotSupported(fldPath.Child("failurePolicy"), *initializer.FailurePolicy, []string{string(admissionregistration.Ignore)}))
}
return allErrors
}
func hasWildcard(slice []string) bool {
for _, s := range slice {
if s == "*" {
return true
}
}
return false
}
func validateRule(rule *admissionregistration.Rule, fldPath *field.Path) field.ErrorList {
var allErrors field.ErrorList
if len(rule.APIGroups) == 0 {
allErrors = append(allErrors, field.Required(fldPath.Child("apiGroups"), ""))
}
if len(rule.APIGroups) > 1 && hasWildcard(rule.APIGroups) {
allErrors = append(allErrors, field.Invalid(fldPath.Child("apiGroups"), rule.APIGroups, "if '*' is present, must not specify other API groups"))
}
// Note: group could be empty, e.g., the legacy "v1" API
if len(rule.APIVersions) == 0 {
allErrors = append(allErrors, field.Required(fldPath.Child("apiVersions"), ""))
}
if len(rule.APIVersions) > 1 && hasWildcard(rule.APIVersions) {
allErrors = append(allErrors, field.Invalid(fldPath.Child("apiVersions"), rule.APIVersions, "if '*' is present, must not specify other API versions"))
}
for i, version := range rule.APIVersions {
if version == "" {
allErrors = append(allErrors, field.Required(fldPath.Child("apiVersions").Index(i), ""))
}
}
if len(rule.Resources) == 0 {
allErrors = append(allErrors, field.Required(fldPath.Child("resources"), ""))
}
if len(rule.Resources) > 1 && hasWildcard(rule.Resources) {
allErrors = append(allErrors, field.Invalid(fldPath.Child("Resources"), rule.Resources, "if '*' is present, must not specify other resources"))
}
for i, resource := range rule.Resources {
if resource == "" {
allErrors = append(allErrors, field.Required(fldPath.Child("resources").Index(i), ""))
}
}
return allErrors
}
func ValidateInitializerConfigurationUpdate(newIC, oldIC *admissionregistration.InitializerConfiguration) field.ErrorList {
return ValidateInitializerConfiguration(newIC)
}
func ValidateExternalAdmissionHookConfiguration(e *admissionregistration.ExternalAdmissionHookConfiguration) field.ErrorList {
allErrors := genericvalidation.ValidateObjectMeta(&e.ObjectMeta, false, genericvalidation.NameIsDNSSubdomain, field.NewPath("metadata"))
for i, hook := range e.ExternalAdmissionHooks {
allErrors = append(allErrors, validateExternalAdmissionHook(&hook, field.NewPath("externalAdmissionHook").Index(i))...)
}
return allErrors
}
func validateExternalAdmissionHook(hook *admissionregistration.ExternalAdmissionHook, fldPath *field.Path) field.ErrorList {
var allErrors field.ErrorList
// hook.Name must be fully qualified
if len(hook.Name) == 0 {
allErrors = append(allErrors, field.Required(fldPath.Child("name"), ""))
}
if errs := validationutil.IsDNS1123Subdomain(hook.Name); len(errs) > 0 {
allErrors = append(allErrors, field.Invalid(fldPath.Child("name"), hook.Name, strings.Join(errs, ",")))
}
if len(strings.Split(hook.Name, ".")) < 3 {
allErrors = append(allErrors, field.Invalid(fldPath.Child("name"), hook.Name, "should be a domain with at least two dots"))
}
for i, rule := range hook.Rules {
allErrors = append(allErrors, validateRuleWithOperations(&rule, fldPath.Child("rules").Index(i))...)
}
// TODO: relax the validation rule when admissionregistration is beta.
if hook.FailurePolicy != nil && *hook.FailurePolicy != admissionregistration.Ignore {
allErrors = append(allErrors, field.NotSupported(fldPath.Child("failurePolicy"), *hook.FailurePolicy, []string{string(admissionregistration.Ignore)}))
}
return allErrors
}
var supportedOperations = sets.NewString(
string(admissionregistration.OperationAll),
string(admissionregistration.Create),
string(admissionregistration.Update),
string(admissionregistration.Delete),
string(admissionregistration.Connect),
)
func hasWildcardOperation(operations []admissionregistration.OperationType) bool {
for _, o := range operations {
if o == admissionregistration.OperationAll {
return true
}
}
return false
}
func validateRuleWithOperations(ruleWithOperations *admissionregistration.RuleWithOperations, fldPath *field.Path) field.ErrorList {
var allErrors field.ErrorList
if len(ruleWithOperations.Operations) == 0 {
allErrors = append(allErrors, field.Required(fldPath.Child("operations"), ""))
}
if len(ruleWithOperations.Operations) > 1 && hasWildcardOperation(ruleWithOperations.Operations) {
allErrors = append(allErrors, field.Invalid(fldPath.Child("operations"), ruleWithOperations.Operations, "if '*' is present, must not specify other operations"))
}
for i, operation := range ruleWithOperations.Operations {
if !supportedOperations.Has(string(operation)) {
allErrors = append(allErrors, field.NotSupported(fldPath.Child("operations").Index(i), operation, supportedOperations.List()))
}
}
allErrors = append(allErrors, validateRule(&ruleWithOperations.Rule, fldPath)...)
return allErrors
}
func ValidateExternalAdmissionHookConfigurationUpdate(newC, oldC *admissionregistration.ExternalAdmissionHookConfiguration) field.ErrorList {
return ValidateExternalAdmissionHookConfiguration(newC)
}

View File

@ -0,0 +1,378 @@
/*
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 validation
import (
"strings"
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/apis/admissionregistration"
)
func getInitializerConfiguration(initializers []admissionregistration.Initializer) *admissionregistration.InitializerConfiguration {
return &admissionregistration.InitializerConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: "config",
},
Initializers: initializers,
}
}
func TestValidateInitializerConfiguration(t *testing.T) {
tests := []struct {
name string
config *admissionregistration.InitializerConfiguration
expectedError string
}{
{
name: "0 rule is valid",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
},
}),
},
{
name: "all initializers must have a fully qualified name",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
},
{
Name: "k8s.io",
},
{
Name: "",
},
}),
expectedError: `initializers[1].name: Invalid value: "k8s.io": should be a domain with at least two dots, initializers[2].name: Required value`,
},
{
name: "APIGroups must not be empty or nil",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
Rules: []admissionregistration.Rule{
{
APIGroups: []string{},
APIVersions: []string{"a"},
Resources: []string{"a"},
},
{
APIGroups: nil,
APIVersions: []string{"a"},
Resources: []string{"a"},
},
},
},
}),
expectedError: `initializers[0].rules[0].apiGroups: Required value, initializers[0].rules[1].apiGroups: Required value`,
},
{
name: "APIVersions must not be empty or nil",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
Rules: []admissionregistration.Rule{
{
APIGroups: []string{"a"},
APIVersions: []string{},
Resources: []string{"a"},
},
{
APIGroups: []string{"a"},
APIVersions: nil,
Resources: []string{"a"},
},
},
},
}),
expectedError: `initializers[0].rules[0].apiVersions: Required value, initializers[0].rules[1].apiVersions: Required value`,
},
{
name: "Resources must not be empty or nil",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
Rules: []admissionregistration.Rule{
{
APIGroups: []string{"a"},
APIVersions: []string{"a"},
Resources: []string{},
},
{
APIGroups: []string{"a"},
APIVersions: []string{"a"},
Resources: nil,
},
},
},
}),
expectedError: `initializers[0].rules[0].resources: Required value, initializers[0].rules[1].resources: Required value`,
},
{
name: "\"\" is a valid APIGroup",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
Rules: []admissionregistration.Rule{
{
APIGroups: []string{"a", ""},
APIVersions: []string{"a"},
Resources: []string{"a"},
},
},
},
}),
},
{
name: "\"\" is NOT a valid APIVersion",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
Rules: []admissionregistration.Rule{
{
APIGroups: []string{"a"},
APIVersions: []string{"a", ""},
Resources: []string{"a"},
},
},
},
}),
expectedError: "apiVersions[1]: Required value",
},
{
name: "\"\" is NOT a valid Resource",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
Rules: []admissionregistration.Rule{
{
APIGroups: []string{"a"},
APIVersions: []string{"a"},
Resources: []string{"a", ""},
},
},
},
}),
expectedError: "resources[1]: Required value",
},
{
name: "wildcard cannot be mixed with other strings",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
Rules: []admissionregistration.Rule{
{
APIGroups: []string{"a", "*"},
APIVersions: []string{"a", "*"},
Resources: []string{"a", "*"},
},
},
},
}),
expectedError: `initializers[0].rules[0].apiGroups: Invalid value: []string{"a", "*"}: if '*' is present, must not specify other API groups, initializers[0].rules[0].apiVersions: Invalid value: []string{"a", "*"}: if '*' is present, must not specify other API versions, initializers[0].rules[0].Resources: Invalid value: []string{"a", "*"}: if '*' is present, must not specify other resources`,
},
{
name: "FailurePolicy can only be \"Ignore\"",
config: getInitializerConfiguration(
[]admissionregistration.Initializer{
{
Name: "initializer.k8s.io",
FailurePolicy: func() *admissionregistration.FailurePolicyType {
r := admissionregistration.Fail
return &r
}(),
},
}),
expectedError: `failurePolicy: Unsupported value: "Fail": supported values: Ignore`,
},
}
for _, test := range tests {
errs := ValidateInitializerConfiguration(test.config)
err := errs.ToAggregate()
if err != nil {
if e, a := test.expectedError, err.Error(); !strings.Contains(a, e) || e == "" {
t.Errorf("test case %s, expected to contain %s, got %s", test.name, e, a)
}
} else {
if test.expectedError != "" {
t.Errorf("test case %s, unexpected no error, expected to contain %s", test.name, test.expectedError)
}
}
}
}
func getExternalAdmissionHookConfiguration(hooks []admissionregistration.ExternalAdmissionHook) *admissionregistration.ExternalAdmissionHookConfiguration {
return &admissionregistration.ExternalAdmissionHookConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: "config",
},
ExternalAdmissionHooks: hooks,
}
}
func TestValidateExternalAdmissionHookConfiguration(t *testing.T) {
tests := []struct {
name string
config *admissionregistration.ExternalAdmissionHookConfiguration
expectedError string
}{
{
name: "all ExternalAdmissionHook must have a fully qualified name",
config: getExternalAdmissionHookConfiguration(
[]admissionregistration.ExternalAdmissionHook{
{
Name: "webhook.k8s.io",
},
{
Name: "k8s.io",
},
{
Name: "",
},
}),
expectedError: `externalAdmissionHook[1].name: Invalid value: "k8s.io": should be a domain with at least two dots, externalAdmissionHook[2].name: Required value`,
},
{
name: "Operations must not be empty or nil",
config: getExternalAdmissionHookConfiguration(
[]admissionregistration.ExternalAdmissionHook{
{
Name: "webhook.k8s.io",
Rules: []admissionregistration.RuleWithOperations{
{
Operations: []admissionregistration.OperationType{},
Rule: admissionregistration.Rule{
APIGroups: []string{"a"},
APIVersions: []string{"a"},
Resources: []string{"a"},
},
},
{
Operations: nil,
Rule: admissionregistration.Rule{
APIGroups: []string{"a"},
APIVersions: []string{"a"},
Resources: []string{"a"},
},
},
},
},
}),
expectedError: `externalAdmissionHook[0].rules[0].operations: Required value, externalAdmissionHook[0].rules[1].operations: Required value`,
},
{
name: "\"\" is NOT a valid operation",
config: getExternalAdmissionHookConfiguration(
[]admissionregistration.ExternalAdmissionHook{
{
Name: "webhook.k8s.io",
Rules: []admissionregistration.RuleWithOperations{
{
Operations: []admissionregistration.OperationType{"CREATE", ""},
Rule: admissionregistration.Rule{
APIGroups: []string{"a"},
APIVersions: []string{"a"},
Resources: []string{"a"},
},
},
},
},
}),
expectedError: `Unsupported value: ""`,
},
{
name: "operation must be either create/update/delete/connect",
config: getExternalAdmissionHookConfiguration(
[]admissionregistration.ExternalAdmissionHook{
{
Name: "webhook.k8s.io",
Rules: []admissionregistration.RuleWithOperations{
{
Operations: []admissionregistration.OperationType{"PATCH"},
Rule: admissionregistration.Rule{
APIGroups: []string{"a"},
APIVersions: []string{"a"},
Resources: []string{"a"},
},
},
},
},
}),
expectedError: `Unsupported value: "PATCH"`,
},
{
name: "wildcard cannot be mixed with other strings",
config: getExternalAdmissionHookConfiguration(
[]admissionregistration.ExternalAdmissionHook{
{
Name: "webhook.k8s.io",
Rules: []admissionregistration.RuleWithOperations{
{
Operations: []admissionregistration.OperationType{"CREATE", "*"},
Rule: admissionregistration.Rule{
APIGroups: []string{"a"},
APIVersions: []string{"a"},
Resources: []string{"a"},
},
},
},
},
}),
expectedError: `if '*' is present, must not specify other operations`,
},
{
name: "FailurePolicy can only be \"Ignore\"",
config: getExternalAdmissionHookConfiguration(
[]admissionregistration.ExternalAdmissionHook{
{
Name: "initializer.k8s.io",
FailurePolicy: func() *admissionregistration.FailurePolicyType {
r := admissionregistration.Fail
return &r
}(),
},
}),
expectedError: `failurePolicy: Unsupported value: "Fail": supported values: Ignore`,
},
}
for _, test := range tests {
errs := ValidateExternalAdmissionHookConfiguration(test.config)
err := errs.ToAggregate()
if err != nil {
if e, a := test.expectedError, err.Error(); !strings.Contains(a, e) || e == "" {
t.Errorf("test case %s, expected to contain %s, got %s", test.name, e, a)
}
} else {
if test.expectedError != "" {
t.Errorf("test case %s, unexpected no error, expected to contain %s", test.name, test.expectedError)
}
}
}
}

View File

@ -0,0 +1,254 @@
// +build !ignore_autogenerated
/*
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.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package admissionregistration
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
reflect "reflect"
)
func init() {
SchemeBuilder.Register(RegisterDeepCopies)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_AdmissionHookClientConfig, InType: reflect.TypeOf(&AdmissionHookClientConfig{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_ExternalAdmissionHook, InType: reflect.TypeOf(&ExternalAdmissionHook{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_ExternalAdmissionHookConfiguration, InType: reflect.TypeOf(&ExternalAdmissionHookConfiguration{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_ExternalAdmissionHookConfigurationList, InType: reflect.TypeOf(&ExternalAdmissionHookConfigurationList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_Initializer, InType: reflect.TypeOf(&Initializer{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_InitializerConfiguration, InType: reflect.TypeOf(&InitializerConfiguration{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_InitializerConfigurationList, InType: reflect.TypeOf(&InitializerConfigurationList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_Rule, InType: reflect.TypeOf(&Rule{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_RuleWithOperations, InType: reflect.TypeOf(&RuleWithOperations{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_admissionregistration_ServiceReference, InType: reflect.TypeOf(&ServiceReference{})},
)
}
// DeepCopy_admissionregistration_AdmissionHookClientConfig is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_AdmissionHookClientConfig(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*AdmissionHookClientConfig)
out := out.(*AdmissionHookClientConfig)
*out = *in
if in.CABundle != nil {
in, out := &in.CABundle, &out.CABundle
*out = make([]byte, len(*in))
copy(*out, *in)
}
return nil
}
}
// DeepCopy_admissionregistration_ExternalAdmissionHook is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_ExternalAdmissionHook(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ExternalAdmissionHook)
out := out.(*ExternalAdmissionHook)
*out = *in
if err := DeepCopy_admissionregistration_AdmissionHookClientConfig(&in.ClientConfig, &out.ClientConfig, c); err != nil {
return err
}
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]RuleWithOperations, len(*in))
for i := range *in {
if err := DeepCopy_admissionregistration_RuleWithOperations(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
if in.FailurePolicy != nil {
in, out := &in.FailurePolicy, &out.FailurePolicy
*out = new(FailurePolicyType)
**out = **in
}
return nil
}
}
// DeepCopy_admissionregistration_ExternalAdmissionHookConfiguration is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_ExternalAdmissionHookConfiguration(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ExternalAdmissionHookConfiguration)
out := out.(*ExternalAdmissionHookConfiguration)
*out = *in
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
}
if in.ExternalAdmissionHooks != nil {
in, out := &in.ExternalAdmissionHooks, &out.ExternalAdmissionHooks
*out = make([]ExternalAdmissionHook, len(*in))
for i := range *in {
if err := DeepCopy_admissionregistration_ExternalAdmissionHook(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
return nil
}
}
// DeepCopy_admissionregistration_ExternalAdmissionHookConfigurationList is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_ExternalAdmissionHookConfigurationList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ExternalAdmissionHookConfigurationList)
out := out.(*ExternalAdmissionHookConfigurationList)
*out = *in
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ExternalAdmissionHookConfiguration, len(*in))
for i := range *in {
if err := DeepCopy_admissionregistration_ExternalAdmissionHookConfiguration(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
return nil
}
}
// DeepCopy_admissionregistration_Initializer is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_Initializer(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Initializer)
out := out.(*Initializer)
*out = *in
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]Rule, len(*in))
for i := range *in {
if err := DeepCopy_admissionregistration_Rule(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
if in.FailurePolicy != nil {
in, out := &in.FailurePolicy, &out.FailurePolicy
*out = new(FailurePolicyType)
**out = **in
}
return nil
}
}
// DeepCopy_admissionregistration_InitializerConfiguration is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_InitializerConfiguration(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*InitializerConfiguration)
out := out.(*InitializerConfiguration)
*out = *in
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
}
if in.Initializers != nil {
in, out := &in.Initializers, &out.Initializers
*out = make([]Initializer, len(*in))
for i := range *in {
if err := DeepCopy_admissionregistration_Initializer(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
return nil
}
}
// DeepCopy_admissionregistration_InitializerConfigurationList is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_InitializerConfigurationList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*InitializerConfigurationList)
out := out.(*InitializerConfigurationList)
*out = *in
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]InitializerConfiguration, len(*in))
for i := range *in {
if err := DeepCopy_admissionregistration_InitializerConfiguration(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
}
return nil
}
}
// DeepCopy_admissionregistration_Rule is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_Rule(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Rule)
out := out.(*Rule)
*out = *in
if in.APIGroups != nil {
in, out := &in.APIGroups, &out.APIGroups
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.APIVersions != nil {
in, out := &in.APIVersions, &out.APIVersions
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = make([]string, len(*in))
copy(*out, *in)
}
return nil
}
}
// DeepCopy_admissionregistration_RuleWithOperations is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_RuleWithOperations(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*RuleWithOperations)
out := out.(*RuleWithOperations)
*out = *in
if in.Operations != nil {
in, out := &in.Operations, &out.Operations
*out = make([]OperationType, len(*in))
copy(*out, *in)
}
if err := DeepCopy_admissionregistration_Rule(&in.Rule, &out.Rule, c); err != nil {
return err
}
return nil
}
}
// DeepCopy_admissionregistration_ServiceReference is an autogenerated deepcopy function.
func DeepCopy_admissionregistration_ServiceReference(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ServiceReference)
out := out.(*ServiceReference)
*out = *in
return nil
}
}

View File

@ -29,6 +29,7 @@ go_library(
"//pkg/apis/rbac/install:go_default_library",
"//pkg/apis/settings/install:go_default_library",
"//pkg/apis/storage/install:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/apps/v1beta1:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/authentication/v1:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/authentication/v1beta1:go_default_library",
@ -67,6 +68,7 @@ filegroup(
":package-srcs",
"//pkg/client/clientset_generated/clientset/fake:all-srcs",
"//pkg/client/clientset_generated/clientset/scheme:all-srcs",
"//pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1:all-srcs",
"//pkg/client/clientset_generated/clientset/typed/apps/v1beta1:all-srcs",
"//pkg/client/clientset_generated/clientset/typed/authentication/v1:all-srcs",
"//pkg/client/clientset_generated/clientset/typed/authentication/v1beta1:all-srcs",

View File

@ -21,6 +21,7 @@ import (
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
admissionregistrationv1alpha1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1"
appsv1beta1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/apps/v1beta1"
authenticationv1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/authentication/v1"
authenticationv1beta1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/authentication/v1beta1"
@ -43,6 +44,9 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface
// Deprecated: please explicitly pick a version if possible.
Admissionregistration() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface
CoreV1() corev1.CoreV1Interface
// Deprecated: please explicitly pick a version if possible.
Core() corev1.CoreV1Interface
@ -91,6 +95,7 @@ type Interface interface {
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Client
*corev1.CoreV1Client
*appsv1beta1.AppsV1beta1Client
*authenticationv1.AuthenticationV1Client
@ -111,6 +116,23 @@ type Clientset struct {
*storagev1.StorageV1Client
}
// AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client
func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
if c == nil {
return nil
}
return c.AdmissionregistrationV1alpha1Client
}
// Deprecated: Admissionregistration retrieves the default version of AdmissionregistrationClient.
// Please explicitly pick a version.
func (c *Clientset) Admissionregistration() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
if c == nil {
return nil
}
return c.AdmissionregistrationV1alpha1Client
}
// CoreV1 retrieves the CoreV1Client
func (c *Clientset) CoreV1() corev1.CoreV1Interface {
if c == nil {
@ -379,6 +401,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
}
var cs Clientset
var err error
cs.AdmissionregistrationV1alpha1Client, err = admissionregistrationv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.CoreV1Client, err = corev1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
@ -464,6 +490,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.AdmissionregistrationV1alpha1Client = admissionregistrationv1alpha1.NewForConfigOrDie(c)
cs.CoreV1Client = corev1.NewForConfigOrDie(c)
cs.AppsV1beta1Client = appsv1beta1.NewForConfigOrDie(c)
cs.AuthenticationV1Client = authenticationv1.NewForConfigOrDie(c)
@ -490,6 +517,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.AdmissionregistrationV1alpha1Client = admissionregistrationv1alpha1.New(c)
cs.CoreV1Client = corev1.New(c)
cs.AppsV1beta1Client = appsv1beta1.New(c)
cs.AuthenticationV1Client = authenticationv1.New(c)

View File

@ -17,6 +17,7 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//pkg/apis/apps/v1beta1:go_default_library",
"//pkg/apis/authentication/v1:go_default_library",
"//pkg/apis/authentication/v1beta1:go_default_library",
@ -35,6 +36,8 @@ go_library(
"//pkg/apis/storage/v1:go_default_library",
"//pkg/apis/storage/v1beta1:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1/fake:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/apps/v1beta1:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/apps/v1beta1/fake:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/authentication/v1:go_default_library",

View File

@ -23,6 +23,8 @@ import (
fakediscovery "k8s.io/client-go/discovery/fake"
"k8s.io/client-go/testing"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
admissionregistrationv1alpha1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1"
fakeadmissionregistrationv1alpha1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1/fake"
appsv1beta1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/apps/v1beta1"
fakeappsv1beta1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/apps/v1beta1/fake"
authenticationv1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/authentication/v1"
@ -94,6 +96,16 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
var _ clientset.Interface = &Clientset{}
// AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client
func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake}
}
// Admissionregistration retrieves the AdmissionregistrationV1alpha1Client
func (c *Clientset) Admissionregistration() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake}
}
// CoreV1 retrieves the CoreV1Client
func (c *Clientset) CoreV1() corev1.CoreV1Interface {
return &fakecorev1.FakeCoreV1{Fake: &c.Fake}

View File

@ -22,6 +22,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
corev1 "k8s.io/kubernetes/pkg/api/v1"
admissionregistrationv1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
appsv1beta1 "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
authenticationv1 "k8s.io/kubernetes/pkg/apis/authentication/v1"
authenticationv1beta1 "k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
@ -65,6 +66,7 @@ func init() {
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
admissionregistrationv1alpha1.AddToScheme(scheme)
corev1.AddToScheme(scheme)
appsv1beta1.AddToScheme(scheme)
authenticationv1.AddToScheme(scheme)

View File

@ -16,6 +16,7 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//pkg/apis/apps/v1beta1:go_default_library",
"//pkg/apis/authentication/v1:go_default_library",
"//pkg/apis/authentication/v1beta1:go_default_library",

View File

@ -22,6 +22,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
corev1 "k8s.io/kubernetes/pkg/api/v1"
admissionregistrationv1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
appsv1beta1 "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
authenticationv1 "k8s.io/kubernetes/pkg/apis/authentication/v1"
authenticationv1beta1 "k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
@ -65,6 +66,7 @@ func init() {
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
admissionregistrationv1alpha1.AddToScheme(scheme)
corev1.AddToScheme(scheme)
appsv1beta1.AddToScheme(scheme)
authenticationv1.AddToScheme(scheme)

View File

@ -0,0 +1,45 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"admissionregistration_client.go",
"doc.go",
"externaladmissionhookconfiguration.go",
"generated_expansion.go",
"initializerconfiguration.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//pkg/client/clientset_generated/clientset/scheme:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1/fake:all-srcs",
],
tags = ["automanaged"],
)

View File

@ -0,0 +1,93 @@
/*
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 (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/scheme"
)
type AdmissionregistrationV1alpha1Interface interface {
RESTClient() rest.Interface
ExternalAdmissionHookConfigurationsGetter
InitializerConfigurationsGetter
}
// AdmissionregistrationV1alpha1Client is used to interact with features provided by the admissionregistration.k8s.io group.
type AdmissionregistrationV1alpha1Client struct {
restClient rest.Interface
}
func (c *AdmissionregistrationV1alpha1Client) ExternalAdmissionHookConfigurations(namespace string) ExternalAdmissionHookConfigurationInterface {
return newExternalAdmissionHookConfigurations(c, namespace)
}
func (c *AdmissionregistrationV1alpha1Client) InitializerConfigurations(namespace string) InitializerConfigurationInterface {
return newInitializerConfigurations(c, namespace)
}
// NewForConfig creates a new AdmissionregistrationV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*AdmissionregistrationV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AdmissionregistrationV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new AdmissionregistrationV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *AdmissionregistrationV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new AdmissionregistrationV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *AdmissionregistrationV1alpha1Client {
return &AdmissionregistrationV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *AdmissionregistrationV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,20 @@
/*
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.
*/
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@ -0,0 +1,155 @@
/*
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 (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/scheme"
)
// ExternalAdmissionHookConfigurationsGetter has a method to return a ExternalAdmissionHookConfigurationInterface.
// A group's client should implement this interface.
type ExternalAdmissionHookConfigurationsGetter interface {
ExternalAdmissionHookConfigurations(namespace string) ExternalAdmissionHookConfigurationInterface
}
// ExternalAdmissionHookConfigurationInterface has methods to work with ExternalAdmissionHookConfiguration resources.
type ExternalAdmissionHookConfigurationInterface interface {
Create(*v1alpha1.ExternalAdmissionHookConfiguration) (*v1alpha1.ExternalAdmissionHookConfiguration, error)
Update(*v1alpha1.ExternalAdmissionHookConfiguration) (*v1alpha1.ExternalAdmissionHookConfiguration, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.ExternalAdmissionHookConfiguration, error)
List(opts v1.ListOptions) (*v1alpha1.ExternalAdmissionHookConfigurationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error)
ExternalAdmissionHookConfigurationExpansion
}
// externalAdmissionHookConfigurations implements ExternalAdmissionHookConfigurationInterface
type externalAdmissionHookConfigurations struct {
client rest.Interface
ns string
}
// newExternalAdmissionHookConfigurations returns a ExternalAdmissionHookConfigurations
func newExternalAdmissionHookConfigurations(c *AdmissionregistrationV1alpha1Client, namespace string) *externalAdmissionHookConfigurations {
return &externalAdmissionHookConfigurations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a externalAdmissionHookConfiguration and creates it. Returns the server's representation of the externalAdmissionHookConfiguration, and an error, if there is any.
func (c *externalAdmissionHookConfigurations) Create(externalAdmissionHookConfiguration *v1alpha1.ExternalAdmissionHookConfiguration) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
result = &v1alpha1.ExternalAdmissionHookConfiguration{}
err = c.client.Post().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
Body(externalAdmissionHookConfiguration).
Do().
Into(result)
return
}
// Update takes the representation of a externalAdmissionHookConfiguration and updates it. Returns the server's representation of the externalAdmissionHookConfiguration, and an error, if there is any.
func (c *externalAdmissionHookConfigurations) Update(externalAdmissionHookConfiguration *v1alpha1.ExternalAdmissionHookConfiguration) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
result = &v1alpha1.ExternalAdmissionHookConfiguration{}
err = c.client.Put().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
Name(externalAdmissionHookConfiguration.Name).
Body(externalAdmissionHookConfiguration).
Do().
Into(result)
return
}
// Delete takes name of the externalAdmissionHookConfiguration and deletes it. Returns an error if one occurs.
func (c *externalAdmissionHookConfigurations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *externalAdmissionHookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the externalAdmissionHookConfiguration, and returns the corresponding externalAdmissionHookConfiguration object, and an error if there is any.
func (c *externalAdmissionHookConfigurations) Get(name string, options v1.GetOptions) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
result = &v1alpha1.ExternalAdmissionHookConfiguration{}
err = c.client.Get().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of ExternalAdmissionHookConfigurations that match those selectors.
func (c *externalAdmissionHookConfigurations) List(opts v1.ListOptions) (result *v1alpha1.ExternalAdmissionHookConfigurationList, err error) {
result = &v1alpha1.ExternalAdmissionHookConfigurationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested externalAdmissionHookConfigurations.
func (c *externalAdmissionHookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched externalAdmissionHookConfiguration.
func (c *externalAdmissionHookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
result = &v1alpha1.ExternalAdmissionHookConfiguration{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,43 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"fake_admissionregistration_client.go",
"fake_externaladmissionhookconfiguration.go",
"fake_initializerconfiguration.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/testing:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,20 @@
/*
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.
*/
// This package is generated by client-gen with custom arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,42 @@
/*
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 fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/admissionregistration/v1alpha1"
)
type FakeAdmissionregistrationV1alpha1 struct {
*testing.Fake
}
func (c *FakeAdmissionregistrationV1alpha1) ExternalAdmissionHookConfigurations(namespace string) v1alpha1.ExternalAdmissionHookConfigurationInterface {
return &FakeExternalAdmissionHookConfigurations{c, namespace}
}
func (c *FakeAdmissionregistrationV1alpha1) InitializerConfigurations(namespace string) v1alpha1.InitializerConfigurationInterface {
return &FakeInitializerConfigurations{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeAdmissionregistrationV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,120 @@
/*
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 fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
)
// FakeExternalAdmissionHookConfigurations implements ExternalAdmissionHookConfigurationInterface
type FakeExternalAdmissionHookConfigurations struct {
Fake *FakeAdmissionregistrationV1alpha1
ns string
}
var externaladmissionhookconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "externaladmissionhookconfigurations"}
var externaladmissionhookconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ExternalAdmissionHookConfiguration"}
func (c *FakeExternalAdmissionHookConfigurations) Create(externalAdmissionHookConfiguration *v1alpha1.ExternalAdmissionHookConfiguration) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(externaladmissionhookconfigurationsResource, c.ns, externalAdmissionHookConfiguration), &v1alpha1.ExternalAdmissionHookConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), err
}
func (c *FakeExternalAdmissionHookConfigurations) Update(externalAdmissionHookConfiguration *v1alpha1.ExternalAdmissionHookConfiguration) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(externaladmissionhookconfigurationsResource, c.ns, externalAdmissionHookConfiguration), &v1alpha1.ExternalAdmissionHookConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), err
}
func (c *FakeExternalAdmissionHookConfigurations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(externaladmissionhookconfigurationsResource, c.ns, name), &v1alpha1.ExternalAdmissionHookConfiguration{})
return err
}
func (c *FakeExternalAdmissionHookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(externaladmissionhookconfigurationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.ExternalAdmissionHookConfigurationList{})
return err
}
func (c *FakeExternalAdmissionHookConfigurations) Get(name string, options v1.GetOptions) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(externaladmissionhookconfigurationsResource, c.ns, name), &v1alpha1.ExternalAdmissionHookConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), err
}
func (c *FakeExternalAdmissionHookConfigurations) List(opts v1.ListOptions) (result *v1alpha1.ExternalAdmissionHookConfigurationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(externaladmissionhookconfigurationsResource, externaladmissionhookconfigurationsKind, c.ns, opts), &v1alpha1.ExternalAdmissionHookConfigurationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ExternalAdmissionHookConfigurationList{}
for _, item := range obj.(*v1alpha1.ExternalAdmissionHookConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested externalAdmissionHookConfigurations.
func (c *FakeExternalAdmissionHookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(externaladmissionhookconfigurationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched externalAdmissionHookConfiguration.
func (c *FakeExternalAdmissionHookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ExternalAdmissionHookConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(externaladmissionhookconfigurationsResource, c.ns, name, data, subresources...), &v1alpha1.ExternalAdmissionHookConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), err
}

View File

@ -0,0 +1,120 @@
/*
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 fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
)
// FakeInitializerConfigurations implements InitializerConfigurationInterface
type FakeInitializerConfigurations struct {
Fake *FakeAdmissionregistrationV1alpha1
ns string
}
var initializerconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "initializerconfigurations"}
var initializerconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "InitializerConfiguration"}
func (c *FakeInitializerConfigurations) Create(initializerConfiguration *v1alpha1.InitializerConfiguration) (result *v1alpha1.InitializerConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(initializerconfigurationsResource, c.ns, initializerConfiguration), &v1alpha1.InitializerConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InitializerConfiguration), err
}
func (c *FakeInitializerConfigurations) Update(initializerConfiguration *v1alpha1.InitializerConfiguration) (result *v1alpha1.InitializerConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(initializerconfigurationsResource, c.ns, initializerConfiguration), &v1alpha1.InitializerConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InitializerConfiguration), err
}
func (c *FakeInitializerConfigurations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(initializerconfigurationsResource, c.ns, name), &v1alpha1.InitializerConfiguration{})
return err
}
func (c *FakeInitializerConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(initializerconfigurationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.InitializerConfigurationList{})
return err
}
func (c *FakeInitializerConfigurations) Get(name string, options v1.GetOptions) (result *v1alpha1.InitializerConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(initializerconfigurationsResource, c.ns, name), &v1alpha1.InitializerConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InitializerConfiguration), err
}
func (c *FakeInitializerConfigurations) List(opts v1.ListOptions) (result *v1alpha1.InitializerConfigurationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(initializerconfigurationsResource, initializerconfigurationsKind, c.ns, opts), &v1alpha1.InitializerConfigurationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.InitializerConfigurationList{}
for _, item := range obj.(*v1alpha1.InitializerConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested initializerConfigurations.
func (c *FakeInitializerConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(initializerconfigurationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched initializerConfiguration.
func (c *FakeInitializerConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InitializerConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(initializerconfigurationsResource, c.ns, name, data, subresources...), &v1alpha1.InitializerConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.InitializerConfiguration), err
}

View File

@ -0,0 +1,21 @@
/*
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
type ExternalAdmissionHookConfigurationExpansion interface{}
type InitializerConfigurationExpansion interface{}

View File

@ -0,0 +1,155 @@
/*
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 (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/scheme"
)
// InitializerConfigurationsGetter has a method to return a InitializerConfigurationInterface.
// A group's client should implement this interface.
type InitializerConfigurationsGetter interface {
InitializerConfigurations(namespace string) InitializerConfigurationInterface
}
// InitializerConfigurationInterface has methods to work with InitializerConfiguration resources.
type InitializerConfigurationInterface interface {
Create(*v1alpha1.InitializerConfiguration) (*v1alpha1.InitializerConfiguration, error)
Update(*v1alpha1.InitializerConfiguration) (*v1alpha1.InitializerConfiguration, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.InitializerConfiguration, error)
List(opts v1.ListOptions) (*v1alpha1.InitializerConfigurationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InitializerConfiguration, err error)
InitializerConfigurationExpansion
}
// initializerConfigurations implements InitializerConfigurationInterface
type initializerConfigurations struct {
client rest.Interface
ns string
}
// newInitializerConfigurations returns a InitializerConfigurations
func newInitializerConfigurations(c *AdmissionregistrationV1alpha1Client, namespace string) *initializerConfigurations {
return &initializerConfigurations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a initializerConfiguration and creates it. Returns the server's representation of the initializerConfiguration, and an error, if there is any.
func (c *initializerConfigurations) Create(initializerConfiguration *v1alpha1.InitializerConfiguration) (result *v1alpha1.InitializerConfiguration, err error) {
result = &v1alpha1.InitializerConfiguration{}
err = c.client.Post().
Namespace(c.ns).
Resource("initializerconfigurations").
Body(initializerConfiguration).
Do().
Into(result)
return
}
// Update takes the representation of a initializerConfiguration and updates it. Returns the server's representation of the initializerConfiguration, and an error, if there is any.
func (c *initializerConfigurations) Update(initializerConfiguration *v1alpha1.InitializerConfiguration) (result *v1alpha1.InitializerConfiguration, err error) {
result = &v1alpha1.InitializerConfiguration{}
err = c.client.Put().
Namespace(c.ns).
Resource("initializerconfigurations").
Name(initializerConfiguration.Name).
Body(initializerConfiguration).
Do().
Into(result)
return
}
// Delete takes name of the initializerConfiguration and deletes it. Returns an error if one occurs.
func (c *initializerConfigurations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("initializerconfigurations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *initializerConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("initializerconfigurations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the initializerConfiguration, and returns the corresponding initializerConfiguration object, and an error if there is any.
func (c *initializerConfigurations) Get(name string, options v1.GetOptions) (result *v1alpha1.InitializerConfiguration, err error) {
result = &v1alpha1.InitializerConfiguration{}
err = c.client.Get().
Namespace(c.ns).
Resource("initializerconfigurations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of InitializerConfigurations that match those selectors.
func (c *initializerConfigurations) List(opts v1.ListOptions) (result *v1alpha1.InitializerConfigurationList, err error) {
result = &v1alpha1.InitializerConfigurationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("initializerconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested initializerConfigurations.
func (c *initializerConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("initializerconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched initializerConfiguration.
func (c *initializerConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.InitializerConfiguration, err error) {
result = &v1alpha1.InitializerConfiguration{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("initializerconfigurations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -15,6 +15,7 @@ go_library(
],
tags = ["automanaged"],
deps = [
"//pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/apps/internalversion:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion:go_default_library",
@ -47,6 +48,7 @@ filegroup(
":package-srcs",
"//pkg/client/clientset_generated/internalclientset/fake:all-srcs",
"//pkg/client/clientset_generated/internalclientset/scheme:all-srcs",
"//pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion:all-srcs",
"//pkg/client/clientset_generated/internalclientset/typed/apps/internalversion:all-srcs",
"//pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion:all-srcs",
"//pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion:all-srcs",

View File

@ -21,6 +21,7 @@ import (
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
admissionregistrationinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion"
appsinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion"
authenticationinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion"
authorizationinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion"
@ -37,6 +38,7 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
Admissionregistration() admissionregistrationinternalversion.AdmissionregistrationInterface
Core() coreinternalversion.CoreInterface
Apps() appsinternalversion.AppsInterface
Authentication() authenticationinternalversion.AuthenticationInterface
@ -55,6 +57,7 @@ type Interface interface {
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*admissionregistrationinternalversion.AdmissionregistrationClient
*coreinternalversion.CoreClient
*appsinternalversion.AppsClient
*authenticationinternalversion.AuthenticationClient
@ -69,6 +72,14 @@ type Clientset struct {
*storageinternalversion.StorageClient
}
// Admissionregistration retrieves the AdmissionregistrationClient
func (c *Clientset) Admissionregistration() admissionregistrationinternalversion.AdmissionregistrationInterface {
if c == nil {
return nil
}
return c.AdmissionregistrationClient
}
// Core retrieves the CoreClient
func (c *Clientset) Core() coreinternalversion.CoreInterface {
if c == nil {
@ -181,6 +192,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
}
var cs Clientset
var err error
cs.AdmissionregistrationClient, err = admissionregistrationinternalversion.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.CoreClient, err = coreinternalversion.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
@ -242,6 +257,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.AdmissionregistrationClient = admissionregistrationinternalversion.NewForConfigOrDie(c)
cs.CoreClient = coreinternalversion.NewForConfigOrDie(c)
cs.AppsClient = appsinternalversion.NewForConfigOrDie(c)
cs.AuthenticationClient = authenticationinternalversion.NewForConfigOrDie(c)
@ -262,6 +278,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.AdmissionregistrationClient = admissionregistrationinternalversion.New(c)
cs.CoreClient = coreinternalversion.New(c)
cs.AppsClient = appsinternalversion.New(c)
cs.AuthenticationClient = authenticationinternalversion.New(c)

View File

@ -17,6 +17,7 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/apis/admissionregistration:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/apis/authentication:go_default_library",
"//pkg/apis/authorization:go_default_library",
@ -29,6 +30,8 @@ go_library(
"//pkg/apis/settings:go_default_library",
"//pkg/apis/storage:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion/fake:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/apps/internalversion:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/apps/internalversion/fake:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion:go_default_library",

View File

@ -23,6 +23,8 @@ import (
fakediscovery "k8s.io/client-go/discovery/fake"
"k8s.io/client-go/testing"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
admissionregistrationinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion"
fakeadmissionregistrationinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion/fake"
appsinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion"
fakeappsinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion/fake"
authenticationinternalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion"
@ -82,6 +84,11 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
var _ clientset.Interface = &Clientset{}
// Admissionregistration retrieves the AdmissionregistrationClient
func (c *Clientset) Admissionregistration() admissionregistrationinternalversion.AdmissionregistrationInterface {
return &fakeadmissionregistrationinternalversion.FakeAdmissionregistration{Fake: &c.Fake}
}
// Core retrieves the CoreClient
func (c *Clientset) Core() coreinternalversion.CoreInterface {
return &fakecoreinternalversion.FakeCore{Fake: &c.Fake}

View File

@ -22,6 +22,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
coreinternalversion "k8s.io/kubernetes/pkg/api"
admissionregistrationinternalversion "k8s.io/kubernetes/pkg/apis/admissionregistration"
appsinternalversion "k8s.io/kubernetes/pkg/apis/apps"
authenticationinternalversion "k8s.io/kubernetes/pkg/apis/authentication"
authorizationinternalversion "k8s.io/kubernetes/pkg/apis/authorization"
@ -59,6 +60,7 @@ func init() {
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
admissionregistrationinternalversion.AddToScheme(scheme)
coreinternalversion.AddToScheme(scheme)
appsinternalversion.AddToScheme(scheme)
authenticationinternalversion.AddToScheme(scheme)

View File

@ -17,6 +17,7 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api/install:go_default_library",
"//pkg/apis/admissionregistration/install:go_default_library",
"//pkg/apis/apps/install:go_default_library",
"//pkg/apis/authentication/install:go_default_library",
"//pkg/apis/authorization/install:go_default_library",

View File

@ -24,6 +24,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
core "k8s.io/kubernetes/pkg/api/install"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration/install"
apps "k8s.io/kubernetes/pkg/apis/apps/install"
authentication "k8s.io/kubernetes/pkg/apis/authentication/install"
authorization "k8s.io/kubernetes/pkg/apis/authorization/install"
@ -52,6 +53,7 @@ func init() {
// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
admissionregistration.Install(groupFactoryRegistry, registry, scheme)
core.Install(groupFactoryRegistry, registry, scheme)
apps.Install(groupFactoryRegistry, registry, scheme)
authentication.Install(groupFactoryRegistry, registry, scheme)

View File

@ -0,0 +1,44 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"admissionregistration_client.go",
"doc.go",
"externaladmissionhookconfiguration.go",
"generated_expansion.go",
"initializerconfiguration.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration:go_default_library",
"//pkg/client/clientset_generated/internalclientset/scheme:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion/fake:all-srcs",
],
tags = ["automanaged"],
)

View File

@ -0,0 +1,104 @@
/*
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 internalversion
import (
rest "k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
)
type AdmissionregistrationInterface interface {
RESTClient() rest.Interface
ExternalAdmissionHookConfigurationsGetter
InitializerConfigurationsGetter
}
// AdmissionregistrationClient is used to interact with features provided by the admissionregistration.k8s.io group.
type AdmissionregistrationClient struct {
restClient rest.Interface
}
func (c *AdmissionregistrationClient) ExternalAdmissionHookConfigurations(namespace string) ExternalAdmissionHookConfigurationInterface {
return newExternalAdmissionHookConfigurations(c, namespace)
}
func (c *AdmissionregistrationClient) InitializerConfigurations(namespace string) InitializerConfigurationInterface {
return newInitializerConfigurations(c, namespace)
}
// NewForConfig creates a new AdmissionregistrationClient for the given config.
func NewForConfig(c *rest.Config) (*AdmissionregistrationClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AdmissionregistrationClient{client}, nil
}
// NewForConfigOrDie creates a new AdmissionregistrationClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *AdmissionregistrationClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new AdmissionregistrationClient for the given RESTClient.
func New(c rest.Interface) *AdmissionregistrationClient {
return &AdmissionregistrationClient{c}
}
func setConfigDefaults(config *rest.Config) error {
g, err := scheme.Registry.Group("admissionregistration.k8s.io")
if err != nil {
return err
}
config.APIPath = "/apis"
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group {
gv := g.GroupVersion
config.GroupVersion = &gv
}
config.NegotiatedSerializer = scheme.Codecs
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *AdmissionregistrationClient) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,20 @@
/*
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.
*/
// This package is generated by client-gen with the default arguments.
// This package has the automatically generated typed clients.
package internalversion

View File

@ -0,0 +1,155 @@
/*
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 internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
)
// ExternalAdmissionHookConfigurationsGetter has a method to return a ExternalAdmissionHookConfigurationInterface.
// A group's client should implement this interface.
type ExternalAdmissionHookConfigurationsGetter interface {
ExternalAdmissionHookConfigurations(namespace string) ExternalAdmissionHookConfigurationInterface
}
// ExternalAdmissionHookConfigurationInterface has methods to work with ExternalAdmissionHookConfiguration resources.
type ExternalAdmissionHookConfigurationInterface interface {
Create(*admissionregistration.ExternalAdmissionHookConfiguration) (*admissionregistration.ExternalAdmissionHookConfiguration, error)
Update(*admissionregistration.ExternalAdmissionHookConfiguration) (*admissionregistration.ExternalAdmissionHookConfiguration, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*admissionregistration.ExternalAdmissionHookConfiguration, error)
List(opts v1.ListOptions) (*admissionregistration.ExternalAdmissionHookConfigurationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error)
ExternalAdmissionHookConfigurationExpansion
}
// externalAdmissionHookConfigurations implements ExternalAdmissionHookConfigurationInterface
type externalAdmissionHookConfigurations struct {
client rest.Interface
ns string
}
// newExternalAdmissionHookConfigurations returns a ExternalAdmissionHookConfigurations
func newExternalAdmissionHookConfigurations(c *AdmissionregistrationClient, namespace string) *externalAdmissionHookConfigurations {
return &externalAdmissionHookConfigurations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a externalAdmissionHookConfiguration and creates it. Returns the server's representation of the externalAdmissionHookConfiguration, and an error, if there is any.
func (c *externalAdmissionHookConfigurations) Create(externalAdmissionHookConfiguration *admissionregistration.ExternalAdmissionHookConfiguration) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error) {
result = &admissionregistration.ExternalAdmissionHookConfiguration{}
err = c.client.Post().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
Body(externalAdmissionHookConfiguration).
Do().
Into(result)
return
}
// Update takes the representation of a externalAdmissionHookConfiguration and updates it. Returns the server's representation of the externalAdmissionHookConfiguration, and an error, if there is any.
func (c *externalAdmissionHookConfigurations) Update(externalAdmissionHookConfiguration *admissionregistration.ExternalAdmissionHookConfiguration) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error) {
result = &admissionregistration.ExternalAdmissionHookConfiguration{}
err = c.client.Put().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
Name(externalAdmissionHookConfiguration.Name).
Body(externalAdmissionHookConfiguration).
Do().
Into(result)
return
}
// Delete takes name of the externalAdmissionHookConfiguration and deletes it. Returns an error if one occurs.
func (c *externalAdmissionHookConfigurations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *externalAdmissionHookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the externalAdmissionHookConfiguration, and returns the corresponding externalAdmissionHookConfiguration object, and an error if there is any.
func (c *externalAdmissionHookConfigurations) Get(name string, options v1.GetOptions) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error) {
result = &admissionregistration.ExternalAdmissionHookConfiguration{}
err = c.client.Get().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of ExternalAdmissionHookConfigurations that match those selectors.
func (c *externalAdmissionHookConfigurations) List(opts v1.ListOptions) (result *admissionregistration.ExternalAdmissionHookConfigurationList, err error) {
result = &admissionregistration.ExternalAdmissionHookConfigurationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested externalAdmissionHookConfigurations.
func (c *externalAdmissionHookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched externalAdmissionHookConfiguration.
func (c *externalAdmissionHookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error) {
result = &admissionregistration.ExternalAdmissionHookConfiguration{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("externaladmissionhookconfigurations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,43 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"fake_admissionregistration_client.go",
"fake_externaladmissionhookconfiguration.go",
"fake_initializerconfiguration.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration:go_default_library",
"//pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/testing:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,20 @@
/*
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.
*/
// This package is generated by client-gen with the default arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,42 @@
/*
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 fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
internalversion "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion"
)
type FakeAdmissionregistration struct {
*testing.Fake
}
func (c *FakeAdmissionregistration) ExternalAdmissionHookConfigurations(namespace string) internalversion.ExternalAdmissionHookConfigurationInterface {
return &FakeExternalAdmissionHookConfigurations{c, namespace}
}
func (c *FakeAdmissionregistration) InitializerConfigurations(namespace string) internalversion.InitializerConfigurationInterface {
return &FakeInitializerConfigurations{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeAdmissionregistration) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,120 @@
/*
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 fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
)
// FakeExternalAdmissionHookConfigurations implements ExternalAdmissionHookConfigurationInterface
type FakeExternalAdmissionHookConfigurations struct {
Fake *FakeAdmissionregistration
ns string
}
var externaladmissionhookconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "", Resource: "externaladmissionhookconfigurations"}
var externaladmissionhookconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "", Kind: "ExternalAdmissionHookConfiguration"}
func (c *FakeExternalAdmissionHookConfigurations) Create(externalAdmissionHookConfiguration *admissionregistration.ExternalAdmissionHookConfiguration) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(externaladmissionhookconfigurationsResource, c.ns, externalAdmissionHookConfiguration), &admissionregistration.ExternalAdmissionHookConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*admissionregistration.ExternalAdmissionHookConfiguration), err
}
func (c *FakeExternalAdmissionHookConfigurations) Update(externalAdmissionHookConfiguration *admissionregistration.ExternalAdmissionHookConfiguration) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(externaladmissionhookconfigurationsResource, c.ns, externalAdmissionHookConfiguration), &admissionregistration.ExternalAdmissionHookConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*admissionregistration.ExternalAdmissionHookConfiguration), err
}
func (c *FakeExternalAdmissionHookConfigurations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(externaladmissionhookconfigurationsResource, c.ns, name), &admissionregistration.ExternalAdmissionHookConfiguration{})
return err
}
func (c *FakeExternalAdmissionHookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(externaladmissionhookconfigurationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &admissionregistration.ExternalAdmissionHookConfigurationList{})
return err
}
func (c *FakeExternalAdmissionHookConfigurations) Get(name string, options v1.GetOptions) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(externaladmissionhookconfigurationsResource, c.ns, name), &admissionregistration.ExternalAdmissionHookConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*admissionregistration.ExternalAdmissionHookConfiguration), err
}
func (c *FakeExternalAdmissionHookConfigurations) List(opts v1.ListOptions) (result *admissionregistration.ExternalAdmissionHookConfigurationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(externaladmissionhookconfigurationsResource, externaladmissionhookconfigurationsKind, c.ns, opts), &admissionregistration.ExternalAdmissionHookConfigurationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &admissionregistration.ExternalAdmissionHookConfigurationList{}
for _, item := range obj.(*admissionregistration.ExternalAdmissionHookConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested externalAdmissionHookConfigurations.
func (c *FakeExternalAdmissionHookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(externaladmissionhookconfigurationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched externalAdmissionHookConfiguration.
func (c *FakeExternalAdmissionHookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admissionregistration.ExternalAdmissionHookConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(externaladmissionhookconfigurationsResource, c.ns, name, data, subresources...), &admissionregistration.ExternalAdmissionHookConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*admissionregistration.ExternalAdmissionHookConfiguration), err
}

View File

@ -0,0 +1,120 @@
/*
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 fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
)
// FakeInitializerConfigurations implements InitializerConfigurationInterface
type FakeInitializerConfigurations struct {
Fake *FakeAdmissionregistration
ns string
}
var initializerconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "", Resource: "initializerconfigurations"}
var initializerconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "", Kind: "InitializerConfiguration"}
func (c *FakeInitializerConfigurations) Create(initializerConfiguration *admissionregistration.InitializerConfiguration) (result *admissionregistration.InitializerConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(initializerconfigurationsResource, c.ns, initializerConfiguration), &admissionregistration.InitializerConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*admissionregistration.InitializerConfiguration), err
}
func (c *FakeInitializerConfigurations) Update(initializerConfiguration *admissionregistration.InitializerConfiguration) (result *admissionregistration.InitializerConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(initializerconfigurationsResource, c.ns, initializerConfiguration), &admissionregistration.InitializerConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*admissionregistration.InitializerConfiguration), err
}
func (c *FakeInitializerConfigurations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(initializerconfigurationsResource, c.ns, name), &admissionregistration.InitializerConfiguration{})
return err
}
func (c *FakeInitializerConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(initializerconfigurationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &admissionregistration.InitializerConfigurationList{})
return err
}
func (c *FakeInitializerConfigurations) Get(name string, options v1.GetOptions) (result *admissionregistration.InitializerConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(initializerconfigurationsResource, c.ns, name), &admissionregistration.InitializerConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*admissionregistration.InitializerConfiguration), err
}
func (c *FakeInitializerConfigurations) List(opts v1.ListOptions) (result *admissionregistration.InitializerConfigurationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(initializerconfigurationsResource, initializerconfigurationsKind, c.ns, opts), &admissionregistration.InitializerConfigurationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &admissionregistration.InitializerConfigurationList{}
for _, item := range obj.(*admissionregistration.InitializerConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested initializerConfigurations.
func (c *FakeInitializerConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(initializerconfigurationsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched initializerConfiguration.
func (c *FakeInitializerConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admissionregistration.InitializerConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(initializerconfigurationsResource, c.ns, name, data, subresources...), &admissionregistration.InitializerConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*admissionregistration.InitializerConfiguration), err
}

View File

@ -0,0 +1,21 @@
/*
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 internalversion
type ExternalAdmissionHookConfigurationExpansion interface{}
type InitializerConfigurationExpansion interface{}

View File

@ -0,0 +1,155 @@
/*
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 internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
)
// InitializerConfigurationsGetter has a method to return a InitializerConfigurationInterface.
// A group's client should implement this interface.
type InitializerConfigurationsGetter interface {
InitializerConfigurations(namespace string) InitializerConfigurationInterface
}
// InitializerConfigurationInterface has methods to work with InitializerConfiguration resources.
type InitializerConfigurationInterface interface {
Create(*admissionregistration.InitializerConfiguration) (*admissionregistration.InitializerConfiguration, error)
Update(*admissionregistration.InitializerConfiguration) (*admissionregistration.InitializerConfiguration, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*admissionregistration.InitializerConfiguration, error)
List(opts v1.ListOptions) (*admissionregistration.InitializerConfigurationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admissionregistration.InitializerConfiguration, err error)
InitializerConfigurationExpansion
}
// initializerConfigurations implements InitializerConfigurationInterface
type initializerConfigurations struct {
client rest.Interface
ns string
}
// newInitializerConfigurations returns a InitializerConfigurations
func newInitializerConfigurations(c *AdmissionregistrationClient, namespace string) *initializerConfigurations {
return &initializerConfigurations{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a initializerConfiguration and creates it. Returns the server's representation of the initializerConfiguration, and an error, if there is any.
func (c *initializerConfigurations) Create(initializerConfiguration *admissionregistration.InitializerConfiguration) (result *admissionregistration.InitializerConfiguration, err error) {
result = &admissionregistration.InitializerConfiguration{}
err = c.client.Post().
Namespace(c.ns).
Resource("initializerconfigurations").
Body(initializerConfiguration).
Do().
Into(result)
return
}
// Update takes the representation of a initializerConfiguration and updates it. Returns the server's representation of the initializerConfiguration, and an error, if there is any.
func (c *initializerConfigurations) Update(initializerConfiguration *admissionregistration.InitializerConfiguration) (result *admissionregistration.InitializerConfiguration, err error) {
result = &admissionregistration.InitializerConfiguration{}
err = c.client.Put().
Namespace(c.ns).
Resource("initializerconfigurations").
Name(initializerConfiguration.Name).
Body(initializerConfiguration).
Do().
Into(result)
return
}
// Delete takes name of the initializerConfiguration and deletes it. Returns an error if one occurs.
func (c *initializerConfigurations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("initializerconfigurations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *initializerConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("initializerconfigurations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the initializerConfiguration, and returns the corresponding initializerConfiguration object, and an error if there is any.
func (c *initializerConfigurations) Get(name string, options v1.GetOptions) (result *admissionregistration.InitializerConfiguration, err error) {
result = &admissionregistration.InitializerConfiguration{}
err = c.client.Get().
Namespace(c.ns).
Resource("initializerconfigurations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of InitializerConfigurations that match those selectors.
func (c *initializerConfigurations) List(opts v1.ListOptions) (result *admissionregistration.InitializerConfigurationList, err error) {
result = &admissionregistration.InitializerConfigurationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("initializerconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested initializerConfigurations.
func (c *initializerConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("initializerconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched initializerConfiguration.
func (c *initializerConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admissionregistration.InitializerConfiguration, err error) {
result = &admissionregistration.InitializerConfiguration{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("initializerconfigurations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -16,6 +16,7 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//pkg/apis/apps/v1beta1:go_default_library",
"//pkg/apis/autoscaling/v1:go_default_library",
"//pkg/apis/autoscaling/v2alpha1:go_default_library",
@ -30,6 +31,7 @@ go_library(
"//pkg/apis/storage/v1:go_default_library",
"//pkg/apis/storage/v1beta1:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/client/informers/informers_generated/externalversions/admissionregistration:go_default_library",
"//pkg/client/informers/informers_generated/externalversions/apps:go_default_library",
"//pkg/client/informers/informers_generated/externalversions/autoscaling:go_default_library",
"//pkg/client/informers/informers_generated/externalversions/batch:go_default_library",
@ -58,6 +60,7 @@ filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//pkg/client/informers/informers_generated/externalversions/admissionregistration:all-srcs",
"//pkg/client/informers/informers_generated/externalversions/apps:all-srcs",
"//pkg/client/informers/informers_generated/externalversions/autoscaling:all-srcs",
"//pkg/client/informers/informers_generated/externalversions/batch:all-srcs",

View File

@ -0,0 +1,34 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//pkg/client/informers/informers_generated/externalversions/admissionregistration/v1alpha1:go_default_library",
"//pkg/client/informers/informers_generated/externalversions/internalinterfaces:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//pkg/client/informers/informers_generated/externalversions/admissionregistration/v1alpha1:all-srcs",
],
tags = ["automanaged"],
)

View File

@ -0,0 +1,44 @@
/*
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.
*/
// This file was automatically generated by informer-gen
package admissionregistration
import (
v1alpha1 "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/admissionregistration/v1alpha1"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
}
type group struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &group{f}
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.SharedInformerFactory)
}

View File

@ -0,0 +1,41 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"externaladmissionhookconfiguration.go",
"initializerconfiguration.go",
"interface.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/client/informers/informers_generated/externalversions/internalinterfaces:go_default_library",
"//pkg/client/listers/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,68 @@
/*
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.
*/
// This file was automatically generated by informer-gen
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
admissionregistration_v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
v1alpha1 "k8s.io/kubernetes/pkg/client/listers/admissionregistration/v1alpha1"
time "time"
)
// ExternalAdmissionHookConfigurationInformer provides access to a shared informer and lister for
// ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.ExternalAdmissionHookConfigurationLister
}
type externalAdmissionHookConfigurationInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newExternalAdmissionHookConfigurationInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.AdmissionregistrationV1alpha1().ExternalAdmissionHookConfigurations(v1.NamespaceAll).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.AdmissionregistrationV1alpha1().ExternalAdmissionHookConfigurations(v1.NamespaceAll).Watch(options)
},
},
&admissionregistration_v1alpha1.ExternalAdmissionHookConfiguration{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *externalAdmissionHookConfigurationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&admissionregistration_v1alpha1.ExternalAdmissionHookConfiguration{}, newExternalAdmissionHookConfigurationInformer)
}
func (f *externalAdmissionHookConfigurationInformer) Lister() v1alpha1.ExternalAdmissionHookConfigurationLister {
return v1alpha1.NewExternalAdmissionHookConfigurationLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,68 @@
/*
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.
*/
// This file was automatically generated by informer-gen
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
admissionregistration_v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
v1alpha1 "k8s.io/kubernetes/pkg/client/listers/admissionregistration/v1alpha1"
time "time"
)
// InitializerConfigurationInformer provides access to a shared informer and lister for
// InitializerConfigurations.
type InitializerConfigurationInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.InitializerConfigurationLister
}
type initializerConfigurationInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newInitializerConfigurationInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.AdmissionregistrationV1alpha1().InitializerConfigurations(v1.NamespaceAll).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.AdmissionregistrationV1alpha1().InitializerConfigurations(v1.NamespaceAll).Watch(options)
},
},
&admissionregistration_v1alpha1.InitializerConfiguration{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *initializerConfigurationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&admissionregistration_v1alpha1.InitializerConfiguration{}, newInitializerConfigurationInformer)
}
func (f *initializerConfigurationInformer) Lister() v1alpha1.InitializerConfigurationLister {
return v1alpha1.NewInitializerConfigurationLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,50 @@
/*
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.
*/
// This file was automatically generated by informer-gen
package v1alpha1
import (
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// ExternalAdmissionHookConfigurations returns a ExternalAdmissionHookConfigurationInformer.
ExternalAdmissionHookConfigurations() ExternalAdmissionHookConfigurationInformer
// InitializerConfigurations returns a InitializerConfigurationInformer.
InitializerConfigurations() InitializerConfigurationInformer
}
type version struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f}
}
// ExternalAdmissionHookConfigurations returns a ExternalAdmissionHookConfigurationInformer.
func (v *version) ExternalAdmissionHookConfigurations() ExternalAdmissionHookConfigurationInformer {
return &externalAdmissionHookConfigurationInformer{factory: v.SharedInformerFactory}
}
// InitializerConfigurations returns a InitializerConfigurationInformer.
func (v *version) InitializerConfigurations() InitializerConfigurationInformer {
return &initializerConfigurationInformer{factory: v.SharedInformerFactory}
}

View File

@ -23,6 +23,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
admissionregistration "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/admissionregistration"
apps "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/apps"
autoscaling "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/autoscaling"
batch "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/batch"
@ -119,6 +120,7 @@ type SharedInformerFactory interface {
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
Admissionregistration() admissionregistration.Interface
Apps() apps.Interface
Autoscaling() autoscaling.Interface
Batch() batch.Interface
@ -131,6 +133,10 @@ type SharedInformerFactory interface {
Storage() storage.Interface
}
func (f *sharedInformerFactory) Admissionregistration() admissionregistration.Interface {
return admissionregistration.New(f)
}
func (f *sharedInformerFactory) Apps() apps.Interface {
return apps.New(f)
}

View File

@ -23,6 +23,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
api_v1 "k8s.io/kubernetes/pkg/api/v1"
v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
v1beta1 "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
v1 "k8s.io/kubernetes/pkg/apis/autoscaling/v1"
v2alpha1 "k8s.io/kubernetes/pkg/apis/autoscaling/v2alpha1"
@ -31,7 +32,7 @@ import (
certificates_v1beta1 "k8s.io/kubernetes/pkg/apis/certificates/v1beta1"
extensions_v1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
policy_v1beta1 "k8s.io/kubernetes/pkg/apis/policy/v1beta1"
v1alpha1 "k8s.io/kubernetes/pkg/apis/rbac/v1alpha1"
rbac_v1alpha1 "k8s.io/kubernetes/pkg/apis/rbac/v1alpha1"
rbac_v1beta1 "k8s.io/kubernetes/pkg/apis/rbac/v1beta1"
settings_v1alpha1 "k8s.io/kubernetes/pkg/apis/settings/v1alpha1"
storage_v1 "k8s.io/kubernetes/pkg/apis/storage/v1"
@ -64,7 +65,13 @@ func (f *genericInformer) Lister() cache.GenericLister {
// TODO extend this to unknown resources with a client pool
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=Apps, Version=V1beta1
// Group=Admissionregistration, Version=V1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("externaladmissionhookconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().ExternalAdmissionHookConfigurations().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("initializerconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().InitializerConfigurations().Informer()}, nil
// Group=Apps, Version=V1beta1
case v1beta1.SchemeGroupVersion.WithResource("controllerrevisions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().ControllerRevisions().Informer()}, nil
case v1beta1.SchemeGroupVersion.WithResource("deployments"):
@ -145,13 +152,13 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodDisruptionBudgets().Informer()}, nil
// Group=Rbac, Version=V1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("clusterroles"):
case rbac_v1alpha1.SchemeGroupVersion.WithResource("clusterroles"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoles().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"):
case rbac_v1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoleBindings().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("roles"):
case rbac_v1alpha1.SchemeGroupVersion.WithResource("roles"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().Roles().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("rolebindings"):
case rbac_v1alpha1.SchemeGroupVersion.WithResource("rolebindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().RoleBindings().Informer()}, nil
// Group=Rbac, Version=V1beta1

View File

@ -16,6 +16,7 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/apis/admissionregistration:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/batch:go_default_library",
@ -26,6 +27,7 @@ go_library(
"//pkg/apis/settings:go_default_library",
"//pkg/apis/storage:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//pkg/client/informers/informers_generated/internalversion/admissionregistration:go_default_library",
"//pkg/client/informers/informers_generated/internalversion/apps:go_default_library",
"//pkg/client/informers/informers_generated/internalversion/autoscaling:go_default_library",
"//pkg/client/informers/informers_generated/internalversion/batch:go_default_library",
@ -54,6 +56,7 @@ filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//pkg/client/informers/informers_generated/internalversion/admissionregistration:all-srcs",
"//pkg/client/informers/informers_generated/internalversion/apps:all-srcs",
"//pkg/client/informers/informers_generated/internalversion/autoscaling:all-srcs",
"//pkg/client/informers/informers_generated/internalversion/batch:all-srcs",

View File

@ -0,0 +1,34 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//pkg/client/informers/informers_generated/internalversion/admissionregistration/internalversion:go_default_library",
"//pkg/client/informers/informers_generated/internalversion/internalinterfaces:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//pkg/client/informers/informers_generated/internalversion/admissionregistration/internalversion:all-srcs",
],
tags = ["automanaged"],
)

View File

@ -0,0 +1,44 @@
/*
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.
*/
// This file was automatically generated by informer-gen
package admissionregistration
import (
internalversion "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/admissionregistration/internalversion"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// InternalVersion provides access to shared informers for resources in InternalVersion.
InternalVersion() internalversion.Interface
}
type group struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &group{f}
}
// InternalVersion returns a new internalversion.Interface.
func (g *group) InternalVersion() internalversion.Interface {
return internalversion.New(g.SharedInformerFactory)
}

View File

@ -0,0 +1,41 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"externaladmissionhookconfiguration.go",
"initializerconfiguration.go",
"interface.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//pkg/client/informers/informers_generated/internalversion/internalinterfaces:go_default_library",
"//pkg/client/listers/admissionregistration/internalversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,68 @@
/*
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.
*/
// This file was automatically generated by informer-gen
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
internalclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
internalversion "k8s.io/kubernetes/pkg/client/listers/admissionregistration/internalversion"
time "time"
)
// ExternalAdmissionHookConfigurationInformer provides access to a shared informer and lister for
// ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationInformer interface {
Informer() cache.SharedIndexInformer
Lister() internalversion.ExternalAdmissionHookConfigurationLister
}
type externalAdmissionHookConfigurationInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newExternalAdmissionHookConfigurationInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.Admissionregistration().ExternalAdmissionHookConfigurations(v1.NamespaceAll).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.Admissionregistration().ExternalAdmissionHookConfigurations(v1.NamespaceAll).Watch(options)
},
},
&admissionregistration.ExternalAdmissionHookConfiguration{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *externalAdmissionHookConfigurationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&admissionregistration.ExternalAdmissionHookConfiguration{}, newExternalAdmissionHookConfigurationInformer)
}
func (f *externalAdmissionHookConfigurationInformer) Lister() internalversion.ExternalAdmissionHookConfigurationLister {
return internalversion.NewExternalAdmissionHookConfigurationLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,68 @@
/*
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.
*/
// This file was automatically generated by informer-gen
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
internalclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
internalversion "k8s.io/kubernetes/pkg/client/listers/admissionregistration/internalversion"
time "time"
)
// InitializerConfigurationInformer provides access to a shared informer and lister for
// InitializerConfigurations.
type InitializerConfigurationInformer interface {
Informer() cache.SharedIndexInformer
Lister() internalversion.InitializerConfigurationLister
}
type initializerConfigurationInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newInitializerConfigurationInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.Admissionregistration().InitializerConfigurations(v1.NamespaceAll).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.Admissionregistration().InitializerConfigurations(v1.NamespaceAll).Watch(options)
},
},
&admissionregistration.InitializerConfiguration{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *initializerConfigurationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&admissionregistration.InitializerConfiguration{}, newInitializerConfigurationInformer)
}
func (f *initializerConfigurationInformer) Lister() internalversion.InitializerConfigurationLister {
return internalversion.NewInitializerConfigurationLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,50 @@
/*
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.
*/
// This file was automatically generated by informer-gen
package internalversion
import (
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// ExternalAdmissionHookConfigurations returns a ExternalAdmissionHookConfigurationInformer.
ExternalAdmissionHookConfigurations() ExternalAdmissionHookConfigurationInformer
// InitializerConfigurations returns a InitializerConfigurationInformer.
InitializerConfigurations() InitializerConfigurationInformer
}
type version struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f}
}
// ExternalAdmissionHookConfigurations returns a ExternalAdmissionHookConfigurationInformer.
func (v *version) ExternalAdmissionHookConfigurations() ExternalAdmissionHookConfigurationInformer {
return &externalAdmissionHookConfigurationInformer{factory: v.SharedInformerFactory}
}
// InitializerConfigurations returns a InitializerConfigurationInformer.
func (v *version) InitializerConfigurations() InitializerConfigurationInformer {
return &initializerConfigurationInformer{factory: v.SharedInformerFactory}
}

View File

@ -23,6 +23,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
internalclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
admissionregistration "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/admissionregistration"
apps "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/apps"
autoscaling "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/autoscaling"
batch "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/batch"
@ -119,6 +120,7 @@ type SharedInformerFactory interface {
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
Admissionregistration() admissionregistration.Interface
Apps() apps.Interface
Autoscaling() autoscaling.Interface
Batch() batch.Interface
@ -131,6 +133,10 @@ type SharedInformerFactory interface {
Storage() storage.Interface
}
func (f *sharedInformerFactory) Admissionregistration() admissionregistration.Interface {
return admissionregistration.New(f)
}
func (f *sharedInformerFactory) Apps() apps.Interface {
return apps.New(f)
}

View File

@ -23,6 +23,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
api "k8s.io/kubernetes/pkg/api"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
apps "k8s.io/kubernetes/pkg/apis/apps"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
batch "k8s.io/kubernetes/pkg/apis/batch"
@ -60,7 +61,13 @@ func (f *genericInformer) Lister() cache.GenericLister {
// TODO extend this to unknown resources with a client pool
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=Apps, Version=InternalVersion
// Group=Admissionregistration, Version=InternalVersion
case admissionregistration.SchemeGroupVersion.WithResource("externaladmissionhookconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().InternalVersion().ExternalAdmissionHookConfigurations().Informer()}, nil
case admissionregistration.SchemeGroupVersion.WithResource("initializerconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().InternalVersion().InitializerConfigurations().Informer()}, nil
// Group=Apps, Version=InternalVersion
case apps.SchemeGroupVersion.WithResource("controllerrevisions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().InternalVersion().ControllerRevisions().Informer()}, nil
case apps.SchemeGroupVersion.WithResource("statefulsets"):

View File

@ -0,0 +1,37 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"expansion_generated.go",
"externaladmissionhookconfiguration.go",
"initializerconfiguration.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,35 @@
/*
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.
*/
// This file was automatically generated by lister-gen
package internalversion
// ExternalAdmissionHookConfigurationListerExpansion allows custom methods to be added to
// ExternalAdmissionHookConfigurationLister.
type ExternalAdmissionHookConfigurationListerExpansion interface{}
// ExternalAdmissionHookConfigurationNamespaceListerExpansion allows custom methods to be added to
// ExternalAdmissionHookConfigurationNamespaceLister.
type ExternalAdmissionHookConfigurationNamespaceListerExpansion interface{}
// InitializerConfigurationListerExpansion allows custom methods to be added to
// InitializerConfigurationLister.
type InitializerConfigurationListerExpansion interface{}
// InitializerConfigurationNamespaceListerExpansion allows custom methods to be added to
// InitializerConfigurationNamespaceLister.
type InitializerConfigurationNamespaceListerExpansion interface{}

View File

@ -0,0 +1,94 @@
/*
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.
*/
// This file was automatically generated by lister-gen
package internalversion
import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
)
// ExternalAdmissionHookConfigurationLister helps list ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationLister interface {
// List lists all ExternalAdmissionHookConfigurations in the indexer.
List(selector labels.Selector) (ret []*admissionregistration.ExternalAdmissionHookConfiguration, err error)
// ExternalAdmissionHookConfigurations returns an object that can list and get ExternalAdmissionHookConfigurations.
ExternalAdmissionHookConfigurations(namespace string) ExternalAdmissionHookConfigurationNamespaceLister
ExternalAdmissionHookConfigurationListerExpansion
}
// externalAdmissionHookConfigurationLister implements the ExternalAdmissionHookConfigurationLister interface.
type externalAdmissionHookConfigurationLister struct {
indexer cache.Indexer
}
// NewExternalAdmissionHookConfigurationLister returns a new ExternalAdmissionHookConfigurationLister.
func NewExternalAdmissionHookConfigurationLister(indexer cache.Indexer) ExternalAdmissionHookConfigurationLister {
return &externalAdmissionHookConfigurationLister{indexer: indexer}
}
// List lists all ExternalAdmissionHookConfigurations in the indexer.
func (s *externalAdmissionHookConfigurationLister) List(selector labels.Selector) (ret []*admissionregistration.ExternalAdmissionHookConfiguration, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*admissionregistration.ExternalAdmissionHookConfiguration))
})
return ret, err
}
// ExternalAdmissionHookConfigurations returns an object that can list and get ExternalAdmissionHookConfigurations.
func (s *externalAdmissionHookConfigurationLister) ExternalAdmissionHookConfigurations(namespace string) ExternalAdmissionHookConfigurationNamespaceLister {
return externalAdmissionHookConfigurationNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ExternalAdmissionHookConfigurationNamespaceLister helps list and get ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationNamespaceLister interface {
// List lists all ExternalAdmissionHookConfigurations in the indexer for a given namespace.
List(selector labels.Selector) (ret []*admissionregistration.ExternalAdmissionHookConfiguration, err error)
// Get retrieves the ExternalAdmissionHookConfiguration from the indexer for a given namespace and name.
Get(name string) (*admissionregistration.ExternalAdmissionHookConfiguration, error)
ExternalAdmissionHookConfigurationNamespaceListerExpansion
}
// externalAdmissionHookConfigurationNamespaceLister implements the ExternalAdmissionHookConfigurationNamespaceLister
// interface.
type externalAdmissionHookConfigurationNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ExternalAdmissionHookConfigurations in the indexer for a given namespace.
func (s externalAdmissionHookConfigurationNamespaceLister) List(selector labels.Selector) (ret []*admissionregistration.ExternalAdmissionHookConfiguration, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*admissionregistration.ExternalAdmissionHookConfiguration))
})
return ret, err
}
// Get retrieves the ExternalAdmissionHookConfiguration from the indexer for a given namespace and name.
func (s externalAdmissionHookConfigurationNamespaceLister) Get(name string) (*admissionregistration.ExternalAdmissionHookConfiguration, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(admissionregistration.Resource("externaladmissionhookconfiguration"), name)
}
return obj.(*admissionregistration.ExternalAdmissionHookConfiguration), nil
}

View File

@ -0,0 +1,94 @@
/*
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.
*/
// This file was automatically generated by lister-gen
package internalversion
import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
admissionregistration "k8s.io/kubernetes/pkg/apis/admissionregistration"
)
// InitializerConfigurationLister helps list InitializerConfigurations.
type InitializerConfigurationLister interface {
// List lists all InitializerConfigurations in the indexer.
List(selector labels.Selector) (ret []*admissionregistration.InitializerConfiguration, err error)
// InitializerConfigurations returns an object that can list and get InitializerConfigurations.
InitializerConfigurations(namespace string) InitializerConfigurationNamespaceLister
InitializerConfigurationListerExpansion
}
// initializerConfigurationLister implements the InitializerConfigurationLister interface.
type initializerConfigurationLister struct {
indexer cache.Indexer
}
// NewInitializerConfigurationLister returns a new InitializerConfigurationLister.
func NewInitializerConfigurationLister(indexer cache.Indexer) InitializerConfigurationLister {
return &initializerConfigurationLister{indexer: indexer}
}
// List lists all InitializerConfigurations in the indexer.
func (s *initializerConfigurationLister) List(selector labels.Selector) (ret []*admissionregistration.InitializerConfiguration, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*admissionregistration.InitializerConfiguration))
})
return ret, err
}
// InitializerConfigurations returns an object that can list and get InitializerConfigurations.
func (s *initializerConfigurationLister) InitializerConfigurations(namespace string) InitializerConfigurationNamespaceLister {
return initializerConfigurationNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// InitializerConfigurationNamespaceLister helps list and get InitializerConfigurations.
type InitializerConfigurationNamespaceLister interface {
// List lists all InitializerConfigurations in the indexer for a given namespace.
List(selector labels.Selector) (ret []*admissionregistration.InitializerConfiguration, err error)
// Get retrieves the InitializerConfiguration from the indexer for a given namespace and name.
Get(name string) (*admissionregistration.InitializerConfiguration, error)
InitializerConfigurationNamespaceListerExpansion
}
// initializerConfigurationNamespaceLister implements the InitializerConfigurationNamespaceLister
// interface.
type initializerConfigurationNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all InitializerConfigurations in the indexer for a given namespace.
func (s initializerConfigurationNamespaceLister) List(selector labels.Selector) (ret []*admissionregistration.InitializerConfiguration, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*admissionregistration.InitializerConfiguration))
})
return ret, err
}
// Get retrieves the InitializerConfiguration from the indexer for a given namespace and name.
func (s initializerConfigurationNamespaceLister) Get(name string) (*admissionregistration.InitializerConfiguration, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(admissionregistration.Resource("initializerconfiguration"), name)
}
return obj.(*admissionregistration.InitializerConfiguration), nil
}

View File

@ -0,0 +1,37 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"expansion_generated.go",
"externaladmissionhookconfiguration.go",
"initializerconfiguration.go",
],
tags = ["automanaged"],
deps = [
"//pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -0,0 +1,35 @@
/*
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.
*/
// This file was automatically generated by lister-gen
package v1alpha1
// ExternalAdmissionHookConfigurationListerExpansion allows custom methods to be added to
// ExternalAdmissionHookConfigurationLister.
type ExternalAdmissionHookConfigurationListerExpansion interface{}
// ExternalAdmissionHookConfigurationNamespaceListerExpansion allows custom methods to be added to
// ExternalAdmissionHookConfigurationNamespaceLister.
type ExternalAdmissionHookConfigurationNamespaceListerExpansion interface{}
// InitializerConfigurationListerExpansion allows custom methods to be added to
// InitializerConfigurationLister.
type InitializerConfigurationListerExpansion interface{}
// InitializerConfigurationNamespaceListerExpansion allows custom methods to be added to
// InitializerConfigurationNamespaceLister.
type InitializerConfigurationNamespaceListerExpansion interface{}

View File

@ -0,0 +1,94 @@
/*
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.
*/
// This file was automatically generated by lister-gen
package v1alpha1
import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
v1alpha1 "k8s.io/kubernetes/pkg/apis/admissionregistration/v1alpha1"
)
// ExternalAdmissionHookConfigurationLister helps list ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationLister interface {
// List lists all ExternalAdmissionHookConfigurations in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.ExternalAdmissionHookConfiguration, err error)
// ExternalAdmissionHookConfigurations returns an object that can list and get ExternalAdmissionHookConfigurations.
ExternalAdmissionHookConfigurations(namespace string) ExternalAdmissionHookConfigurationNamespaceLister
ExternalAdmissionHookConfigurationListerExpansion
}
// externalAdmissionHookConfigurationLister implements the ExternalAdmissionHookConfigurationLister interface.
type externalAdmissionHookConfigurationLister struct {
indexer cache.Indexer
}
// NewExternalAdmissionHookConfigurationLister returns a new ExternalAdmissionHookConfigurationLister.
func NewExternalAdmissionHookConfigurationLister(indexer cache.Indexer) ExternalAdmissionHookConfigurationLister {
return &externalAdmissionHookConfigurationLister{indexer: indexer}
}
// List lists all ExternalAdmissionHookConfigurations in the indexer.
func (s *externalAdmissionHookConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.ExternalAdmissionHookConfiguration, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.ExternalAdmissionHookConfiguration))
})
return ret, err
}
// ExternalAdmissionHookConfigurations returns an object that can list and get ExternalAdmissionHookConfigurations.
func (s *externalAdmissionHookConfigurationLister) ExternalAdmissionHookConfigurations(namespace string) ExternalAdmissionHookConfigurationNamespaceLister {
return externalAdmissionHookConfigurationNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ExternalAdmissionHookConfigurationNamespaceLister helps list and get ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationNamespaceLister interface {
// List lists all ExternalAdmissionHookConfigurations in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1alpha1.ExternalAdmissionHookConfiguration, err error)
// Get retrieves the ExternalAdmissionHookConfiguration from the indexer for a given namespace and name.
Get(name string) (*v1alpha1.ExternalAdmissionHookConfiguration, error)
ExternalAdmissionHookConfigurationNamespaceListerExpansion
}
// externalAdmissionHookConfigurationNamespaceLister implements the ExternalAdmissionHookConfigurationNamespaceLister
// interface.
type externalAdmissionHookConfigurationNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ExternalAdmissionHookConfigurations in the indexer for a given namespace.
func (s externalAdmissionHookConfigurationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ExternalAdmissionHookConfiguration, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.ExternalAdmissionHookConfiguration))
})
return ret, err
}
// Get retrieves the ExternalAdmissionHookConfiguration from the indexer for a given namespace and name.
func (s externalAdmissionHookConfigurationNamespaceLister) Get(name string) (*v1alpha1.ExternalAdmissionHookConfiguration, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("externaladmissionhookconfiguration"), name)
}
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), nil
}

Some files were not shown because too many files have changed in this diff Show More