directly depend on the scc admission plugin
@@ -2,17 +2,15 @@ package controller
import (
"k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apiserver/pkg/admission"
- kubeadmission "k8s.io/kubernetes/pkg/kubeapiserver/admission"
builddefaults "github.com/openshift/origin/pkg/build/admission/defaults"
buildoverrides "github.com/openshift/origin/pkg/build/admission/overrides"
buildcontroller "github.com/openshift/origin/pkg/build/controller/build"
buildconfigcontroller "github.com/openshift/origin/pkg/build/controller/buildconfig"
buildstrategy "github.com/openshift/origin/pkg/build/controller/strategy"
- oadmission "github.com/openshift/origin/pkg/cmd/server/admission"
configapi "github.com/openshift/origin/pkg/cmd/server/api"
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
+ sccadmission "github.com/openshift/origin/pkg/security/admission"
)
type BuildControllerConfig struct {
@@ -25,20 +23,10 @@ type BuildControllerConfig struct {
// RunController starts the build sync loop for builds and buildConfig processing.
func (c *BuildControllerConfig) RunController(ctx ControllerContext) (bool, error) {
- kubePluginInitializer := kubeadmission.NewPluginInitializer(
- ctx.ClientBuilder.KubeInternalClientOrDie(bootstrappolicy.InfraBuildControllerServiceAccountName),
- ctx.InternalKubeInformers,
- nil, // api authorizer, only used by PSP
- nil, // cloud config
- nil, // quota registry
- )
- originPluginInitializer := &oadmission.PluginInitializer{
- SecurityInformers: ctx.SecurityInformers,
- }
- allPluginInitializers := admission.PluginInitializers([]admission.PluginInitializer{kubePluginInitializer, originPluginInitializer})
-
- admissionControl, err := admission.InitPlugin("SecurityContextConstraint", nil, allPluginInitializers)
- if err != nil {
+ sccAdmission := sccadmission.NewConstraint()
+ sccAdmission.SetSecurityInformers(ctx.SecurityInformers)
+ sccAdmission.SetInternalKubeClientSet(ctx.ClientBuilder.KubeInternalClientOrDie(bootstrappolicy.InfraBuildControllerServiceAccountName))
+ if err := sccAdmission.Validate(); err != nil {
return true, err
}
@@ -82,7 +70,7 @@ func (c *BuildControllerConfig) RunController(ctx ControllerContext) (bool, erro
Image: c.STIImage,
// TODO: this will be set to --storage-version (the internal schema we use)
Codec: c.Codec,
- AdmissionControl: admissionControl,
+ AdmissionControl: sccAdmission,
},
CustomBuildStrategy: &buildstrategy.CustomBuildStrategy{
// TODO: this will be set to --storage-version (the internal schema we use)
