Skip to content

Commit

Permalink
fix reconcile default polling time
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks committed Sep 19, 2024
1 parent c67d9a1 commit 019a6e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cmd/agent/args/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const (
defaultRefreshInterval = "2m"
defaultRefreshIntervalDuration = 2 * time.Minute

defaultPollInterval = "30s"
defaultPollIntervalDuration = 30 * time.Second
defaultPollInterval = "2m"
defaultPollIntervalDuration = 2 * time.Minute

defaultPollJitter = "15s"
defaultPollJitterDuration = 15 * time.Second
Expand All @@ -41,8 +41,8 @@ const (
defaultManifestCacheTTL = "1h"
defaultManifestCacheTTLDuration = time.Hour

defaultControllerCacheTTL = "30s"
defaultControllerCacheTTLDuration = 30 * time.Second
defaultControllerCacheTTL = "2m"
defaultControllerCacheTTLDuration = 2 * time.Minute

defaultRestoreNamespace = "velero"

Expand All @@ -67,7 +67,7 @@ var (
argProbeAddr = flag.String("health-probe-bind-address", defaultProbeAddress, "The address the probe endpoint binds to.")
argMetricsAddr = flag.String("metrics-bind-address", defaultMetricsAddress, "The address the metric endpoint binds to.")
argProcessingTimeout = flag.String("processing-timeout", defaultProcessingTimeout, "Maximum amount of time to spend trying to process queue item.")
argRefreshInterval = flag.String("refresh-interval", defaultRefreshInterval, "Time interval to recheck the websocket connection.")
argRefreshInterval = flag.String("refresh-interval", defaultRefreshInterval, "DEPRECATED: Time interval to poll resources from the Console API.")
argPollInterval = flag.String("poll-interval", defaultPollInterval, "Time interval to poll resources from the Console API.")
// TODO: ensure this arg can be safely renamed without causing breaking changes.
argPollJitter = flag.String("refresh-jitter", defaultPollJitter, "Randomly selected jitter time up to the provided duration will be added to the poll interval.")
Expand Down
11 changes: 9 additions & 2 deletions cmd/agent/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"os"
"time"

"github.com/pluralsh/deployment-operator/cmd/agent/args"
"github.com/pluralsh/deployment-operator/internal/utils"
Expand Down Expand Up @@ -37,6 +38,12 @@ func initConsoleManagerOrDie() *consolectrl.Manager {
return mgr
}

const (
// Use custom (short) poll intervals for these reconcilers.
pipelineGatesPollInterval = 30 * time.Second
stacksPollInterval = 30 * time.Second
)

func registerConsoleReconcilersOrDie(
mgr *controller.Manager,
config *rest.Config,
Expand All @@ -49,7 +56,7 @@ func registerConsoleReconcilersOrDie(
})

mgr.AddReconcilerOrDie(pipelinegates.Identifier, func() (controller.Reconciler, error) {
r, err := pipelinegates.NewGateReconciler(consoleClient, k8sClient, config, args.PollInterval())
r, err := pipelinegates.NewGateReconciler(consoleClient, k8sClient, config, pipelineGatesPollInterval)
return r, err
})

Expand All @@ -70,7 +77,7 @@ func registerConsoleReconcilersOrDie(
os.Exit(1)
}

r := stacks.NewStackReconciler(consoleClient, k8sClient, args.ControllerCacheTTL(), args.PollInterval(), namespace, args.ConsoleUrl(), args.DeployToken())
r := stacks.NewStackReconciler(consoleClient, k8sClient, args.ControllerCacheTTL(), stacksPollInterval, namespace, args.ConsoleUrl(), args.DeployToken())
return r, nil
})
}

0 comments on commit 019a6e0

Please sign in to comment.