Skip to content

Commit

Permalink
Merge pull request #80231 from liggitt/admissionreview-v1
Browse files Browse the repository at this point in the history
Promote admissionreview to v1
  • Loading branch information
k8s-ci-robot committed Aug 2, 2019
2 parents e857ae0 + 308c23c commit c981c65
Show file tree
Hide file tree
Showing 52 changed files with 4,120 additions and 96 deletions.
10 changes: 10 additions & 0 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions build/kazel_generated.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ kazel_configured_tags = ["openapi-gen"]
# tags_values_pkgs is a dictionary mapping {k8s build tag: {tag value: [pkgs including that tag:value]}}
tags_values_pkgs = {"openapi-gen": {
"false": [
"staging/src/k8s.io/api/admission/v1",
"staging/src/k8s.io/api/admission/v1beta1",
"staging/src/k8s.io/api/core/v1",
"staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1",
Expand Down Expand Up @@ -114,6 +115,7 @@ tags_pkgs_values = {"openapi-gen": {
"pkg/apis/abac/v1beta1": ["true"],
"pkg/apis/auditregistration": ["true"],
"pkg/version": ["true"],
"staging/src/k8s.io/api/admission/v1": ["false"],
"staging/src/k8s.io/api/admission/v1beta1": ["false"],
"staging/src/k8s.io/api/admissionregistration/v1": ["true"],
"staging/src/k8s.io/api/admissionregistration/v1beta1": ["true"],
Expand Down
1 change: 1 addition & 0 deletions hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ plugin/pkg/admission/resourcequota/apis/resourcequota/v1beta1
plugin/pkg/auth/authorizer/node
plugin/pkg/auth/authorizer/rbac
plugin/pkg/auth/authorizer/rbac/bootstrappolicy
staging/src/k8s.io/api/admission/v1
staging/src/k8s.io/api/admission/v1beta1
staging/src/k8s.io/api/admissionregistration/v1
staging/src/k8s.io/api/admissionregistration/v1beta1
Expand Down
1 change: 1 addition & 0 deletions hack/.import-aliases
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"k8s.io/api/admissionregistration/v1": "admissionregistrationv1",
"k8s.io/api/admissionregistration/v1beta1": "admissionregistrationv1beta1",
"k8s.io/api/admission/v1beta1": "admissionv1beta1",
"k8s.io/api/admission/v1": "admissionv1",
"k8s.io/api/apps/v1": "appsv1",
"k8s.io/api/apps/v1beta1": "appsv1beta1",
"k8s.io/api/apps/v1beta2": "appsv1beta2",
Expand Down
2 changes: 2 additions & 0 deletions hack/lib/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ KUBE_AVAILABLE_GROUP_VERSIONS="${KUBE_AVAILABLE_GROUP_VERSIONS:-\
v1 \
admissionregistration.k8s.io/v1 \
admissionregistration.k8s.io/v1beta1 \
admission.k8s.io/v1 \
admission.k8s.io/v1beta1 \
apps/v1 \
apps/v1beta1 \
Expand Down Expand Up @@ -110,6 +111,7 @@ KUBE_NONSERVER_GROUP_VERSIONS="
abac.authorization.kubernetes.io/v1beta1 \
componentconfig/v1alpha1 \
imagepolicy.k8s.io/v1alpha1\
admission.k8s.io/v1\
admission.k8s.io/v1beta1\
"
export KUBE_NONSERVER_GROUP_VERSIONS
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/admission/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ filegroup(
":package-srcs",
"//pkg/apis/admission/fuzzer:all-srcs",
"//pkg/apis/admission/install:all-srcs",
"//pkg/apis/admission/v1:all-srcs",
"//pkg/apis/admission/v1beta1:all-srcs",
],
tags = ["automanaged"],
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/admission/install/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ go_library(
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/admission:go_default_library",
"//pkg/apis/admission/v1:go_default_library",
"//pkg/apis/admission/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
Expand Down
4 changes: 3 additions & 1 deletion pkg/apis/admission/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/admission"
v1 "k8s.io/kubernetes/pkg/apis/admission/v1"
"k8s.io/kubernetes/pkg/apis/admission/v1beta1"
)

Expand All @@ -34,5 +35,6 @@ func init() {
func Install(scheme *runtime.Scheme) {
utilruntime.Must(admission.AddToScheme(scheme))
utilruntime.Must(v1beta1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion))
utilruntime.Must(v1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion, v1beta1.SchemeGroupVersion))
}
4 changes: 2 additions & 2 deletions pkg/apis/admission/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ type AdmissionRequest struct {
Operation Operation
// UserInfo is information about the requesting user
UserInfo authentication.UserInfo
// Object is the object from the incoming request prior to default values being applied
// Object is the object from the incoming request.
// +optional
Object runtime.Object
// OldObject is the existing object. Only populated for UPDATE requests.
// OldObject is the existing object. Only populated for DELETE and UPDATE requests.
// +optional
OldObject runtime.Object
// DryRun indicates that modifications will definitely not be persisted for this request.
Expand Down
39 changes: 39 additions & 0 deletions pkg/apis/admission/v1/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package(default_visibility = ["//visibility:public"])

load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)

go_library(
name = "go_default_library",
srcs = [
"doc.go",
"register.go",
"zz_generated.conversion.go",
"zz_generated.defaults.go",
],
importpath = "k8s.io/kubernetes/pkg/apis/admission/v1",
deps = [
"//pkg/apis/admission:go_default_library",
"//staging/src/k8s.io/api/admission/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/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"],
)
24 changes: 24 additions & 0 deletions pkg/apis/admission/v1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/admission
// +k8s:conversion-gen-external-types=k8s.io/api/admission/v1
// +k8s:defaulter-gen=TypeMeta
// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/admission/v1

// +groupName=admission.k8s.io

package v1 // import "k8s.io/kubernetes/pkg/apis/admission/v1"
46 changes: 46 additions & 0 deletions pkg/apis/admission/v1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Copyright 2019 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 v1

import (
admissionv1 "k8s.io/api/admission/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)

// GroupName is the group name for this API.
const GroupName = "admission.k8s.io"

// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

var (
localSchemeBuilder = &admissionv1.SchemeBuilder
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme
AddToScheme = localSchemeBuilder.AddToScheme
)

func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(RegisterDefaults)
}
Loading

0 comments on commit c981c65

Please sign in to comment.