Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QPS and Burst kube api client parameters as CLI arguments #233

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func main() {
requeueDependency time.Duration
logOptions logger.Options
watchAllNamespaces bool
kubeapiQPS float64
kubeapiBurst int
)
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&eventsAddr, "events-addr", "", "The address of the events receiver.")
Expand All @@ -75,6 +77,8 @@ func main() {
flag.BoolVar(&watchAllNamespaces, "watch-all-namespaces", true,
"Watch for custom resources in all namespaces, if set to false it will only watch the runtime namespace.")
flag.Bool("log-json", false, "Set logging to JSON format.")
flag.Float64Var(&kubeapiQPS, "kube-api-qps", 20.0, "QPS to use while talking with kubernetes API.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values are the defaults in ctrl.GetConfigOrDie(), so why supply them as flag defaults?

In Flagger based on a several load tests, we decided to set the defaults to 100/250: https://github.com/fluxcd/flagger/blob/main/cmd/flagger/main.go#L88-L89

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My logic was not to broke something. I don't know possibly side effects of changing default values. This values worked before PR, and they will work after. If you want to change it, you could see actual values and decide how you want to increase them.

I can change it to 100/250 if you want

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flag.IntVar(&kubeapiBurst, "kube-api-burst", 50, "Burst to use while talking with kubernetes API server.")
flag.CommandLine.MarkDeprecated("log-json", "Please use --log-encoding=json instead.")
{
var fs goflag.FlagSet
Expand Down Expand Up @@ -103,7 +107,11 @@ func main() {
watchNamespace = os.Getenv("RUNTIME_NAMESPACE")
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
restConfig := ctrl.GetConfigOrDie()
restConfig.QPS = float32(kubeapiQPS)
restConfig.Burst = kubeapiBurst

mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
HealthProbeBindAddress: healthAddr,
Expand Down