Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
aedcf681
Commit
aedcf681
authored
Oct 27, 2017
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
admission: rename Validate{ -> Initialization}, Validat{ingAdmit -> e}
parent
2452afff
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
76 additions
and
77 deletions
+76
-77
initializer.go
pkg/kubeapiserver/admission/initializer.go
+4
-4
admission.go
plugin/pkg/admission/admit/admission.go
+2
-2
admission.go
plugin/pkg/admission/exec/admission.go
+2
-2
admission_test.go
plugin/pkg/admission/exec/admission_test.go
+1
-1
gc_admission.go
plugin/pkg/admission/gc/gc_admission.go
+1
-1
admission.go
plugin/pkg/admission/limitranger/admission.go
+1
-1
admission_test.go
plugin/pkg/admission/limitranger/admission_test.go
+1
-1
admission.go
plugin/pkg/admission/namespace/autoprovision/admission.go
+2
-2
admission_test.go
...n/pkg/admission/namespace/autoprovision/admission_test.go
+1
-1
admission.go
plugin/pkg/admission/namespace/exists/admission.go
+2
-2
admission_test.go
plugin/pkg/admission/namespace/exists/admission_test.go
+1
-1
admission.go
plugin/pkg/admission/noderestriction/admission.go
+1
-1
admission.go
plugin/pkg/admission/persistentvolume/resize/admission.go
+2
-2
admission.go
plugin/pkg/admission/podnodeselector/admission.go
+1
-1
admission_test.go
plugin/pkg/admission/podnodeselector/admission_test.go
+1
-1
admission.go
plugin/pkg/admission/podpreset/admission.go
+1
-1
admission.go
plugin/pkg/admission/podtolerationrestriction/admission.go
+1
-1
admission_test.go
.../pkg/admission/podtolerationrestriction/admission_test.go
+1
-1
admission.go
plugin/pkg/admission/priority/admission.go
+2
-2
admission.go
plugin/pkg/admission/resourcequota/admission.go
+2
-2
admission.go
plugin/pkg/admission/security/podsecuritypolicy/admission.go
+2
-2
admission.go
plugin/pkg/admission/serviceaccount/admission.go
+2
-2
admission.go
plugin/pkg/admission/storageclass/setdefault/admission.go
+2
-2
chain.go
staging/src/k8s.io/apiserver/pkg/admission/chain.go
+3
-3
initializer_test.go
...o/apiserver/pkg/admission/initializer/initializer_test.go
+5
-5
interfaces.go
.../k8s.io/apiserver/pkg/admission/initializer/interfaces.go
+4
-4
interfaces.go
staging/src/k8s.io/apiserver/pkg/admission/interfaces.go
+6
-6
initialization.go
...ver/pkg/admission/plugin/initialization/initialization.go
+2
-2
admission.go
...ver/pkg/admission/plugin/namespace/lifecycle/admission.go
+2
-2
admission_test.go
...kg/admission/plugin/namespace/lifecycle/admission_test.go
+1
-1
admission.go
...8s.io/apiserver/pkg/admission/plugin/webhook/admission.go
+2
-3
plugins.go
staging/src/k8s.io/apiserver/pkg/admission/plugins.go
+6
-6
delete.go
...ing/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go
+2
-2
create.go
staging/src/k8s.io/apiserver/pkg/registry/rest/create.go
+1
-1
update.go
staging/src/k8s.io/apiserver/pkg/registry/rest/update.go
+1
-1
admission.go
...le-apiserver/pkg/admission/plugin/banflunder/admission.go
+2
-2
admission_test.go
...iserver/pkg/admission/plugin/banflunder/admission_test.go
+1
-1
interfaces.go
...e-apiserver/pkg/admission/wardleinitializer/interfaces.go
+1
-1
wardleinitializer_test.go
...pkg/admission/wardleinitializer/wardleinitializer_test.go
+1
-1
No files found.
pkg/kubeapiserver/admission/initializer.go
View file @
aedcf681
...
@@ -34,13 +34,13 @@ import (
...
@@ -34,13 +34,13 @@ import (
// WantsInternalKubeClientSet defines a function which sets ClientSet for admission plugins that need it
// WantsInternalKubeClientSet defines a function which sets ClientSet for admission plugins that need it
type
WantsInternalKubeClientSet
interface
{
type
WantsInternalKubeClientSet
interface
{
SetInternalKubeClientSet
(
internalclientset
.
Interface
)
SetInternalKubeClientSet
(
internalclientset
.
Interface
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
// WantsInternalKubeInformerFactory defines a function which sets InformerFactory for admission plugins that need it
// WantsInternalKubeInformerFactory defines a function which sets InformerFactory for admission plugins that need it
type
WantsInternalKubeInformerFactory
interface
{
type
WantsInternalKubeInformerFactory
interface
{
SetInternalKubeInformerFactory
(
informers
.
SharedInformerFactory
)
SetInternalKubeInformerFactory
(
informers
.
SharedInformerFactory
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
// WantsCloudConfig defines a function which sets CloudConfig for admission plugins that need it.
// WantsCloudConfig defines a function which sets CloudConfig for admission plugins that need it.
...
@@ -56,7 +56,7 @@ type WantsRESTMapper interface {
...
@@ -56,7 +56,7 @@ type WantsRESTMapper interface {
// WantsQuotaConfiguration defines a function which sets quota configuration for admission plugins that need it.
// WantsQuotaConfiguration defines a function which sets quota configuration for admission plugins that need it.
type
WantsQuotaConfiguration
interface
{
type
WantsQuotaConfiguration
interface
{
SetQuotaConfiguration
(
quota
.
Configuration
)
SetQuotaConfiguration
(
quota
.
Configuration
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
// WantsServiceResolver defines a fuction that accepts a ServiceResolver for
// WantsServiceResolver defines a fuction that accepts a ServiceResolver for
...
@@ -75,7 +75,7 @@ type ServiceResolver interface {
...
@@ -75,7 +75,7 @@ type ServiceResolver interface {
// to allow the apiserver to control what is returned as auth info
// to allow the apiserver to control what is returned as auth info
type
WantsAuthenticationInfoResolverWrapper
interface
{
type
WantsAuthenticationInfoResolverWrapper
interface
{
SetAuthenticationInfoResolverWrapper
(
webhook
.
AuthenticationInfoResolverWrapper
)
SetAuthenticationInfoResolverWrapper
(
webhook
.
AuthenticationInfoResolverWrapper
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
type
PluginInitializer
struct
{
type
PluginInitializer
struct
{
...
...
plugin/pkg/admission/admit/admission.go
View file @
aedcf681
...
@@ -38,8 +38,8 @@ func (AlwaysAdmit) Admit(a admission.Attributes) (err error) {
...
@@ -38,8 +38,8 @@ func (AlwaysAdmit) Admit(a admission.Attributes) (err error) {
return
nil
return
nil
}
}
// Validat
ingAdmit makes an admission decision based on the request attributes. It is NOT allowed to mutate
// Validat
e makes an admission decision based on the request attributes. It is NOT allowed to mutate.
func
(
AlwaysAdmit
)
Validat
ingAdmit
(
a
admission
.
Attributes
)
(
err
error
)
{
func
(
AlwaysAdmit
)
Validat
e
(
a
admission
.
Attributes
)
(
err
error
)
{
return
nil
return
nil
}
}
...
...
plugin/pkg/admission/exec/admission.go
View file @
aedcf681
...
@@ -135,8 +135,8 @@ func (d *DenyExec) SetInternalKubeClientSet(client internalclientset.Interface)
...
@@ -135,8 +135,8 @@ func (d *DenyExec) SetInternalKubeClientSet(client internalclientset.Interface)
d
.
client
=
client
d
.
client
=
client
}
}
// Validate
implements the
Validator interface.
// Validate
Initialization implements the Initialization
Validator interface.
func
(
d
*
DenyExec
)
Validate
()
error
{
func
(
d
*
DenyExec
)
Validate
Initialization
()
error
{
if
d
.
client
==
nil
{
if
d
.
client
==
nil
{
return
fmt
.
Errorf
(
"missing client"
)
return
fmt
.
Errorf
(
"missing client"
)
}
}
...
...
plugin/pkg/admission/exec/admission_test.go
View file @
aedcf681
...
@@ -118,7 +118,7 @@ func testAdmission(t *testing.T, pod *api.Pod, handler *DenyExec, shouldAccept b
...
@@ -118,7 +118,7 @@ func testAdmission(t *testing.T, pod *api.Pod, handler *DenyExec, shouldAccept b
})
})
handler
.
SetInternalKubeClientSet
(
mockClient
)
handler
.
SetInternalKubeClientSet
(
mockClient
)
admission
.
Validate
(
handler
)
admission
.
Validate
Initialization
(
handler
)
// pods/exec
// pods/exec
{
{
...
...
plugin/pkg/admission/gc/gc_admission.go
View file @
aedcf681
...
@@ -260,7 +260,7 @@ func (a *gcPermissionsEnforcement) SetRESTMapper(restMapper meta.RESTMapper) {
...
@@ -260,7 +260,7 @@ func (a *gcPermissionsEnforcement) SetRESTMapper(restMapper meta.RESTMapper) {
a
.
restMapper
=
restMapper
a
.
restMapper
=
restMapper
}
}
func
(
a
*
gcPermissionsEnforcement
)
Validate
()
error
{
func
(
a
*
gcPermissionsEnforcement
)
Validate
Initialization
()
error
{
if
a
.
authorizer
==
nil
{
if
a
.
authorizer
==
nil
{
return
fmt
.
Errorf
(
"missing authorizer"
)
return
fmt
.
Errorf
(
"missing authorizer"
)
}
}
...
...
plugin/pkg/admission/limitranger/admission.go
View file @
aedcf681
...
@@ -75,7 +75,7 @@ func (l *LimitRanger) SetInternalKubeInformerFactory(f informers.SharedInformerF
...
@@ -75,7 +75,7 @@ func (l *LimitRanger) SetInternalKubeInformerFactory(f informers.SharedInformerF
l
.
lister
=
limitRangeInformer
.
Lister
()
l
.
lister
=
limitRangeInformer
.
Lister
()
}
}
func
(
l
*
LimitRanger
)
Validate
()
error
{
func
(
l
*
LimitRanger
)
Validate
Initialization
()
error
{
if
l
.
lister
==
nil
{
if
l
.
lister
==
nil
{
return
fmt
.
Errorf
(
"missing limitRange lister"
)
return
fmt
.
Errorf
(
"missing limitRange lister"
)
}
}
...
...
plugin/pkg/admission/limitranger/admission_test.go
View file @
aedcf681
...
@@ -746,7 +746,7 @@ func newHandlerForTest(c clientset.Interface) (*LimitRanger, informers.SharedInf
...
@@ -746,7 +746,7 @@ func newHandlerForTest(c clientset.Interface) (*LimitRanger, informers.SharedInf
}
}
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
.
Initialize
(
handler
)
pluginInitializer
.
Initialize
(
handler
)
err
=
admission
.
Validate
(
handler
)
err
=
admission
.
Validate
Initialization
(
handler
)
return
handler
,
f
,
err
return
handler
,
f
,
err
}
}
...
...
plugin/pkg/admission/namespace/autoprovision/admission.go
View file @
aedcf681
...
@@ -106,8 +106,8 @@ func (p *Provision) SetInternalKubeInformerFactory(f informers.SharedInformerFac
...
@@ -106,8 +106,8 @@ func (p *Provision) SetInternalKubeInformerFactory(f informers.SharedInformerFac
p
.
SetReadyFunc
(
namespaceInformer
.
Informer
()
.
HasSynced
)
p
.
SetReadyFunc
(
namespaceInformer
.
Informer
()
.
HasSynced
)
}
}
// Validate
implements the
Validator interface.
// Validate
Initialization implements the Initialization
Validator interface.
func
(
p
*
Provision
)
Validate
()
error
{
func
(
p
*
Provision
)
Validate
Initialization
()
error
{
if
p
.
namespaceLister
==
nil
{
if
p
.
namespaceLister
==
nil
{
return
fmt
.
Errorf
(
"missing namespaceLister"
)
return
fmt
.
Errorf
(
"missing namespaceLister"
)
}
}
...
...
plugin/pkg/admission/namespace/autoprovision/admission_test.go
View file @
aedcf681
...
@@ -40,7 +40,7 @@ func newHandlerForTest(c clientset.Interface) (admission.MutationInterface, info
...
@@ -40,7 +40,7 @@ func newHandlerForTest(c clientset.Interface) (admission.MutationInterface, info
handler
:=
NewProvision
()
handler
:=
NewProvision
()
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
.
Initialize
(
handler
)
pluginInitializer
.
Initialize
(
handler
)
err
:=
admission
.
Validate
(
handler
)
err
:=
admission
.
Validate
Initialization
(
handler
)
return
handler
,
f
,
err
return
handler
,
f
,
err
}
}
...
...
plugin/pkg/admission/namespace/exists/admission.go
View file @
aedcf681
...
@@ -101,8 +101,8 @@ func (e *Exists) SetInternalKubeInformerFactory(f informers.SharedInformerFactor
...
@@ -101,8 +101,8 @@ func (e *Exists) SetInternalKubeInformerFactory(f informers.SharedInformerFactor
e
.
SetReadyFunc
(
namespaceInformer
.
Informer
()
.
HasSynced
)
e
.
SetReadyFunc
(
namespaceInformer
.
Informer
()
.
HasSynced
)
}
}
// Validate
implements the
Validator interface.
// Validate
Initialization implements the Initialization
Validator interface.
func
(
e
*
Exists
)
Validate
()
error
{
func
(
e
*
Exists
)
Validate
Initialization
()
error
{
if
e
.
namespaceLister
==
nil
{
if
e
.
namespaceLister
==
nil
{
return
fmt
.
Errorf
(
"missing namespaceLister"
)
return
fmt
.
Errorf
(
"missing namespaceLister"
)
}
}
...
...
plugin/pkg/admission/namespace/exists/admission_test.go
View file @
aedcf681
...
@@ -39,7 +39,7 @@ func newHandlerForTest(c clientset.Interface) (admission.MutationInterface, info
...
@@ -39,7 +39,7 @@ func newHandlerForTest(c clientset.Interface) (admission.MutationInterface, info
handler
:=
NewExists
()
handler
:=
NewExists
()
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
.
Initialize
(
handler
)
pluginInitializer
.
Initialize
(
handler
)
err
:=
admission
.
Validate
(
handler
)
err
:=
admission
.
Validate
Initialization
(
handler
)
return
handler
,
f
,
err
return
handler
,
f
,
err
}
}
...
...
plugin/pkg/admission/noderestriction/admission.go
View file @
aedcf681
...
@@ -69,7 +69,7 @@ func (p *nodePlugin) SetInternalKubeClientSet(f internalclientset.Interface) {
...
@@ -69,7 +69,7 @@ func (p *nodePlugin) SetInternalKubeClientSet(f internalclientset.Interface) {
p
.
podsGetter
=
f
.
Core
()
p
.
podsGetter
=
f
.
Core
()
}
}
func
(
p
*
nodePlugin
)
Validate
()
error
{
func
(
p
*
nodePlugin
)
Validate
Initialization
()
error
{
if
p
.
nodeIdentifier
==
nil
{
if
p
.
nodeIdentifier
==
nil
{
return
fmt
.
Errorf
(
"%s requires a node identifier"
,
PluginName
)
return
fmt
.
Errorf
(
"%s requires a node identifier"
,
PluginName
)
}
}
...
...
plugin/pkg/admission/persistentvolume/resize/admission.go
View file @
aedcf681
...
@@ -68,8 +68,8 @@ func (pvcr *persistentVolumeClaimResize) SetInternalKubeInformerFactory(f inform
...
@@ -68,8 +68,8 @@ func (pvcr *persistentVolumeClaimResize) SetInternalKubeInformerFactory(f inform
})
})
}
}
// Validate ensures lister is set.
// Validate
Initialization
ensures lister is set.
func
(
pvcr
*
persistentVolumeClaimResize
)
Validate
()
error
{
func
(
pvcr
*
persistentVolumeClaimResize
)
Validate
Initialization
()
error
{
if
pvcr
.
pvLister
==
nil
{
if
pvcr
.
pvLister
==
nil
{
return
fmt
.
Errorf
(
"missing persistent volume lister"
)
return
fmt
.
Errorf
(
"missing persistent volume lister"
)
}
}
...
...
plugin/pkg/admission/podnodeselector/admission.go
View file @
aedcf681
...
@@ -183,7 +183,7 @@ func (p *podNodeSelector) SetInternalKubeInformerFactory(f informers.SharedInfor
...
@@ -183,7 +183,7 @@ func (p *podNodeSelector) SetInternalKubeInformerFactory(f informers.SharedInfor
p
.
SetReadyFunc
(
namespaceInformer
.
Informer
()
.
HasSynced
)
p
.
SetReadyFunc
(
namespaceInformer
.
Informer
()
.
HasSynced
)
}
}
func
(
p
*
podNodeSelector
)
Validate
()
error
{
func
(
p
*
podNodeSelector
)
Validate
Initialization
()
error
{
if
p
.
namespaceLister
==
nil
{
if
p
.
namespaceLister
==
nil
{
return
fmt
.
Errorf
(
"missing namespaceLister"
)
return
fmt
.
Errorf
(
"missing namespaceLister"
)
}
}
...
...
plugin/pkg/admission/podnodeselector/admission_test.go
View file @
aedcf681
...
@@ -243,6 +243,6 @@ func newHandlerForTest(c clientset.Interface) (*podNodeSelector, informers.Share
...
@@ -243,6 +243,6 @@ func newHandlerForTest(c clientset.Interface) (*podNodeSelector, informers.Share
handler
:=
NewPodNodeSelector
(
nil
)
handler
:=
NewPodNodeSelector
(
nil
)
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
.
Initialize
(
handler
)
pluginInitializer
.
Initialize
(
handler
)
err
:=
admission
.
Validate
(
handler
)
err
:=
admission
.
Validate
Initialization
(
handler
)
return
handler
,
f
,
err
return
handler
,
f
,
err
}
}
plugin/pkg/admission/podpreset/admission.go
View file @
aedcf681
...
@@ -69,7 +69,7 @@ func NewPlugin() *podPresetPlugin {
...
@@ -69,7 +69,7 @@ func NewPlugin() *podPresetPlugin {
}
}
}
}
func
(
plugin
*
podPresetPlugin
)
Validate
()
error
{
func
(
plugin
*
podPresetPlugin
)
Validate
Initialization
()
error
{
if
plugin
.
client
==
nil
{
if
plugin
.
client
==
nil
{
return
fmt
.
Errorf
(
"%s requires a client"
,
pluginName
)
return
fmt
.
Errorf
(
"%s requires a client"
,
pluginName
)
}
}
...
...
plugin/pkg/admission/podtolerationrestriction/admission.go
View file @
aedcf681
...
@@ -202,7 +202,7 @@ func (p *podTolerationsPlugin) SetInternalKubeInformerFactory(f informers.Shared
...
@@ -202,7 +202,7 @@ func (p *podTolerationsPlugin) SetInternalKubeInformerFactory(f informers.Shared
}
}
func
(
p
*
podTolerationsPlugin
)
Validate
()
error
{
func
(
p
*
podTolerationsPlugin
)
Validate
Initialization
()
error
{
if
p
.
namespaceLister
==
nil
{
if
p
.
namespaceLister
==
nil
{
return
fmt
.
Errorf
(
"missing namespaceLister"
)
return
fmt
.
Errorf
(
"missing namespaceLister"
)
}
}
...
...
plugin/pkg/admission/podtolerationrestriction/admission_test.go
View file @
aedcf681
...
@@ -344,6 +344,6 @@ func newHandlerForTest(c clientset.Interface) (*podTolerationsPlugin, informers.
...
@@ -344,6 +344,6 @@ func newHandlerForTest(c clientset.Interface) (*podTolerationsPlugin, informers.
handler
:=
NewPodTolerationsPlugin
(
pluginConfig
)
handler
:=
NewPodTolerationsPlugin
(
pluginConfig
)
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
:=
kubeadmission
.
NewPluginInitializer
(
c
,
f
,
nil
,
nil
,
nil
,
nil
,
nil
)
pluginInitializer
.
Initialize
(
handler
)
pluginInitializer
.
Initialize
(
handler
)
err
=
admission
.
Validate
(
handler
)
err
=
admission
.
Validate
Initialization
(
handler
)
return
handler
,
f
,
err
return
handler
,
f
,
err
}
}
plugin/pkg/admission/priority/admission.go
View file @
aedcf681
...
@@ -74,8 +74,8 @@ func NewPlugin() *PriorityPlugin {
...
@@ -74,8 +74,8 @@ func NewPlugin() *PriorityPlugin {
}
}
}
}
// Validate
implements the
Validator interface.
// Validate
Initialization implements the Initialization
Validator interface.
func
(
p
*
PriorityPlugin
)
Validate
()
error
{
func
(
p
*
PriorityPlugin
)
Validate
Initialization
()
error
{
if
p
.
client
==
nil
{
if
p
.
client
==
nil
{
return
fmt
.
Errorf
(
"%s requires a client"
,
pluginName
)
return
fmt
.
Errorf
(
"%s requires a client"
,
pluginName
)
}
}
...
...
plugin/pkg/admission/resourcequota/admission.go
View file @
aedcf681
...
@@ -100,8 +100,8 @@ func (a *QuotaAdmission) SetQuotaConfiguration(c quota.Configuration) {
...
@@ -100,8 +100,8 @@ func (a *QuotaAdmission) SetQuotaConfiguration(c quota.Configuration) {
a
.
evaluator
=
NewQuotaEvaluator
(
a
.
quotaAccessor
,
a
.
quotaConfiguration
,
nil
,
a
.
config
,
a
.
numEvaluators
,
a
.
stopCh
)
a
.
evaluator
=
NewQuotaEvaluator
(
a
.
quotaAccessor
,
a
.
quotaConfiguration
,
nil
,
a
.
config
,
a
.
numEvaluators
,
a
.
stopCh
)
}
}
// Validate ensures an authorizer is set.
// Validate
Initialization
ensures an authorizer is set.
func
(
a
*
QuotaAdmission
)
Validate
()
error
{
func
(
a
*
QuotaAdmission
)
Validate
Initialization
()
error
{
if
a
.
quotaAccessor
==
nil
{
if
a
.
quotaAccessor
==
nil
{
return
fmt
.
Errorf
(
"missing quotaAccessor"
)
return
fmt
.
Errorf
(
"missing quotaAccessor"
)
}
}
...
...
plugin/pkg/admission/security/podsecuritypolicy/admission.go
View file @
aedcf681
...
@@ -72,8 +72,8 @@ func (plugin *podSecurityPolicyPlugin) SetAuthorizer(authz authorizer.Authorizer
...
@@ -72,8 +72,8 @@ func (plugin *podSecurityPolicyPlugin) SetAuthorizer(authz authorizer.Authorizer
plugin
.
authz
=
authz
plugin
.
authz
=
authz
}
}
// Validate ensures an authorizer is set.
// Validate
Initialization
ensures an authorizer is set.
func
(
plugin
*
podSecurityPolicyPlugin
)
Validate
()
error
{
func
(
plugin
*
podSecurityPolicyPlugin
)
Validate
Initialization
()
error
{
if
plugin
.
authz
==
nil
{
if
plugin
.
authz
==
nil
{
return
fmt
.
Errorf
(
"%s requires an authorizer"
,
PluginName
)
return
fmt
.
Errorf
(
"%s requires an authorizer"
,
PluginName
)
}
}
...
...
plugin/pkg/admission/serviceaccount/admission.go
View file @
aedcf681
...
@@ -117,8 +117,8 @@ func (a *serviceAccount) SetInternalKubeInformerFactory(f informers.SharedInform
...
@@ -117,8 +117,8 @@ func (a *serviceAccount) SetInternalKubeInformerFactory(f informers.SharedInform
})
})
}
}
// Validate ensures an authorizer is set.
// Validate
Initialization
ensures an authorizer is set.
func
(
a
*
serviceAccount
)
Validate
()
error
{
func
(
a
*
serviceAccount
)
Validate
Initialization
()
error
{
if
a
.
client
==
nil
{
if
a
.
client
==
nil
{
return
fmt
.
Errorf
(
"missing client"
)
return
fmt
.
Errorf
(
"missing client"
)
}
}
...
...
plugin/pkg/admission/storageclass/setdefault/admission.go
View file @
aedcf681
...
@@ -69,8 +69,8 @@ func (a *claimDefaulterPlugin) SetInternalKubeInformerFactory(f informers.Shared
...
@@ -69,8 +69,8 @@ func (a *claimDefaulterPlugin) SetInternalKubeInformerFactory(f informers.Shared
a
.
SetReadyFunc
(
informer
.
Informer
()
.
HasSynced
)
a
.
SetReadyFunc
(
informer
.
Informer
()
.
HasSynced
)
}
}
// Validate ensures lister is set.
// Validate
Initialization
ensures lister is set.
func
(
a
*
claimDefaulterPlugin
)
Validate
()
error
{
func
(
a
*
claimDefaulterPlugin
)
Validate
Initialization
()
error
{
if
a
.
lister
==
nil
{
if
a
.
lister
==
nil
{
return
fmt
.
Errorf
(
"missing lister"
)
return
fmt
.
Errorf
(
"missing lister"
)
}
}
...
...
staging/src/k8s.io/apiserver/pkg/admission/chain.go
View file @
aedcf681
...
@@ -40,14 +40,14 @@ func (admissionHandler chainAdmissionHandler) Admit(a Attributes) error {
...
@@ -40,14 +40,14 @@ func (admissionHandler chainAdmissionHandler) Admit(a Attributes) error {
return
nil
return
nil
}
}
// Validat
ingAdmit
performs an admission control check using a chain of handlers, and returns immediately on first error
// Validat
e
performs an admission control check using a chain of handlers, and returns immediately on first error
func
(
admissionHandler
chainAdmissionHandler
)
Validat
ingAdmit
(
a
Attributes
)
error
{
func
(
admissionHandler
chainAdmissionHandler
)
Validat
e
(
a
Attributes
)
error
{
for
_
,
handler
:=
range
admissionHandler
{
for
_
,
handler
:=
range
admissionHandler
{
if
!
handler
.
Handles
(
a
.
GetOperation
())
{
if
!
handler
.
Handles
(
a
.
GetOperation
())
{
continue
continue
}
}
if
validator
,
ok
:=
handler
.
(
ValidationInterface
);
ok
{
if
validator
,
ok
:=
handler
.
(
ValidationInterface
);
ok
{
err
:=
validator
.
Validat
ingAdmit
(
a
)
err
:=
validator
.
Validat
e
(
a
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
staging/src/k8s.io/apiserver/pkg/admission/initializer/initializer_test.go
View file @
aedcf681
...
@@ -99,7 +99,7 @@ func (self *WantExternalKubeInformerFactory) SetExternalKubeInformerFactory(sf i
...
@@ -99,7 +99,7 @@ func (self *WantExternalKubeInformerFactory) SetExternalKubeInformerFactory(sf i
}
}
func
(
self
*
WantExternalKubeInformerFactory
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
WantExternalKubeInformerFactory
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
WantExternalKubeInformerFactory
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
WantExternalKubeInformerFactory
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
WantExternalKubeInformerFactory
)
Validate
()
error
{
return
nil
}
func
(
self
*
WantExternalKubeInformerFactory
)
Validate
Initialization
()
error
{
return
nil
}
var
_
admission
.
Interface
=
&
WantExternalKubeInformerFactory
{}
var
_
admission
.
Interface
=
&
WantExternalKubeInformerFactory
{}
var
_
initializer
.
WantsExternalKubeInformerFactory
=
&
WantExternalKubeInformerFactory
{}
var
_
initializer
.
WantsExternalKubeInformerFactory
=
&
WantExternalKubeInformerFactory
{}
...
@@ -112,7 +112,7 @@ type WantExternalKubeClientSet struct {
...
@@ -112,7 +112,7 @@ type WantExternalKubeClientSet struct {
func
(
self
*
WantExternalKubeClientSet
)
SetExternalKubeClientSet
(
cs
kubernetes
.
Interface
)
{
self
.
cs
=
cs
}
func
(
self
*
WantExternalKubeClientSet
)
SetExternalKubeClientSet
(
cs
kubernetes
.
Interface
)
{
self
.
cs
=
cs
}
func
(
self
*
WantExternalKubeClientSet
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
WantExternalKubeClientSet
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
WantExternalKubeClientSet
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
WantExternalKubeClientSet
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
WantExternalKubeClientSet
)
Validate
()
error
{
return
nil
}
func
(
self
*
WantExternalKubeClientSet
)
Validate
Initialization
()
error
{
return
nil
}
var
_
admission
.
Interface
=
&
WantExternalKubeClientSet
{}
var
_
admission
.
Interface
=
&
WantExternalKubeClientSet
{}
var
_
initializer
.
WantsExternalKubeClientSet
=
&
WantExternalKubeClientSet
{}
var
_
initializer
.
WantsExternalKubeClientSet
=
&
WantExternalKubeClientSet
{}
...
@@ -125,7 +125,7 @@ type WantAuthorizerAdmission struct {
...
@@ -125,7 +125,7 @@ type WantAuthorizerAdmission struct {
func
(
self
*
WantAuthorizerAdmission
)
SetAuthorizer
(
a
authorizer
.
Authorizer
)
{
self
.
auth
=
a
}
func
(
self
*
WantAuthorizerAdmission
)
SetAuthorizer
(
a
authorizer
.
Authorizer
)
{
self
.
auth
=
a
}
func
(
self
*
WantAuthorizerAdmission
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
WantAuthorizerAdmission
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
WantAuthorizerAdmission
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
WantAuthorizerAdmission
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
WantAuthorizerAdmission
)
Validate
()
error
{
return
nil
}
func
(
self
*
WantAuthorizerAdmission
)
Validate
Initialization
()
error
{
return
nil
}
var
_
admission
.
Interface
=
&
WantAuthorizerAdmission
{}
var
_
admission
.
Interface
=
&
WantAuthorizerAdmission
{}
var
_
initializer
.
WantsAuthorizer
=
&
WantAuthorizerAdmission
{}
var
_
initializer
.
WantsAuthorizer
=
&
WantAuthorizerAdmission
{}
...
@@ -145,7 +145,7 @@ type clientCertWanter struct {
...
@@ -145,7 +145,7 @@ type clientCertWanter struct {
func
(
s
*
clientCertWanter
)
SetClientCert
(
cert
,
key
[]
byte
)
{
s
.
gotCert
,
s
.
gotKey
=
cert
,
key
}
func
(
s
*
clientCertWanter
)
SetClientCert
(
cert
,
key
[]
byte
)
{
s
.
gotCert
,
s
.
gotKey
=
cert
,
key
}
func
(
s
*
clientCertWanter
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
s
*
clientCertWanter
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
s
*
clientCertWanter
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
s
*
clientCertWanter
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
s
*
clientCertWanter
)
Validate
()
error
{
return
nil
}
func
(
s
*
clientCertWanter
)
Validate
Initialization
()
error
{
return
nil
}
// WantSchemeAdmission is a test stub that fulfills the WantsScheme interface.
// WantSchemeAdmission is a test stub that fulfills the WantsScheme interface.
type
WantSchemeAdmission
struct
{
type
WantSchemeAdmission
struct
{
...
@@ -155,7 +155,7 @@ type WantSchemeAdmission struct {
...
@@ -155,7 +155,7 @@ type WantSchemeAdmission struct {
func
(
self
*
WantSchemeAdmission
)
SetScheme
(
s
*
runtime
.
Scheme
)
{
self
.
scheme
=
s
}
func
(
self
*
WantSchemeAdmission
)
SetScheme
(
s
*
runtime
.
Scheme
)
{
self
.
scheme
=
s
}
func
(
self
*
WantSchemeAdmission
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
WantSchemeAdmission
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
WantSchemeAdmission
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
WantSchemeAdmission
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
WantSchemeAdmission
)
Validate
()
error
{
return
nil
}
func
(
self
*
WantSchemeAdmission
)
Validate
Initialization
()
error
{
return
nil
}
var
_
admission
.
Interface
=
&
WantSchemeAdmission
{}
var
_
admission
.
Interface
=
&
WantSchemeAdmission
{}
var
_
initializer
.
WantsScheme
=
&
WantSchemeAdmission
{}
var
_
initializer
.
WantsScheme
=
&
WantSchemeAdmission
{}
staging/src/k8s.io/apiserver/pkg/admission/initializer/interfaces.go
View file @
aedcf681
...
@@ -27,23 +27,23 @@ import (
...
@@ -27,23 +27,23 @@ import (
// WantsExternalKubeClientSet defines a function which sets external ClientSet for admission plugins that need it
// WantsExternalKubeClientSet defines a function which sets external ClientSet for admission plugins that need it
type
WantsExternalKubeClientSet
interface
{
type
WantsExternalKubeClientSet
interface
{
SetExternalKubeClientSet
(
kubernetes
.
Interface
)
SetExternalKubeClientSet
(
kubernetes
.
Interface
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
// WantsExternalKubeInformerFactory defines a function which sets InformerFactory for admission plugins that need it
// WantsExternalKubeInformerFactory defines a function which sets InformerFactory for admission plugins that need it
type
WantsExternalKubeInformerFactory
interface
{
type
WantsExternalKubeInformerFactory
interface
{
SetExternalKubeInformerFactory
(
informers
.
SharedInformerFactory
)
SetExternalKubeInformerFactory
(
informers
.
SharedInformerFactory
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
// WantsAuthorizer defines a function which sets Authorizer for admission plugins that need it.
// WantsAuthorizer defines a function which sets Authorizer for admission plugins that need it.
type
WantsAuthorizer
interface
{
type
WantsAuthorizer
interface
{
SetAuthorizer
(
authorizer
.
Authorizer
)
SetAuthorizer
(
authorizer
.
Authorizer
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
// WantsScheme defines a function that accepts runtime.Scheme for admission plugins that need it.
// WantsScheme defines a function that accepts runtime.Scheme for admission plugins that need it.
type
WantsScheme
interface
{
type
WantsScheme
interface
{
SetScheme
(
*
runtime
.
Scheme
)
SetScheme
(
*
runtime
.
Scheme
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
staging/src/k8s.io/apiserver/pkg/admission/interfaces.go
View file @
aedcf681
...
@@ -69,8 +69,8 @@ type MutationInterface interface {
...
@@ -69,8 +69,8 @@ type MutationInterface interface {
type
ValidationInterface
interface
{
type
ValidationInterface
interface
{
Interface
Interface
// Validat
ingAdmit
makes an admission decision based on the request attributes. It is NOT allowed to mutate
// Validat
e
makes an admission decision based on the request attributes. It is NOT allowed to mutate
Validat
ingAdmit
(
a
Attributes
)
(
err
error
)
Validat
e
(
a
Attributes
)
(
err
error
)
}
}
// Operation is the type of resource operation being checked for admission control
// Operation is the type of resource operation being checked for admission control
...
@@ -90,10 +90,10 @@ type PluginInitializer interface {
...
@@ -90,10 +90,10 @@ type PluginInitializer interface {
Initialize
(
plugin
Interface
)
Initialize
(
plugin
Interface
)
}
}
//
Validator holds Validate functions, which are responsible for validation of initialized shared resources
//
InitializationValidator holds ValidateInitialization functions, which are responsible for validation of initialized
// and should be implemented on admission plugins
//
shared resources
and should be implemented on admission plugins
type
Validator
interface
{
type
Initialization
Validator
interface
{
Validate
()
error
Validate
Initialization
()
error
}
}
// ConfigProvider provides a way to get configuration for an admission plugin based on its name
// ConfigProvider provides a way to get configuration for an admission plugin based on its name
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/initialization/initialization.go
View file @
aedcf681
...
@@ -74,8 +74,8 @@ func NewInitializer() admission.Interface {
...
@@ -74,8 +74,8 @@ func NewInitializer() admission.Interface {
return
&
initializer
{}
return
&
initializer
{}
}
}
// Validate
implements the
Validator interface.
// Validate
Initialization implements the Initialization
Validator interface.
func
(
i
*
initializer
)
Validate
()
error
{
func
(
i
*
initializer
)
Validate
Initialization
()
error
{
if
i
.
config
==
nil
{
if
i
.
config
==
nil
{
return
fmt
.
Errorf
(
"the Initializer admission plugin requires a Kubernetes client to be provided"
)
return
fmt
.
Errorf
(
"the Initializer admission plugin requires a Kubernetes client to be provided"
)
}
}
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go
View file @
aedcf681
...
@@ -214,8 +214,8 @@ func (l *Lifecycle) SetExternalKubeClientSet(client kubernetes.Interface) {
...
@@ -214,8 +214,8 @@ func (l *Lifecycle) SetExternalKubeClientSet(client kubernetes.Interface) {
l
.
client
=
client
l
.
client
=
client
}
}
// Validate
implement the
Validator interface.
// Validate
Initialization implements the Initialization
Validator interface.
func
(
l
*
Lifecycle
)
Validate
()
error
{
func
(
l
*
Lifecycle
)
Validate
Initialization
()
error
{
if
l
.
namespaceLister
==
nil
{
if
l
.
namespaceLister
==
nil
{
return
fmt
.
Errorf
(
"missing namespaceLister"
)
return
fmt
.
Errorf
(
"missing namespaceLister"
)
}
}
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission_test.go
View file @
aedcf681
...
@@ -53,7 +53,7 @@ func newHandlerForTestWithClock(c clientset.Interface, cacheClock clock.Clock) (
...
@@ -53,7 +53,7 @@ func newHandlerForTestWithClock(c clientset.Interface, cacheClock clock.Clock) (
return
handler
,
f
,
err
return
handler
,
f
,
err
}
}
pluginInitializer
.
Initialize
(
handler
)
pluginInitializer
.
Initialize
(
handler
)
err
=
admission
.
Validate
(
handler
)
err
=
admission
.
Validate
Initialization
(
handler
)
return
handler
,
f
,
err
return
handler
,
f
,
err
}
}
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/admission.go
View file @
aedcf681
...
@@ -156,9 +156,8 @@ func (a *GenericAdmissionWebhook) SetExternalKubeClientSet(client clientset.Inte
...
@@ -156,9 +156,8 @@ func (a *GenericAdmissionWebhook) SetExternalKubeClientSet(client clientset.Inte
a
.
hookSource
=
configuration
.
NewExternalAdmissionHookConfigurationManager
(
client
.
Admissionregistration
()
.
ExternalAdmissionHookConfigurations
())
a
.
hookSource
=
configuration
.
NewExternalAdmissionHookConfigurationManager
(
client
.
Admissionregistration
()
.
ExternalAdmissionHookConfigurations
())
}
}
// Validator holds Validate functions, which are responsible for validation of initialized shared resources
// ValidateInitialization implements the InitializationValidator interface.
// and should be implemented on admission plugins
func
(
a
*
GenericAdmissionWebhook
)
ValidateInitialization
()
error
{
func
(
a
*
GenericAdmissionWebhook
)
Validate
()
error
{
if
a
.
hookSource
==
nil
{
if
a
.
hookSource
==
nil
{
return
fmt
.
Errorf
(
"the GenericAdmissionWebhook admission plugin requires a Kubernetes client to be provided"
)
return
fmt
.
Errorf
(
"the GenericAdmissionWebhook admission plugin requires a Kubernetes client to be provided"
)
}
}
...
...
staging/src/k8s.io/apiserver/pkg/admission/plugins.go
View file @
aedcf681
...
@@ -156,18 +156,18 @@ func (ps *Plugins) InitPlugin(name string, config io.Reader, pluginInitializer P
...
@@ -156,18 +156,18 @@ func (ps *Plugins) InitPlugin(name string, config io.Reader, pluginInitializer P
pluginInitializer
.
Initialize
(
plugin
)
pluginInitializer
.
Initialize
(
plugin
)
// ensure that plugins have been properly initialized
// ensure that plugins have been properly initialized
if
err
:=
Validate
(
plugin
);
err
!=
nil
{
if
err
:=
Validate
Initialization
(
plugin
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
plugin
,
nil
return
plugin
,
nil
}
}
// Validate
will call the
Validate function in each plugin if they implement
// Validate
Initialization will call the Initialization
Validate function in each plugin if they implement
// the Validator interface.
// the
Initialization
Validator interface.
func
Validate
(
plugin
Interface
)
error
{
func
Validate
Initialization
(
plugin
Interface
)
error
{
if
validater
,
ok
:=
plugin
.
(
Validator
);
ok
{
if
validater
,
ok
:=
plugin
.
(
Initialization
Validator
);
ok
{
err
:=
validater
.
Validate
()
err
:=
validater
.
Validate
Initialization
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go
View file @
aedcf681
...
@@ -104,7 +104,7 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestSco
...
@@ -104,7 +104,7 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestSco
}
}
}
}
if
validatingAdmission
,
ok
:=
admit
.
(
admission
.
ValidationInterface
);
ok
{
if
validatingAdmission
,
ok
:=
admit
.
(
admission
.
ValidationInterface
);
ok
{
if
err
:=
validatingAdmission
.
Validat
ingAdmit
(
attrs
);
err
!=
nil
{
if
err
:=
validatingAdmission
.
Validat
e
(
attrs
);
err
!=
nil
{
scope
.
err
(
err
,
w
,
req
)
scope
.
err
(
err
,
w
,
req
)
return
return
}
}
...
@@ -192,7 +192,7 @@ func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope RequestSco
...
@@ -192,7 +192,7 @@ func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope RequestSco
if
validatingAdmission
,
ok
:=
admit
.
(
admission
.
ValidationInterface
);
ok
&&
validatingAdmission
.
Handles
(
admission
.
Delete
)
{
if
validatingAdmission
,
ok
:=
admit
.
(
admission
.
ValidationInterface
);
ok
&&
validatingAdmission
.
Handles
(
admission
.
Delete
)
{
userInfo
,
_
:=
request
.
UserFrom
(
ctx
)
userInfo
,
_
:=
request
.
UserFrom
(
ctx
)
err
=
validatingAdmission
.
Validat
ingAdmit
(
admission
.
NewAttributesRecord
(
nil
,
nil
,
scope
.
Kind
,
namespace
,
""
,
scope
.
Resource
,
scope
.
Subresource
,
admission
.
Delete
,
userInfo
))
err
=
validatingAdmission
.
Validat
e
(
admission
.
NewAttributesRecord
(
nil
,
nil
,
scope
.
Kind
,
namespace
,
""
,
scope
.
Resource
,
scope
.
Subresource
,
admission
.
Delete
,
userInfo
))
if
err
!=
nil
{
if
err
!=
nil
{
scope
.
err
(
err
,
w
,
req
)
scope
.
err
(
err
,
w
,
req
)
return
return
...
...
staging/src/k8s.io/apiserver/pkg/registry/rest/create.go
View file @
aedcf681
...
@@ -174,6 +174,6 @@ func AdmissionToValidateObjectFunc(admit admission.Interface, staticAttributes a
...
@@ -174,6 +174,6 @@ func AdmissionToValidateObjectFunc(admit admission.Interface, staticAttributes a
if
!
validatingAdmission
.
Handles
(
finalAttributes
.
GetOperation
())
{
if
!
validatingAdmission
.
Handles
(
finalAttributes
.
GetOperation
())
{
return
nil
return
nil
}
}
return
validatingAdmission
.
Validat
ingAdmit
(
finalAttributes
)
return
validatingAdmission
.
Validat
e
(
finalAttributes
)
}
}
}
}
staging/src/k8s.io/apiserver/pkg/registry/rest/update.go
View file @
aedcf681
...
@@ -252,6 +252,6 @@ func AdmissionToValidateObjectUpdateFunc(admit admission.Interface, staticAttrib
...
@@ -252,6 +252,6 @@ func AdmissionToValidateObjectUpdateFunc(admit admission.Interface, staticAttrib
if
!
validatingAdmission
.
Handles
(
finalAttributes
.
GetOperation
())
{
if
!
validatingAdmission
.
Handles
(
finalAttributes
.
GetOperation
())
{
return
nil
return
nil
}
}
return
validatingAdmission
.
Validat
ingAdmit
(
finalAttributes
)
return
validatingAdmission
.
Validat
e
(
finalAttributes
)
}
}
}
}
staging/src/k8s.io/sample-apiserver/pkg/admission/plugin/banflunder/admission.go
View file @
aedcf681
...
@@ -84,8 +84,8 @@ func (d *DisallowFlunder) SetInternalWardleInformerFactory(f informers.SharedInf
...
@@ -84,8 +84,8 @@ func (d *DisallowFlunder) SetInternalWardleInformerFactory(f informers.SharedInf
d
.
lister
=
f
.
Wardle
()
.
InternalVersion
()
.
Fischers
()
.
Lister
()
d
.
lister
=
f
.
Wardle
()
.
InternalVersion
()
.
Fischers
()
.
Lister
()
}
}
// Validate checks whether the plugin was correctly initialized.
// Valida
ValidateInitialization
te checks whether the plugin was correctly initialized.
func
(
d
*
DisallowFlunder
)
Validate
()
error
{
func
(
d
*
DisallowFlunder
)
Validate
Initialization
()
error
{
if
d
.
lister
==
nil
{
if
d
.
lister
==
nil
{
return
fmt
.
Errorf
(
"missing fischer lister"
)
return
fmt
.
Errorf
(
"missing fischer lister"
)
}
}
...
...
staging/src/k8s.io/sample-apiserver/pkg/admission/plugin/banflunder/admission_test.go
View file @
aedcf681
...
@@ -119,7 +119,7 @@ func TestBanflunderAdmissionPlugin(t *testing.T) {
...
@@ -119,7 +119,7 @@ func TestBanflunderAdmissionPlugin(t *testing.T) {
}
}
targetInitializer
.
Initialize
(
target
)
targetInitializer
.
Initialize
(
target
)
err
=
admission
.
Validate
(
target
)
err
=
admission
.
Validate
Initialization
(
target
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"scenario %d: failed to initialize banflunder admission plugin due to =%v"
,
index
,
err
)
t
.
Fatalf
(
"scenario %d: failed to initialize banflunder admission plugin due to =%v"
,
index
,
err
)
}
}
...
...
staging/src/k8s.io/sample-apiserver/pkg/admission/wardleinitializer/interfaces.go
View file @
aedcf681
...
@@ -24,5 +24,5 @@ import (
...
@@ -24,5 +24,5 @@ import (
// WantsInternalWardleInformerFactory defines a function which sets InformerFactory for admission plugins that need it
// WantsInternalWardleInformerFactory defines a function which sets InformerFactory for admission plugins that need it
type
WantsInternalWardleInformerFactory
interface
{
type
WantsInternalWardleInformerFactory
interface
{
SetInternalWardleInformerFactory
(
informers
.
SharedInformerFactory
)
SetInternalWardleInformerFactory
(
informers
.
SharedInformerFactory
)
admission
.
Validator
admission
.
Initialization
Validator
}
}
staging/src/k8s.io/sample-apiserver/pkg/admission/wardleinitializer/wardleinitializer_test.go
View file @
aedcf681
...
@@ -52,7 +52,7 @@ func (self *wantInternalWardleInformerFactory) SetInternalWardleInformerFactory(
...
@@ -52,7 +52,7 @@ func (self *wantInternalWardleInformerFactory) SetInternalWardleInformerFactory(
}
}
func
(
self
*
wantInternalWardleInformerFactory
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
wantInternalWardleInformerFactory
)
Admit
(
a
admission
.
Attributes
)
error
{
return
nil
}
func
(
self
*
wantInternalWardleInformerFactory
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
wantInternalWardleInformerFactory
)
Handles
(
o
admission
.
Operation
)
bool
{
return
false
}
func
(
self
*
wantInternalWardleInformerFactory
)
Validate
()
error
{
return
nil
}
func
(
self
*
wantInternalWardleInformerFactory
)
Validate
Initialization
()
error
{
return
nil
}
var
_
admission
.
Interface
=
&
wantInternalWardleInformerFactory
{}
var
_
admission
.
Interface
=
&
wantInternalWardleInformerFactory
{}
var
_
wardleinitializer
.
WantsInternalWardleInformerFactory
=
&
wantInternalWardleInformerFactory
{}
var
_
wardleinitializer
.
WantsInternalWardleInformerFactory
=
&
wantInternalWardleInformerFactory
{}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment