Skip to content

Commit

Permalink
adds revision controller to APIServerControllerSet
Browse files Browse the repository at this point in the history
  • Loading branch information
p0lyn0mial committed Mar 23, 2020
1 parent 2a351be commit 67fcc94
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion pkg/operator/apiserver/controllerset/apiservercontrollerset.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/openshift/library-go/pkg/operator/events"
"github.com/openshift/library-go/pkg/operator/loglevel"
"github.com/openshift/library-go/pkg/operator/resource/resourceapply"
"github.com/openshift/library-go/pkg/operator/revisioncontroller"
"github.com/openshift/library-go/pkg/operator/staticresourcecontroller"
"github.com/openshift/library-go/pkg/operator/status"
"github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller"
Expand Down Expand Up @@ -53,7 +54,7 @@ func (cw *controllerWrapper) prepare() (controller, error) {
// APIServerControllerSet is a set of controllers that maintain a deployment of
// an API server and the namespace it's running in
//
// TODO: add workload and encryption controllers
// TODO: add encryption controllers
type APIServerControllerSet struct {
operatorClient v1helpers.OperatorClient
eventRecorder events.Recorder
Expand All @@ -65,6 +66,7 @@ type APIServerControllerSet struct {
finalizerController controllerWrapper
staticResourceController controllerWrapper
workloadController controllerWrapper
revisionController controllerWrapper
}

func NewAPIServerControllerSet(
Expand Down Expand Up @@ -246,6 +248,34 @@ func (cs *APIServerControllerSet) WithoutWorkloadController() *APIServerControll
return cs
}

func (cs *APIServerControllerSet) WithRevisionController(
targetNamespace string,
configMaps []revisioncontroller.RevisionResource,
secrets []revisioncontroller.RevisionResource,
kubeInformersForTargetNamespace kubeinformers.SharedInformerFactory,
revisionClient revisioncontroller.LatestRevisionClient,
configMapGetter corev1client.ConfigMapsGetter,
secretGetter corev1client.SecretsGetter,
) *APIServerControllerSet {
cs.revisionController.controller = revisioncontroller.NewRevisionController(
targetNamespace,
configMaps,
secrets,
kubeInformersForTargetNamespace,
revisionClient,
configMapGetter,
secretGetter,
cs.eventRecorder,
)
return cs
}

func (cs *APIServerControllerSet) WithoutRevisionController() *APIServerControllerSet {
cs.revisionController.controller = nil
cs.workloadController.emptyAllowed = true
return cs
}

func (cs *APIServerControllerSet) PrepareRun() (preparedAPIServerControllerSet, error) {
prepared := []controller{}
errs := []error{}
Expand All @@ -258,6 +288,7 @@ func (cs *APIServerControllerSet) PrepareRun() (preparedAPIServerControllerSet,
"finalizerController": cs.finalizerController,
"staticResourceController": cs.staticResourceController,
"workloadController": cs.workloadController,
"revisionController": cs.revisionController,
} {
c, err := cw.prepare()
if err != nil {
Expand Down

0 comments on commit 67fcc94

Please sign in to comment.