Skip to content

Commit c2dc17a

Browse files
vdemeestertekton-robot
authored andcommitted
Add a flag on controllers to configure resyncPeriod
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 tektoncd#3676. Signed-off-by: Vincent Demeester <[email protected]>
1 parent 89ff137 commit c2dc17a

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

cmd/controller/main.go

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func main() {
5656
flag.StringVar(&opts.Images.ShellImage, "shell-image", "", "The container image containing a shell")
5757
flag.StringVar(&opts.Images.ShellImageWin, "shell-image-win", "", "The container image containing a windows shell")
5858
flag.StringVar(&opts.Images.WorkingDirInitImage, "workingdirinit-image", "", "The container image containing our working dir init binary.")
59+
flag.DurationVar(&opts.ResyncPeriod, "resync-period", controller.DefaultResyncPeriod, "The period between two resync run (going through all objects)")
5960

6061
// This parses flags.
6162
cfg := injection.ParseAndGetRESTConfigOrDie()
@@ -98,6 +99,8 @@ func main() {
9899
}()
99100

100101
ctx = filteredinformerfactory.WithSelectors(ctx, v1beta1.ManagedByLabelKey)
102+
ctx = controller.WithResyncPeriod(ctx, opts.ResyncPeriod)
103+
101104
sharedmain.MainWithConfig(ctx, ControllerLogKey, cfg,
102105
taskrun.NewController(opts, clock.RealClock{}),
103106
pipelinerun.NewController(opts, clock.RealClock{}),

docs/tekton-controller-flags.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!--
2+
---
3+
linkTitle: "Tekton Controllers flags"
4+
weight: 105
5+
---
6+
-->
7+
8+
# Tekton Controllers flags
9+
10+
The different controllers `tektoncd/pipeline` ships comes with a set of flags
11+
that can be changed (in the `yaml` payloads) for advanced use cases. This page
12+
is documenting them.
13+
14+
## Common set of flags
15+
16+
The following flags are available on all "controllers", aka `controller`, `webhook`, `events` and `resolvers`.
17+
18+
```
19+
-add_dir_header
20+
If true, adds the file directory to the header of the log messages
21+
-alsologtostderr
22+
log to standard error as well as files (no effect when -logtostderr=true)
23+
-cluster string
24+
Defaults to the current cluster in kubeconfig.
25+
-disable-ha
26+
Whether to disable high-availability functionality for this component. This flag will be deprecated and removed when we have promoted this feature to stable, so do not pass it without filing an issue upstream!
27+
-kube-api-burst int
28+
Maximum burst for throttle.
29+
-kube-api-qps float
30+
Maximum QPS to the server from the client.
31+
-kubeconfig string
32+
Path to a kubeconfig. Only required if out-of-cluster.
33+
-log_backtrace_at value
34+
when logging hits line file:N, emit a stack trace
35+
-log_dir string
36+
If non-empty, write log files in this directory (no effect when -logtostderr=true)
37+
-log_file string
38+
If non-empty, use this log file (no effect when -logtostderr=true)
39+
-log_file_max_size uint
40+
Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
41+
-logtostderr
42+
log to standard error instead of files (default true)
43+
-one_output
44+
If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)
45+
-server string
46+
The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
47+
-skip_headers
48+
If true, avoid header prefixes in the log messages
49+
-skip_log_headers
50+
If true, avoid headers when opening log files (no effect when -logtostderr=true)
51+
-stderrthreshold value
52+
logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=false) (default 2)
53+
-v value
54+
number for the log level verbosity
55+
-vmodule value
56+
comma-separated list of pattern=N settings for file-filtered logging
57+
```
58+
59+
## `controller`
60+
61+
The main controller binary has additional flags to configure its behavior.
62+
63+
```
64+
-entrypoint-image string
65+
The container image containing our entrypoint binary.
66+
-namespace string
67+
Namespace to restrict informer to. Optional, defaults to all namespaces.
68+
-nop-image string
69+
The container image used to stop sidecars
70+
-resync-period duration
71+
The period between two resync run (going through all objects) (default 10h0m0s)
72+
-shell-image string
73+
The container image containing a shell
74+
-shell-image-win string
75+
The container image containing a windows shell
76+
-sidecarlogresults-image string
77+
The container image containing the binary for accessing results.
78+
-threads-per-controller int
79+
Threads (goroutines) to create per controller (default 2)
80+
-workingdirinit-image string
81+
The container image containing our working dir init binary.
82+
```

pkg/apis/pipeline/options.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ limitations under the License.
1616

1717
package pipeline
1818

19+
import "time"
20+
1921
// Options holds options passed to the Tekton Pipeline controllers
2022
// typically via command-line flags.
2123
type Options struct {
22-
Images Images
24+
Images Images
25+
ResyncPeriod time.Duration
2326
}

0 commit comments

Comments
 (0)