mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
move admission/v1alpha1 to k8s.io/api
This commit is contained in:
parent
ebf24c14a9
commit
57a96ca40a
@ -91,9 +91,9 @@ func New() *Generator {
|
|||||||
`k8s.io/api/storage/v1beta1`,
|
`k8s.io/api/storage/v1beta1`,
|
||||||
`k8s.io/api/storage/v1`,
|
`k8s.io/api/storage/v1`,
|
||||||
`k8s.io/api/admissionregistration/v1alpha1`,
|
`k8s.io/api/admissionregistration/v1alpha1`,
|
||||||
|
`k8s.io/api/admission/v1alpha1`,
|
||||||
`k8s.io/api/networking/v1`,
|
`k8s.io/api/networking/v1`,
|
||||||
`k8s.io/kubernetes/federation/apis/federation/v1beta1`,
|
`k8s.io/kubernetes/federation/apis/federation/v1beta1`,
|
||||||
`k8s.io/kubernetes/pkg/apis/admission/v1alpha1`,
|
|
||||||
`k8s.io/metrics/pkg/apis/metrics/v1alpha1`,
|
`k8s.io/metrics/pkg/apis/metrics/v1alpha1`,
|
||||||
`k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1`,
|
`k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1`,
|
||||||
`k8s.io/apiserver/pkg/apis/audit/v1alpha1`,
|
`k8s.io/apiserver/pkg/apis/audit/v1alpha1`,
|
||||||
|
@ -38,7 +38,7 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||||||
&announced.GroupMetaFactoryArgs{
|
&announced.GroupMetaFactoryArgs{
|
||||||
GroupName: admission.GroupName,
|
GroupName: admission.GroupName,
|
||||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||||
ImportPrefix: "k8s.io/kubernetes/pkg/apis/admission",
|
ImportPrefix: "k8s.io/api/admission",
|
||||||
RootScopedKinds: sets.NewString("AdmissionReview"),
|
RootScopedKinds: sets.NewString("AdmissionReview"),
|
||||||
AddInternalObjectsToScheme: admission.AddToScheme,
|
AddInternalObjectsToScheme: admission.AddToScheme,
|
||||||
},
|
},
|
||||||
|
@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +k8s:deepcopy-gen=package,register
|
|
||||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/admission
|
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/admission
|
||||||
// +k8s:openapi-gen=false
|
// +k8s:conversion-gen-external-types=../../../../vendor/k8s.io/api/admission/v1alpha1
|
||||||
// +k8s:defaulter-gen=TypeMeta
|
// +k8s:defaulter-gen=TypeMeta
|
||||||
|
// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/admission/v1alpha1
|
||||||
|
|
||||||
// +groupName=admission.k8s.io
|
// +groupName=admission.k8s.io
|
||||||
package v1alpha1 // import "k8s.io/kubernetes/pkg/apis/admission/v1alpha1"
|
package v1alpha1 // import "k8s.io/kubernetes/pkg/apis/admission/v1alpha1"
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
admissionv1alpha1 "k8s.io/api/admission/v1alpha1"
|
||||||
authenticationv1 "k8s.io/api/authentication/v1"
|
authenticationv1 "k8s.io/api/authentication/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@ -24,7 +25,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NewAdmissionReview returns an AdmissionReview for the provided admission.Attributes
|
// NewAdmissionReview returns an AdmissionReview for the provided admission.Attributes
|
||||||
func NewAdmissionReview(attr admission.Attributes) AdmissionReview {
|
func NewAdmissionReview(attr admission.Attributes) admissionv1alpha1.AdmissionReview {
|
||||||
gvk := attr.GetKind()
|
gvk := attr.GetKind()
|
||||||
gvr := attr.GetResource()
|
gvr := attr.GetResource()
|
||||||
aUserInfo := attr.GetUserInfo()
|
aUserInfo := attr.GetUserInfo()
|
||||||
@ -40,8 +41,8 @@ func NewAdmissionReview(attr admission.Attributes) AdmissionReview {
|
|||||||
userInfo.Extra[key] = authenticationv1.ExtraValue(val)
|
userInfo.Extra[key] = authenticationv1.ExtraValue(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
return AdmissionReview{
|
return admissionv1alpha1.AdmissionReview{
|
||||||
Spec: AdmissionReviewSpec{
|
Spec: admissionv1alpha1.AdmissionReviewSpec{
|
||||||
Name: attr.GetName(),
|
Name: attr.GetName(),
|
||||||
Namespace: attr.GetNamespace(),
|
Namespace: attr.GetNamespace(),
|
||||||
Resource: metav1.GroupVersionResource{
|
Resource: metav1.GroupVersionResource{
|
||||||
|
@ -17,8 +17,7 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
admissionv1alpha1 "k8s.io/api/admission/v1alpha1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,10 +33,7 @@ func Resource(resource string) schema.GroupResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
localSchemeBuilder = &admissionv1alpha1.SchemeBuilder
|
||||||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
|
||||||
SchemeBuilder runtime.SchemeBuilder
|
|
||||||
localSchemeBuilder = &SchemeBuilder
|
|
||||||
AddToScheme = localSchemeBuilder.AddToScheme
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -45,14 +41,5 @@ func init() {
|
|||||||
// We only register manually written functions here. The registration of the
|
// We only register manually written functions here. The registration of the
|
||||||
// generated functions takes place in the generated files. The separation
|
// generated functions takes place in the generated files. The separation
|
||||||
// makes the code compile even when the generated files are missing.
|
// makes the code compile even when the generated files are missing.
|
||||||
localSchemeBuilder.Register(addKnownTypes, RegisterDefaults)
|
localSchemeBuilder.Register(RegisterDefaults)
|
||||||
}
|
|
||||||
|
|
||||||
// Adds the list of known types to api.Scheme.
|
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
|
||||||
&AdmissionReview{},
|
|
||||||
)
|
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
|
||||||
|
admissionv1alpha1 "k8s.io/api/admission/v1alpha1"
|
||||||
"k8s.io/api/admissionregistration/v1alpha1"
|
"k8s.io/api/admissionregistration/v1alpha1"
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -38,7 +39,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
admissionv1alpha1 "k8s.io/kubernetes/pkg/apis/admission/v1alpha1"
|
admissionv1alpha1helper "k8s.io/kubernetes/pkg/apis/admission/v1alpha1"
|
||||||
admissioninit "k8s.io/kubernetes/pkg/kubeapiserver/admission"
|
admissioninit "k8s.io/kubernetes/pkg/kubeapiserver/admission"
|
||||||
"k8s.io/kubernetes/pkg/kubeapiserver/admission/configuration"
|
"k8s.io/kubernetes/pkg/kubeapiserver/admission/configuration"
|
||||||
|
|
||||||
@ -213,7 +214,7 @@ func (a *GenericAdmissionWebhook) callHook(ctx context.Context, h *v1alpha1.Exte
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make the webhook request
|
// Make the webhook request
|
||||||
request := admissionv1alpha1.NewAdmissionReview(attr)
|
request := admissionv1alpha1helper.NewAdmissionReview(attr)
|
||||||
client, err := a.hookClient(h)
|
client, err := a.hookClient(h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &ErrCallingWebhook{WebhookName: h.Name, Reason: err}
|
return &ErrCallingWebhook{WebhookName: h.Name, Reason: err}
|
||||||
|
@ -27,12 +27,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/api/admission/v1alpha1"
|
||||||
registrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
registrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apiserver/pkg/admission"
|
"k8s.io/apiserver/pkg/admission"
|
||||||
"k8s.io/apiserver/pkg/authentication/user"
|
"k8s.io/apiserver/pkg/authentication/user"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/apis/admission/v1alpha1"
|
|
||||||
|
|
||||||
_ "k8s.io/kubernetes/pkg/apis/admission/install"
|
_ "k8s.io/kubernetes/pkg/apis/admission/install"
|
||||||
)
|
)
|
||||||
|
21
staging/src/k8s.io/api/admission/v1alpha1/doc.go
Normal file
21
staging/src/k8s.io/api/admission/v1alpha1/doc.go
Normal 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen=package,register
|
||||||
|
// +k8s:openapi-gen=false
|
||||||
|
|
||||||
|
// +groupName=admission.k8s.io
|
||||||
|
package v1alpha1 // import "k8s.io/api/admission/v1alpha1"
|
51
staging/src/k8s.io/api/admission/v1alpha1/register.go
Normal file
51
staging/src/k8s.io/api/admission/v1alpha1/register.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupName is the group name for this API.
|
||||||
|
const GroupName = "admission.k8s.io"
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
// Adds the list of known types to api.Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&AdmissionReview{},
|
||||||
|
)
|
||||||
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user