Skip to content

Commit

Permalink
OCPBUGS-14049: Add secret informer
Browse files Browse the repository at this point in the history
Add a secret informer for the secret that we store credentials in,
'openshift-cluster-csi-drivers / manila-cloud-credentials', like we
already do for the Cinder CSI Driver Operator. As is the case there,
this ensures our controllers will reload upon changes to the secret.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
  • Loading branch information
stephenfin committed Jul 17, 2023
1 parent abb28bf commit 705fb00
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const (
func RunOperator(ctx context.Context, controllerConfig *controllercmd.ControllerContext) error {
kubeClient := kubeclient.NewForConfigOrDie(rest.AddUserAgent(controllerConfig.KubeConfig, operatorName))
kubeInformersForNamespaces := v1helpers.NewKubeInformersForNamespaces(kubeClient, util.OperatorNamespace, util.OperandNamespace, util.CloudConfigNamespace, "")
secretInformer := kubeInformersForNamespaces.InformersFor(util.OperatorNamespace).Core().V1().Secrets()
configMapInformer := kubeInformersForNamespaces.InformersFor(util.OperandNamespace).Core().V1().ConfigMaps()
nodeInformer := kubeInformersForNamespaces.InformersFor("").Core().V1().Nodes()

Expand Down Expand Up @@ -137,7 +138,9 @@ func RunOperator(ctx context.Context, controllerConfig *controllercmd.Controller
configInformers,
[]factory.Informer{
nodeInformer.Informer(),
secretInformer.Informer(),
configMapInformer.Informer()},
csidrivercontrollerservicecontroller.WithSecretHashAnnotationHook(util.OperatorNamespace, util.CloudCredentialSecretName, secretInformer),
csidrivercontrollerservicecontroller.WithObservedProxyDeploymentHook(),
csidrivercontrollerservicecontroller.WithCABundleDeploymentHook(
util.OperandNamespace,
Expand All @@ -152,6 +155,7 @@ func RunOperator(ctx context.Context, controllerConfig *controllercmd.Controller
kubeClient,
kubeInformersForNamespaces.InformersFor(util.OperandNamespace),
nil,
csidrivernodeservicecontroller.WithSecretHashAnnotationHook(util.OperatorNamespace, util.CloudCredentialSecretName, secretInformer),
csidrivernodeservicecontroller.WithObservedProxyDaemonSetHook(),
csidrivernodeservicecontroller.WithCABundleDaemonSetHook(
util.OperandNamespace,
Expand Down

0 comments on commit 705fb00

Please sign in to comment.