From 1e1b8cfe5f1690fea5c2bbad218f0e838fb22fb2 Mon Sep 17 00:00:00 2001 From: hasheddan Date: Wed, 18 Aug 2021 07:51:04 -0400 Subject: [PATCH 1/2] Add poll-interval flag for setting default controller poll Adds a flag to provider entrypoint for setting the happy path poll interval. Defaults to 1 minute. Signed-off-by: hasheddan --- cmd/provider/main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/provider/main.go b/cmd/provider/main.go index 028199bd..f18ab35a 100644 --- a/cmd/provider/main.go +++ b/cmd/provider/main.go @@ -35,7 +35,8 @@ func main() { var ( app = kingpin.New(filepath.Base(os.Args[0]), "Azure support for Crossplane.").DefaultEnvars() debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() - syncPeriod = app.Flag("sync", "Controller manager sync period duration such as 300ms, 1.5h or 2h45m").Short('s').Default("1h").Duration() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("1m").Duration() leaderElection = app.Flag("leader-election", "Use leader election for the conroller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() ) kingpin.MustParse(app.Parse(os.Args[1:])) @@ -49,7 +50,7 @@ func main() { ctrl.SetLogger(zl) } - log.Debug("Starting", "sync-period", syncPeriod.String()) + log.Debug("Starting", "sync-period", syncInterval.String()) cfg, err := ctrl.GetConfig() kingpin.FatalIfError(err, "Cannot get API server rest config") @@ -57,12 +58,12 @@ func main() { mgr, err := ctrl.NewManager(cfg, ctrl.Options{ LeaderElection: *leaderElection, LeaderElectionID: "crossplane-leader-election-provider-azure", - SyncPeriod: syncPeriod, + SyncPeriod: syncInterval, }) kingpin.FatalIfError(err, "Cannot create controller manager") kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add Azure APIs to scheme") - kingpin.FatalIfError(controller.Setup(mgr, log, ratelimiter.NewDefaultProviderRateLimiter(ratelimiter.DefaultProviderRPS)), "Cannot setup Azure controllers") + kingpin.FatalIfError(controller.Setup(mgr, log, ratelimiter.NewDefaultProviderRateLimiter(ratelimiter.DefaultProviderRPS), *pollInterval), "Cannot setup Azure controllers") kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") } From 9067597e545a1c6da30a2927c70055f7af7dee46 Mon Sep 17 00:00:00 2001 From: hasheddan Date: Wed, 18 Aug 2021 07:51:31 -0400 Subject: [PATCH 2/2] Pass poll interval to all controllers Passes the value of the poll interval flag to all controllers such that it can be set globally via flag. Signed-off-by: hasheddan --- pkg/controller/azure.go | 11 ++-- pkg/controller/cache/redis.go | 4 +- pkg/controller/compute/managed.go | 4 +- pkg/controller/database/cosmosdb/managed.go | 4 +- .../database/mysqlserver/managed.go | 4 +- .../mysqlserverfirewallrule/managed.go | 4 +- .../mysqlservervirtualnetworkrule/managed.go | 4 +- .../database/postgresqlserver/managed.go | 4 +- .../postgresqlserverfirewallrule/managed.go | 4 +- .../managed.go | 4 +- pkg/controller/network/subnet/managed.go | 4 +- .../network/virtualnetwork/managed.go | 4 +- pkg/controller/resourcegroup/resourcegroup.go | 4 +- pkg/controller/storage/account/account.go | 41 +++++++------- .../storage/account/account_test.go | 54 +++++++++++-------- pkg/controller/storage/container/container.go | 21 ++++---- .../storage/container/container_test.go | 22 ++++---- 17 files changed, 123 insertions(+), 74 deletions(-) diff --git a/pkg/controller/azure.go b/pkg/controller/azure.go index dea46eef..6c05d5b0 100644 --- a/pkg/controller/azure.go +++ b/pkg/controller/azure.go @@ -17,6 +17,8 @@ limitations under the License. package controller import ( + "time" + "k8s.io/client-go/util/workqueue" ctrl "sigs.k8s.io/controller-runtime" @@ -40,9 +42,8 @@ import ( ) // Setup Azure controllers. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { - for _, setup := range []func(ctrl.Manager, logging.Logger, workqueue.RateLimiter) error{ - config.Setup, +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { + for _, setup := range []func(ctrl.Manager, logging.Logger, workqueue.RateLimiter, time.Duration) error{ cache.SetupRedis, compute.SetupAKSCluster, mysqlserver.Setup, @@ -58,9 +59,9 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { account.Setup, container.Setup, } { - if err := setup(mgr, l, rl); err != nil { + if err := setup(mgr, l, rl, poll); err != nil { return err } } - return nil + return config.Setup(mgr, l, rl) } diff --git a/pkg/controller/cache/redis.go b/pkg/controller/cache/redis.go index 57fc2770..c4158a18 100644 --- a/pkg/controller/cache/redis.go +++ b/pkg/controller/cache/redis.go @@ -19,6 +19,7 @@ package cache import ( "context" "strconv" + "time" "github.com/Azure/azure-sdk-for-go/profiles/latest/redis/mgmt/redis" "github.com/Azure/azure-sdk-for-go/profiles/latest/redis/mgmt/redis/redisapi" @@ -54,7 +55,7 @@ const ( ) // SetupRedis adds a controller that reconciles Redis resources. -func SetupRedis(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func SetupRedis(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1beta1.RedisGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -67,6 +68,7 @@ func SetupRedis(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) er resource.ManagedKind(v1beta1.RedisGroupVersionKind), managed.WithExternalConnecter(&connector{kube: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/compute/managed.go b/pkg/controller/compute/managed.go index 5d1af692..94b1146a 100644 --- a/pkg/controller/compute/managed.go +++ b/pkg/controller/compute/managed.go @@ -18,6 +18,7 @@ package compute import ( "context" + "time" "github.com/Azure/go-autorest/autorest/to" "github.com/pkg/errors" @@ -52,7 +53,7 @@ const ( ) // SetupAKSCluster adds a controller that reconciles AKSClusters. -func SetupAKSCluster(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func SetupAKSCluster(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.AKSClusterGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -65,6 +66,7 @@ func SetupAKSCluster(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimite resource.ManagedKind(v1alpha3.AKSClusterGroupVersionKind), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/database/cosmosdb/managed.go b/pkg/controller/database/cosmosdb/managed.go index 6dfc0152..e9b91aa8 100644 --- a/pkg/controller/database/cosmosdb/managed.go +++ b/pkg/controller/database/cosmosdb/managed.go @@ -19,6 +19,7 @@ package cosmosdb import ( "context" "net/http" + "time" "github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2015-04-08/documentdb" "github.com/pkg/errors" @@ -49,7 +50,7 @@ const ( ) // Setup adds a controller that reconciles NoSQLAccount. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.CosmosDBAccountGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -63,6 +64,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { managed.WithConnectionPublishers(), managed.WithExternalConnecter(&connecter{kube: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/database/mysqlserver/managed.go b/pkg/controller/database/mysqlserver/managed.go index 08274743..a778c3ee 100644 --- a/pkg/controller/database/mysqlserver/managed.go +++ b/pkg/controller/database/mysqlserver/managed.go @@ -19,6 +19,7 @@ package mysqlserver import ( "context" "fmt" + "time" "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql" "k8s.io/client-go/util/workqueue" @@ -55,7 +56,7 @@ const ( ) // Setup adds a controller that reconciles MySQLServers. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1beta1.MySQLServerGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -68,6 +69,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { resource.ManagedKind(v1beta1.MySQLServerGroupVersionKind), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/database/mysqlserverfirewallrule/managed.go b/pkg/controller/database/mysqlserverfirewallrule/managed.go index 970a22a5..b9849c6d 100644 --- a/pkg/controller/database/mysqlserverfirewallrule/managed.go +++ b/pkg/controller/database/mysqlserverfirewallrule/managed.go @@ -18,6 +18,7 @@ package mysqlserverfirewallrule import ( "context" + "time" "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql" "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/mysqlapi" @@ -50,7 +51,7 @@ const ( ) // Setup adds a controller that reconciles MySQLServerFirewallRules. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.MySQLServerFirewallRuleGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -64,6 +65,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { managed.WithConnectionPublishers(), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/database/mysqlservervirtualnetworkrule/managed.go b/pkg/controller/database/mysqlservervirtualnetworkrule/managed.go index 61ea9190..969e34b9 100644 --- a/pkg/controller/database/mysqlservervirtualnetworkrule/managed.go +++ b/pkg/controller/database/mysqlservervirtualnetworkrule/managed.go @@ -18,6 +18,7 @@ package mysqlservervirtualnetworkrule import ( "context" + "time" "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql" "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/mysqlapi" @@ -50,7 +51,7 @@ const ( ) // Setup adds a controller that reconciles MySQLServerVirtualNetworkRules. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.MySQLServerVirtualNetworkRuleGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -64,6 +65,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { managed.WithConnectionPublishers(), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/database/postgresqlserver/managed.go b/pkg/controller/database/postgresqlserver/managed.go index 3204455d..37ff3232 100644 --- a/pkg/controller/database/postgresqlserver/managed.go +++ b/pkg/controller/database/postgresqlserver/managed.go @@ -19,6 +19,7 @@ package postgresqlserver import ( "context" "fmt" + "time" "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql" v1 "k8s.io/api/core/v1" @@ -58,7 +59,7 @@ const ( ) // Setup adds a controller that reconciles PostgreSQLInstances. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1beta1.PostgreSQLServerGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -71,6 +72,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { resource.ManagedKind(v1beta1.PostgreSQLServerGroupVersionKind), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/database/postgresqlserverfirewallrule/managed.go b/pkg/controller/database/postgresqlserverfirewallrule/managed.go index 52a26b7c..38d732b6 100644 --- a/pkg/controller/database/postgresqlserverfirewallrule/managed.go +++ b/pkg/controller/database/postgresqlserverfirewallrule/managed.go @@ -18,6 +18,7 @@ package postgresqlserverfirewallrule import ( "context" + "time" "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql" "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/postgresqlapi" @@ -50,7 +51,7 @@ const ( ) // Setup adds a controller that reconciles PostgreSQLServerFirewallRules. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.PostgreSQLServerFirewallRuleGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -64,6 +65,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { managed.WithConnectionPublishers(), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/database/postgresqlservervirtualnetworkrule/managed.go b/pkg/controller/database/postgresqlservervirtualnetworkrule/managed.go index 819972b3..e7e13b76 100644 --- a/pkg/controller/database/postgresqlservervirtualnetworkrule/managed.go +++ b/pkg/controller/database/postgresqlservervirtualnetworkrule/managed.go @@ -18,6 +18,7 @@ package postgresqlservervirtualnetworkrule import ( "context" + "time" "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/postgresqlapi" "k8s.io/client-go/util/workqueue" @@ -52,7 +53,7 @@ const ( ) // Setup adds a controller that reconciles PostgreSQLServerVirtualNetworkRules. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.PostgreSQLServerVirtualNetworkRuleGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -66,6 +67,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { managed.WithConnectionPublishers(), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/network/subnet/managed.go b/pkg/controller/network/subnet/managed.go index 4afd0889..a7b4f209 100644 --- a/pkg/controller/network/subnet/managed.go +++ b/pkg/controller/network/subnet/managed.go @@ -18,6 +18,7 @@ package subnet import ( "context" + "time" azurenetwork "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network/networkapi" @@ -50,7 +51,7 @@ const ( ) // Setup adds a controller that reconciles Subnets. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.SubnetGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -64,6 +65,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { managed.WithConnectionPublishers(), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/network/virtualnetwork/managed.go b/pkg/controller/network/virtualnetwork/managed.go index 9f490067..12c4b87d 100644 --- a/pkg/controller/network/virtualnetwork/managed.go +++ b/pkg/controller/network/virtualnetwork/managed.go @@ -18,6 +18,7 @@ package virtualnetwork import ( "context" + "time" azurenetwork "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network/networkapi" @@ -50,7 +51,7 @@ const ( ) // Setup adds a controller that reconciles VirtualNetworks. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.VirtualNetworkGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -64,6 +65,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { managed.WithConnectionPublishers(), managed.WithExternalConnecter(&connecter{client: mgr.GetClient()}), managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/resourcegroup/resourcegroup.go b/pkg/controller/resourcegroup/resourcegroup.go index 8aee4cc4..28283bc5 100644 --- a/pkg/controller/resourcegroup/resourcegroup.go +++ b/pkg/controller/resourcegroup/resourcegroup.go @@ -19,6 +19,7 @@ package resourcegroup import ( "context" "net/http" + "time" "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources" "k8s.io/client-go/util/workqueue" @@ -53,7 +54,7 @@ const ( ) // Setup adds a controller that reconciles ResourceGroups. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.ResourceGroupGroupKind) return ctrl.NewControllerManagedBy(mgr). @@ -66,6 +67,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { resource.ManagedKind(v1alpha3.ResourceGroupGroupVersionKind), managed.WithConnectionPublishers(), managed.WithExternalConnecter(&connecter{kube: mgr.GetClient()}), + managed.WithPollInterval(poll), managed.WithLogger(l.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) } diff --git a/pkg/controller/storage/account/account.go b/pkg/controller/storage/account/account.go index ce53b5d2..e30d9941 100644 --- a/pkg/controller/storage/account/account.go +++ b/pkg/controller/storage/account/account.go @@ -49,15 +49,13 @@ const ( controllerName = "account.storage.azure.crossplane.io" finalizer = "finalizer." + controllerName - reconcileTimeout = 2 * time.Minute - requeueAfterOnSuccess = 1 * time.Minute - requeueAfterOnWait = 30 * time.Second + reconcileTimeout = 2 * time.Minute + requeueAfterOnWait = 30 * time.Second ) var ( - resultRequeue = reconcile.Result{Requeue: true} - requeueOnSuccess = reconcile.Result{RequeueAfter: requeueAfterOnSuccess} - requeueOnWait = reconcile.Result{RequeueAfter: requeueAfterOnWait} + resultRequeue = reconcile.Result{Requeue: true} + requeueOnWait = reconcile.Result{RequeueAfter: requeueAfterOnWait} ) // Reconciler reconciles an Azure storage account @@ -67,17 +65,20 @@ type Reconciler struct { managed.ReferenceResolver managed.Initializer + poll time.Duration + log logging.Logger } // Setup adds a controller that reconciles Accounts. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.AccountGroupKind) r := &Reconciler{ Client: mgr.GetClient(), syncdeleterMaker: &accountSyncdeleterMaker{mgr.GetClient()}, Initializer: managed.NewNameAsExternalName(mgr.GetClient()), + poll: poll, log: l.WithValues("controller", name), } @@ -110,7 +111,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) ( return reconcile.Result{}, err } - bh, err := r.newSyncdeleter(ctx, b) + bh, err := r.newSyncdeleter(ctx, b, r.poll) if err != nil { b.Status.SetConditions(xpv1.ReconcileError(err)) return resultRequeue, r.Status().Update(ctx, b) @@ -125,14 +126,14 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) ( } type syncdeleterMaker interface { - newSyncdeleter(context.Context, *v1alpha3.Account) (syncdeleter, error) + newSyncdeleter(context.Context, *v1alpha3.Account, time.Duration) (syncdeleter, error) } type accountSyncdeleterMaker struct { client.Client } -func (m *accountSyncdeleterMaker) newSyncdeleter(ctx context.Context, b *v1alpha3.Account) (syncdeleter, error) { +func (m *accountSyncdeleterMaker) newSyncdeleter(ctx context.Context, b *v1alpha3.Account, poll time.Duration) (syncdeleter, error) { creds, auth, err := azure.GetAuthInfo(ctx, m.Client, b) if err != nil { return nil, errors.Wrap(err, "cannot get auth information") @@ -143,7 +144,7 @@ func (m *accountSyncdeleterMaker) newSyncdeleter(ctx context.Context, b *v1alpha return newAccountSyncDeleter( azurestorage.NewAccountHandle(&cl, b.Spec.ResourceGroupName, meta.GetExternalName(b)), - m.Client, b), nil + m.Client, b, poll), nil } type deleter interface { @@ -182,9 +183,9 @@ type accountSyncDeleter struct { acct *v1alpha3.Account } -func newAccountSyncDeleter(ao azurestorage.AccountOperations, kube client.Client, b *v1alpha3.Account) *accountSyncDeleter { +func newAccountSyncDeleter(ao azurestorage.AccountOperations, kube client.Client, b *v1alpha3.Account, poll time.Duration) *accountSyncDeleter { return &accountSyncDeleter{ - createupdater: newAccountCreateUpdater(ao, kube, b), + createupdater: newAccountCreateUpdater(ao, kube, b, poll), AccountOperations: ao, kube: kube, acct: b, @@ -238,16 +239,18 @@ type accountCreateUpdater struct { azurestorage.AccountOperations kube client.Client acct *v1alpha3.Account + poll time.Duration projectID string } // newAccountCreateUpdater new instance of accountCreateUpdater -func newAccountCreateUpdater(ao azurestorage.AccountOperations, kube client.Client, acct *v1alpha3.Account) *accountCreateUpdater { +func newAccountCreateUpdater(ao azurestorage.AccountOperations, kube client.Client, acct *v1alpha3.Account, poll time.Duration) *accountCreateUpdater { return &accountCreateUpdater{ - syncbacker: newAccountSyncBacker(ao, kube, acct), + syncbacker: newAccountSyncBacker(ao, kube, acct, poll), AccountOperations: ao, kube: kube, acct: acct, + poll: poll, } } @@ -275,7 +278,7 @@ func (acu *accountCreateUpdater) update(ctx context.Context, account *storage.Ac current := v1alpha3.NewStorageAccountSpec(account) if reflect.DeepEqual(current, acu.acct.Spec.StorageAccountSpec) { acu.acct.Status.SetConditions(xpv1.ReconcileSuccess()) - return requeueOnSuccess, acu.kube.Status().Update(ctx, acu.acct) + return reconcile.Result{RequeueAfter: acu.poll}, acu.kube.Status().Update(ctx, acu.acct) } a, err := acu.Update(ctx, v1alpha3.ToStorageAccountUpdate(acu.acct.Spec.StorageAccountSpec)) @@ -293,13 +296,15 @@ type accountSyncbacker struct { secretupdater acct *v1alpha3.Account kube client.Client + poll time.Duration } -func newAccountSyncBacker(ao azurestorage.AccountOperations, kube client.Client, acct *v1alpha3.Account) *accountSyncbacker { +func newAccountSyncBacker(ao azurestorage.AccountOperations, kube client.Client, acct *v1alpha3.Account, poll time.Duration) *accountSyncbacker { return &accountSyncbacker{ secretupdater: newAccountSecretUpdater(ao, kube, acct), kube: kube, acct: acct, + poll: poll, } } @@ -322,7 +327,7 @@ func (asb *accountSyncbacker) syncback(ctx context.Context, acct *storage.Accoun } asb.acct.Status.SetConditions(xpv1.ReconcileSuccess()) - return requeueOnSuccess, asb.kube.Status().Update(ctx, asb.acct) + return reconcile.Result{RequeueAfter: asb.poll}, asb.kube.Status().Update(ctx, asb.acct) } type accountSecretUpdater struct { diff --git a/pkg/controller/storage/account/account_test.go b/pkg/controller/storage/account/account_test.go index a287e0da..e98c0d10 100644 --- a/pkg/controller/storage/account/account_test.go +++ b/pkg/controller/storage/account/account_test.go @@ -79,13 +79,13 @@ type MockAccountCreateUpdater struct { MockUpdate func(context.Context, *storage.Account) (reconcile.Result, error) } -func newMockAccountCreateUpdater() *MockAccountCreateUpdater { +func newMockAccountCreateUpdater(poll time.Duration) *MockAccountCreateUpdater { return &MockAccountCreateUpdater{ MockUpdate: func(i context.Context, acct *storage.Account) (result reconcile.Result, e error) { - return requeueOnSuccess, nil + return reconcile.Result{RequeueAfter: poll}, nil }, MockCreate: func(i context.Context) (result reconcile.Result, e error) { - return requeueOnSuccess, nil + return reconcile.Result{RequeueAfter: poll}, nil }, } } @@ -105,10 +105,10 @@ type MockAccountSyncDeleter struct { MockSync func(context.Context) (reconcile.Result, error) } -func newMockAccountSyncDeleter() *MockAccountSyncDeleter { +func newMockAccountSyncDeleter(poll time.Duration) *MockAccountSyncDeleter { return &MockAccountSyncDeleter{ MockSync: func(i context.Context) (result reconcile.Result, e error) { - return requeueOnSuccess, nil + return reconcile.Result{RequeueAfter: poll}, nil }, MockDelete: func(i context.Context) (result reconcile.Result, e error) { return result, nil @@ -130,7 +130,7 @@ type MockAccountHandleMaker struct { MockNew func(context.Context, *v1alpha3.Account) (syncdeleter, error) } -func newMockAccountHandleMaker(rh syncdeleter, err error) *MockAccountHandleMaker { +func newMockAccountHandleMaker(rh syncdeleter, err error, _ time.Duration) *MockAccountHandleMaker { return &MockAccountHandleMaker{ MockNew: func(i context.Context, bucket *v1alpha3.Account) (handler syncdeleter, e error) { return rh, err @@ -138,7 +138,7 @@ func newMockAccountHandleMaker(rh syncdeleter, err error) *MockAccountHandleMake } } -func (m *MockAccountHandleMaker) newSyncdeleter(ctx context.Context, b *v1alpha3.Account) (syncdeleter, error) { +func (m *MockAccountHandleMaker) newSyncdeleter(ctx context.Context, b *v1alpha3.Account, _ time.Duration) (syncdeleter, error) { return m.MockNew(ctx, b) } @@ -227,7 +227,7 @@ func TestReconciler_Reconcile(t *testing.T) { name: "AccountHandlerError", fields: fields{ client: fake.NewClientBuilder().WithObjects(v1alpha3test.NewMockAccount(name).WithFinalizer("foo.bar").Account).Build(), - maker: newMockAccountHandleMaker(nil, errBoom), + maker: newMockAccountHandleMaker(nil, errBoom, time.Minute), }, want: want{ res: resultRequeue, @@ -243,7 +243,7 @@ func TestReconciler_Reconcile(t *testing.T) { fields: fields{ client: fake.NewClientBuilder().WithObjects(v1alpha3test.NewMockAccount(name). WithDeleteTimestamp(metav1.NewTime(time.Now())).Account).Build(), - maker: newMockAccountHandleMaker(newMockAccountSyncDeleter(), nil), + maker: newMockAccountHandleMaker(newMockAccountSyncDeleter(time.Minute), nil, time.Minute), }, want: want{res: rsDone}, }, @@ -251,9 +251,9 @@ func TestReconciler_Reconcile(t *testing.T) { name: "ReconcileSync", fields: fields{ client: fake.NewClientBuilder().WithObjects(v1alpha3test.NewMockAccount(name).Account).Build(), - maker: newMockAccountHandleMaker(newMockAccountSyncDeleter(), nil), + maker: newMockAccountHandleMaker(newMockAccountSyncDeleter(time.Hour), nil, time.Minute), }, - want: want{res: requeueOnSuccess}, + want: want{res: reconcile.Result{RequeueAfter: time.Hour}}, }, } @@ -299,6 +299,7 @@ func Test_syncdeleter_delete(t *testing.T) { ao azurestorage.AccountOperations cc client.Client acct *v1alpha3.Account + poll time.Duration } type want struct { err error @@ -407,7 +408,7 @@ func Test_syncdeleter_delete(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - bh := newAccountSyncDeleter(tt.fields.ao, tt.fields.cc, tt.fields.acct) + bh := newAccountSyncDeleter(tt.fields.ao, tt.fields.cc, tt.fields.acct, tt.fields.poll) got, err := bh.delete(ctx) if diff := cmp.Diff(tt.want.err, err, test.EquateErrors()); diff != "" { t.Errorf("accountSyncDeleter.delete(): -want error, +got error: \n%s", diff) @@ -431,6 +432,7 @@ func Test_syncdeleter_sync(t *testing.T) { ao azurestorage.AccountOperations kube client.Client acct *v1alpha3.Account + poll time.Duration } type want struct { err error @@ -480,9 +482,10 @@ func Test_syncdeleter_sync(t *testing.T) { }, }, acct: v1alpha3test.NewMockAccount(name).WithUID("test-uid").Account, + poll: time.Minute, }, want: want{ - res: requeueOnSuccess, + res: reconcile.Result{RequeueAfter: time.Minute}, acct: v1alpha3test.NewMockAccount(name).WithUID("test-uid").Account, }, }, @@ -498,9 +501,10 @@ func Test_syncdeleter_sync(t *testing.T) { }, }, acct: v1alpha3test.NewMockAccount(name).WithUID("test-uid").Account, + poll: time.Minute, }, want: want{ - res: requeueOnSuccess, + res: reconcile.Result{RequeueAfter: time.Minute}, acct: v1alpha3test.NewMockAccount(name).WithUID("test-uid").Account, }, }, @@ -508,7 +512,7 @@ func Test_syncdeleter_sync(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { bh := &accountSyncDeleter{ - createupdater: newMockAccountCreateUpdater(), + createupdater: newMockAccountCreateUpdater(tt.fields.poll), AccountOperations: tt.fields.ao, kube: tt.fields.kube, acct: tt.fields.acct, @@ -633,6 +637,7 @@ func Test_bucketCreateUpdater_update(t *testing.T) { ao azurestorage.AccountOperations kube client.Client acct *v1alpha3.Account + poll time.Duration } type want struct { res reconcile.Result @@ -653,12 +658,13 @@ func Test_bucketCreateUpdater_update(t *testing.T) { fields: fields{ sb: &MockAccountSyncbacker{ MockSyncback: func(ctx context.Context, a *storage.Account) (result reconcile.Result, e error) { - return requeueOnSuccess, nil + return reconcile.Result{RequeueAfter: time.Minute}, nil }, }, + poll: time.Minute, }, want: want{ - res: requeueOnSuccess, + res: reconcile.Result{RequeueAfter: time.Minute}, }, }, { @@ -671,9 +677,10 @@ func Test_bucketCreateUpdater_update(t *testing.T) { WithSpecStorageAccountSpec(newStoragAccountSpecWithProperties()). Account, kube: test.NewMockClient(), + poll: time.Minute, }, want: want{ - res: requeueOnSuccess, + res: reconcile.Result{RequeueAfter: time.Minute}, acct: v1alpha3test.NewMockAccount(name). WithSpecStorageAccountSpec(newStoragAccountSpecWithProperties()). WithStatusConditions(xpv1.Available(), xpv1.ReconcileSuccess()). @@ -714,7 +721,7 @@ func Test_bucketCreateUpdater_update(t *testing.T) { fields: fields{ sb: &MockAccountSyncbacker{ MockSyncback: func(ctx context.Context, a *storage.Account) (result reconcile.Result, e error) { - return requeueOnSuccess, nil + return reconcile.Result{RequeueAfter: time.Minute}, nil }, }, acct: v1alpha3test.NewMockAccount(name).WithSpecStorageAccountSpec(newStoragAccountSpecWithProperties()).Account, @@ -724,9 +731,10 @@ func Test_bucketCreateUpdater_update(t *testing.T) { }, }, kube: test.NewMockClient(), + poll: time.Minute, }, want: want{ - res: requeueOnSuccess, + res: reconcile.Result{RequeueAfter: time.Minute}, acct: v1alpha3test.NewMockAccount(name). WithSpecStorageAccountSpec(newStoragAccountSpecWithProperties()). WithStatusConditions(xpv1.Available()). @@ -741,6 +749,7 @@ func Test_bucketCreateUpdater_update(t *testing.T) { AccountOperations: tt.fields.ao, kube: tt.fields.kube, acct: tt.fields.acct, + poll: tt.fields.poll, } got, err := bh.update(ctx, tt.attrs) if diff := cmp.Diff(tt.want.err, err, test.EquateErrors()); diff != "" { @@ -768,6 +777,7 @@ func Test_accountSyncBacker_syncback(t *testing.T) { secretupdater secretupdater kube client.Client acct *v1alpha3.Account + poll time.Duration } type want struct { res reconcile.Result @@ -844,10 +854,11 @@ func Test_accountSyncBacker_syncback(t *testing.T) { WithSpecStorageAccountSpec(v1alpha3.NewStorageAccountSpec(&storage.Account{})). Account, kube: test.NewMockClient(), + poll: time.Minute, }, acct: &storage.Account{AccountProperties: &storage.AccountProperties{ProvisioningState: storage.Succeeded}}, want: want{ - res: requeueOnSuccess, + res: reconcile.Result{RequeueAfter: time.Minute}, acct: v1alpha3test.NewMockAccount(name). WithSpecStatusFromProperties(&storage.AccountProperties{ProvisioningState: storage.Succeeded}). WithStatusConditions(xpv1.ReconcileSuccess()). @@ -861,6 +872,7 @@ func Test_accountSyncBacker_syncback(t *testing.T) { secretupdater: tt.fields.secretupdater, kube: tt.fields.kube, acct: tt.fields.acct, + poll: tt.fields.poll, } got, err := acu.syncback(ctx, tt.acct) if diff := cmp.Diff(tt.want.err, err, test.EquateErrors()); diff != "" { diff --git a/pkg/controller/storage/container/container.go b/pkg/controller/storage/container/container.go index 083cfed6..cef2e27e 100644 --- a/pkg/controller/storage/container/container.go +++ b/pkg/controller/storage/container/container.go @@ -50,8 +50,7 @@ const ( controllerName = "container.storage.azure.crossplane.io" finalizer = "finalizer." + controllerName - reconcileTimeout = 2 * time.Minute - requeueAfterOnSuccess = 1 * time.Minute + reconcileTimeout = 2 * time.Minute ) // Error strings @@ -60,8 +59,7 @@ const ( ) var ( - resultRequeue = reconcile.Result{Requeue: true} - requeueOnSuccess = reconcile.Result{RequeueAfter: requeueAfterOnSuccess} + resultRequeue = reconcile.Result{Requeue: true} ) // Reconciler reconciles an Azure storage container @@ -71,17 +69,20 @@ type Reconciler struct { managed.ReferenceResolver managed.Initializer + poll time.Duration + log logging.Logger } // Setup adds a controller that reconciles Containers. -func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter) error { +func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { name := managed.ControllerName(v1alpha3.ContainerGroupKind) r := &Reconciler{ Client: mgr.GetClient(), syncdeleterMaker: &containerSyncdeleterMaker{mgr.GetClient()}, Initializer: managed.NewNameAsExternalName(mgr.GetClient()), + poll: poll, log: l.WithValues("controller", name), } @@ -110,7 +111,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) ( return reconcile.Result{}, err } - sd, err := r.newSyncdeleter(ctx, c) + sd, err := r.newSyncdeleter(ctx, c, r.poll) if err != nil { c.Status.SetConditions(xpv1.ReconcileError(err)) return resultRequeue, r.Status().Update(ctx, c) @@ -125,14 +126,14 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) ( } type syncdeleterMaker interface { - newSyncdeleter(context.Context, *v1alpha3.Container) (syncdeleter, error) + newSyncdeleter(context.Context, *v1alpha3.Container, time.Duration) (syncdeleter, error) } type containerSyncdeleterMaker struct { client.Client } -func (m *containerSyncdeleterMaker) newSyncdeleter(ctx context.Context, c *v1alpha3.Container) (syncdeleter, error) { // nolint:gocyclo +func (m *containerSyncdeleterMaker) newSyncdeleter(ctx context.Context, c *v1alpha3.Container, poll time.Duration) (syncdeleter, error) { // nolint:gocyclo nn := types.NamespacedName{} switch { case c.GetProviderConfigReference() != nil && c.GetProviderConfigReference().Name != "": @@ -191,6 +192,7 @@ func (m *containerSyncdeleterMaker) newSyncdeleter(ctx context.Context, c *v1alp ContainerOperations: ch, kube: m.Client, container: c, + poll: poll, }, ContainerOperations: ch, kube: m.Client, @@ -266,6 +268,7 @@ type containerCreateUpdater struct { storage.ContainerOperations kube client.Client container *v1alpha3.Container + poll time.Duration } var _ createupdater = &containerCreateUpdater{} @@ -301,5 +304,5 @@ func (ccu *containerCreateUpdater) update(ctx context.Context, accessType *azblo } container.Status.SetConditions(xpv1.Available(), xpv1.ReconcileSuccess()) - return requeueOnSuccess, ccu.kube.Status().Update(ctx, ccu.container) + return reconcile.Result{RequeueAfter: ccu.poll}, ccu.kube.Status().Update(ctx, ccu.container) } diff --git a/pkg/controller/storage/container/container_test.go b/pkg/controller/storage/container/container_test.go index 82d26bc9..f9c058c4 100644 --- a/pkg/controller/storage/container/container_test.go +++ b/pkg/controller/storage/container/container_test.go @@ -97,11 +97,11 @@ func (m *mockSyncdeleter) sync(ctx context.Context) (reconcile.Result, error) { var _ syncdeleter = &mockSyncdeleter{} type mockSyncdeleteMaker struct { - mockNewSyncdeleter func(context.Context, *v1alpha3.Container) (syncdeleter, error) + mockNewSyncdeleter func(context.Context, *v1alpha3.Container, time.Duration) (syncdeleter, error) } -func (m *mockSyncdeleteMaker) newSyncdeleter(ctx context.Context, c *v1alpha3.Container) (syncdeleter, error) { - return m.mockNewSyncdeleter(ctx, c) +func (m *mockSyncdeleteMaker) newSyncdeleter(ctx context.Context, c *v1alpha3.Container, poll time.Duration) (syncdeleter, error) { + return m.mockNewSyncdeleter(ctx, c, poll) } var _ syncdeleterMaker = &mockSyncdeleteMaker{} @@ -196,7 +196,7 @@ func TestReconciler_Reconcile(t *testing.T) { Client: fake.NewClientBuilder().WithObjects(v1alpha3test.NewMockContainer(testContainerName). WithFinalizer("foo.bar").Container).Build(), syncdeleterMaker: &mockSyncdeleteMaker{ - mockNewSyncdeleter: func(ctx context.Context, c *v1alpha3.Container) (syncdeleter, error) { + mockNewSyncdeleter: func(ctx context.Context, c *v1alpha3.Container, _ time.Duration) (syncdeleter, error) { return nil, errBoom }, }, @@ -217,7 +217,7 @@ func TestReconciler_Reconcile(t *testing.T) { Client: fake.NewClientBuilder().WithObjects(v1alpha3test.NewMockContainer(testContainerName). WithDeleteTimestamp(time.Now()).Container).Build(), syncdeleterMaker: &mockSyncdeleteMaker{ - mockNewSyncdeleter: func(ctx context.Context, c *v1alpha3.Container) (syncdeleter, error) { + mockNewSyncdeleter: func(ctx context.Context, c *v1alpha3.Container, _ time.Duration) (syncdeleter, error) { return &mockSyncdeleter{ mockDelete: func(ctx context.Context) (reconcile.Result, error) { return reconcile.Result{}, nil @@ -235,7 +235,7 @@ func TestReconciler_Reconcile(t *testing.T) { fields: fields{ Client: fake.NewClientBuilder().WithObjects(v1alpha3test.NewMockContainer(testContainerName).Container).Build(), syncdeleterMaker: &mockSyncdeleteMaker{ - mockNewSyncdeleter: func(ctx context.Context, c *v1alpha3.Container) (syncdeleter, error) { + mockNewSyncdeleter: func(ctx context.Context, c *v1alpha3.Container, _ time.Duration) (syncdeleter, error) { return &mockSyncdeleter{ mockSync: func(ctx context.Context) (reconcile.Result, error) { return reconcile.Result{}, nil @@ -438,7 +438,7 @@ func Test_containerSyncdeleterMaker_newSyncdeleter(t *testing.T) { m := &containerSyncdeleterMaker{ Client: tt.fields.Client, } - got, err := m.newSyncdeleter(tt.args.ctx, tt.args.c) + got, err := m.newSyncdeleter(tt.args.ctx, tt.args.c, time.Minute) if diff := cmp.Diff(tt.want.err, err, test.EquateErrors()); diff != "" { t.Errorf("containerSyncdeleterMaker.newSyncdeleter(): -got error, +want error: \n%s", diff) } @@ -814,6 +814,7 @@ func Test_containerCreateUpdater_update(t *testing.T) { ContainerOperations storage.ContainerOperations kube client.Client container *v1alpha3.Container + poll time.Duration } type args struct { ctx context.Context @@ -837,13 +838,14 @@ func Test_containerCreateUpdater_update(t *testing.T) { container: v1alpha3test.NewMockContainer(testContainerName). WithSpecPAC(azblob.PublicAccessContainer).Container, kube: test.NewMockClient(), + poll: time.Minute, }, args: args{ ctx: ctx, accessType: azurestoragefake.PublicAccessTypePtr(azblob.PublicAccessContainer), }, want: want{ - res: requeueOnSuccess, + res: reconcile.Result{RequeueAfter: time.Minute}, cont: v1alpha3test.NewMockContainer(testContainerName). WithSpecPAC(azblob.PublicAccessContainer). WithStatusConditions(xpv1.Available(), xpv1.ReconcileSuccess()). @@ -887,6 +889,7 @@ func Test_containerCreateUpdater_update(t *testing.T) { Container, ContainerOperations: azurestoragefake.NewMockContainerOperations(), kube: test.NewMockClient(), + poll: time.Minute, }, args: args{ ctx: ctx, @@ -896,7 +899,7 @@ func Test_containerCreateUpdater_update(t *testing.T) { }, }, want: want{ - res: requeueOnSuccess, + res: reconcile.Result{RequeueAfter: time.Minute}, cont: v1alpha3test.NewMockContainer(testContainerName). WithSpecPAC(azblob.PublicAccessContainer). WithStatusConditions(xpv1.Available(), xpv1.ReconcileSuccess()). @@ -910,6 +913,7 @@ func Test_containerCreateUpdater_update(t *testing.T) { ContainerOperations: tt.fields.ContainerOperations, kube: tt.fields.kube, container: tt.fields.container, + poll: tt.fields.poll, } got, err := ccu.update(tt.args.ctx, tt.args.accessType, tt.args.meta) if diff := cmp.Diff(tt.want.err, err, test.EquateErrors()); diff != "" {