Skip to content

Commit

Permalink
Add resync to secret syncer
Browse files Browse the repository at this point in the history
  • Loading branch information
jsafrane committed Jul 29, 2020
1 parent 7da6806 commit 3f025c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/controllers/secret/secretsync.go
Expand Up @@ -3,6 +3,7 @@ package secret
import (
"context"
"fmt"
"time"

"github.com/gophercloud/utils/openstack/clientconfig"
operatorv1 "github.com/openshift/api/operator/v1"
Expand Down Expand Up @@ -40,6 +41,7 @@ func NewController(
operatorClient v1helpers.OperatorClient,
kubeClient kubernetes.Interface,
informers v1helpers.KubeInformersForNamespaces,
resync time.Duration,
eventRecorder events.Recorder) factory.Controller {

// Produce secrets in the operator namespace
Expand All @@ -50,7 +52,7 @@ func NewController(
secretLister: secretInformer.Core().V1().Secrets().Lister(),
eventRecorder: eventRecorder.WithComponentSuffix("SecretSync"),
}
return factory.New().WithSync(c.sync).WithSyncDegradedOnError(operatorClient).WithInformers(
return factory.New().WithSync(c.sync).ResyncEvery(resync).WithSyncDegradedOnError(operatorClient).WithInformers(
operatorClient.Informer(),
secretInformer.Core().V1().Secrets().Informer(),
).ToController("SecretSync", eventRecorder)
Expand Down
4 changes: 4 additions & 0 deletions pkg/operator/starter.go
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"fmt"
"os"
"time"

"github.com/openshift/csi-driver-manila-operator/pkg/controllers/manila"
"github.com/openshift/csi-driver-manila-operator/pkg/controllers/secret"
Expand All @@ -27,6 +28,8 @@ const (
operatorName = "manila-csi-driver-operator"

nfsImageEnvName = "NFS_DRIVER_IMAGE"

resync = 20 * time.Minute
)

func RunOperator(ctx context.Context, controllerConfig *controllercmd.ControllerContext) error {
Expand Down Expand Up @@ -95,6 +98,7 @@ func RunOperator(ctx context.Context, controllerConfig *controllercmd.Controller
operatorClient,
kubeClient,
kubeInformersForNamespaces,
resync,
controllerConfig.EventRecorder)

manilaController := manila.NewController(
Expand Down

0 comments on commit 3f025c9

Please sign in to comment.