Skip to content

Commit

Permalink
Add a flag on controllers to configure resyncPeriod
Browse files Browse the repository at this point in the history
This should allow advanced user/cluster-admin to configure the
resyncPeriod to a value that fit their cluster instead of relying on
the default 10h one.

This is related to #3676.

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester committed Jun 5, 2024
1 parent 9e71884 commit e47c4df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"log"
"net/http"
"os"
"time"

"github.com/tektoncd/pipeline/pkg/apis/pipeline"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
Expand Down Expand Up @@ -56,6 +57,7 @@ func main() {
flag.StringVar(&opts.Images.ShellImage, "shell-image", "", "The container image containing a shell")
flag.StringVar(&opts.Images.ShellImageWin, "shell-image-win", "", "The container image containing a windows shell")
flag.StringVar(&opts.Images.WorkingDirInitImage, "workingdirinit-image", "", "The container image containing our working dir init binary.")
flag.DurationVar(&opts.ResyncPeriod, "resync-period", controller.DefaultResyncPeriod, "The period between two resync run (going through all objects)")

// This parses flags.
cfg := injection.ParseAndGetRESTConfigOrDie()
Expand Down Expand Up @@ -98,6 +100,8 @@ func main() {
}()

ctx = filteredinformerfactory.WithSelectors(ctx, v1beta1.ManagedByLabelKey)
ctx = controller.WithResyncPeriod(ctx, opts.ResyncPeriod)

sharedmain.MainWithConfig(ctx, ControllerLogKey, cfg,
taskrun.NewController(opts, clock.RealClock{}),
pipelinerun.NewController(opts, clock.RealClock{}),
Expand Down
5 changes: 4 additions & 1 deletion pkg/apis/pipeline/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ limitations under the License.

package pipeline

import "time"

// Options holds options passed to the Tekton Pipeline controllers
// typically via command-line flags.
type Options struct {
Images Images
Images Images
ResyncPeriod time.Duration
}

0 comments on commit e47c4df

Please sign in to comment.