forked from openshift/apiserver-library-go
/
intializers.go
28 lines (22 loc) · 901 Bytes
/
intializers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package sccadmission
import (
"k8s.io/apiserver/pkg/admission"
securityv1informer "github.com/openshift/client-go/security/informers/externalversions/security/v1"
)
func NewInitializer(sccInformer securityv1informer.SecurityContextConstraintsInformer) admission.PluginInitializer {
return &localInitializer{sccInformer: sccInformer}
}
type WantsSecurityInformer interface {
SetSecurityInformers(securityv1informer.SecurityContextConstraintsInformer)
admission.InitializationValidator
}
type localInitializer struct {
sccInformer securityv1informer.SecurityContextConstraintsInformer
}
// Initialize will check the initialization interfaces implemented by each plugin
// and provide the appropriate initialization data
func (i *localInitializer) Initialize(plugin admission.Interface) {
if wants, ok := plugin.(WantsSecurityInformer); ok {
wants.SetSecurityInformers(i.sccInformer)
}
}