k8s.io/apiserver@v0.31.1/pkg/admission/initializer/interfaces.go (about) 1 /* 2 Copyright 2017 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package initializer 18 19 import ( 20 "k8s.io/apimachinery/pkg/api/meta" 21 "k8s.io/apimachinery/pkg/runtime/schema" 22 "k8s.io/apiserver/pkg/admission" 23 "k8s.io/apiserver/pkg/authorization/authorizer" 24 "k8s.io/apiserver/pkg/cel/openapi/resolver" 25 quota "k8s.io/apiserver/pkg/quota/v1" 26 "k8s.io/client-go/dynamic" 27 "k8s.io/client-go/informers" 28 "k8s.io/client-go/kubernetes" 29 "k8s.io/component-base/featuregate" 30 ) 31 32 // WantsExternalKubeClientSet defines a function which sets external ClientSet for admission plugins that need it 33 type WantsExternalKubeClientSet interface { 34 SetExternalKubeClientSet(kubernetes.Interface) 35 admission.InitializationValidator 36 } 37 38 // WantsExternalKubeInformerFactory defines a function which sets InformerFactory for admission plugins that need it 39 type WantsExternalKubeInformerFactory interface { 40 SetExternalKubeInformerFactory(informers.SharedInformerFactory) 41 admission.InitializationValidator 42 } 43 44 // WantsAuthorizer defines a function which sets Authorizer for admission plugins that need it. 45 type WantsAuthorizer interface { 46 SetAuthorizer(authorizer.Authorizer) 47 admission.InitializationValidator 48 } 49 50 // WantsQuotaConfiguration defines a function which sets quota configuration for admission plugins that need it. 51 type WantsQuotaConfiguration interface { 52 SetQuotaConfiguration(quota.Configuration) 53 admission.InitializationValidator 54 } 55 56 // WantsDrainedNotification defines a function which sets the notification of where the apiserver 57 // has already been drained for admission plugins that need it. 58 // After receiving that notification, Admit/Validate calls won't be called anymore. 59 type WantsDrainedNotification interface { 60 SetDrainedNotification(<-chan struct{}) 61 admission.InitializationValidator 62 } 63 64 // WantsFeatureGate defines a function which passes the featureGates for inspection by an admission plugin. 65 // Admission plugins should not hold a reference to the featureGates. Instead, they should query a particular one 66 // and assign it to a simple bool in the admission plugin struct. 67 // 68 // func (a *admissionPlugin) InspectFeatureGates(features featuregate.FeatureGate){ 69 // a.myFeatureIsOn = features.Enabled("my-feature") 70 // } 71 type WantsFeatures interface { 72 InspectFeatureGates(featuregate.FeatureGate) 73 admission.InitializationValidator 74 } 75 76 type WantsDynamicClient interface { 77 SetDynamicClient(dynamic.Interface) 78 admission.InitializationValidator 79 } 80 81 // WantsRESTMapper defines a function which sets RESTMapper for admission plugins that need it. 82 type WantsRESTMapper interface { 83 SetRESTMapper(meta.RESTMapper) 84 admission.InitializationValidator 85 } 86 87 // WantsSchemaResolver defines a function which sets the SchemaResolver for 88 // an admission plugin that needs it. 89 type WantsSchemaResolver interface { 90 SetSchemaResolver(resolver resolver.SchemaResolver) 91 admission.InitializationValidator 92 } 93 94 // WantsExcludedAdmissionResources defines a function which sets the ExcludedAdmissionResources 95 // for an admission plugin that needs it. 96 type WantsExcludedAdmissionResources interface { 97 SetExcludedAdmissionResources(excludedAdmissionResources []schema.GroupResource) 98 admission.InitializationValidator 99 }