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 abitility to set QPS and Burst limits for api client #2667

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
5 changes: 5 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func init() {
flag.BoolVar(&outOfCluster, "outofcluster", false, "Whether the operator runs in- our outside of the Kubernetes cluster.")
flag.BoolVar(&config.NoDatabaseAccess, "nodatabaseaccess", false, "Disable all access to the database from the operator side.")
flag.BoolVar(&config.NoTeamsAPI, "noteamsapi", false, "Disable all access to the teams API")
flag.IntVar(&config.KubeQPS, "kubeqps", 5, "Kubernetes api requests per second.")
flag.IntVar(&config.KubeBurst, "kubeburst", 10, "Kubernetes api requests burst limit.")
Comment on lines +38 to +39
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flag.IntVar(&config.KubeQPS, "kubeqps", 5, "Kubernetes api requests per second.")
flag.IntVar(&config.KubeBurst, "kubeburst", 10, "Kubernetes api requests burst limit.")
flag.IntVar(&config.KubeQPS, "kubeqps", 50, "Kubernetes api requests per second.")
flag.IntVar(&config.KubeBurst, "kubeburst", 100, "Kubernetes api requests burst limit.")

I read, that default is 50 and 100. Can we use these values instead? For some reason the owner references e2e test keeps failing and I don't know why.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, these were values from kubelet and not REST config. 5 and 10 are probably right. But maybe we can still increase to see if e2e tests succeed.

Copy link
Author

@Demch1k Demch1k Nov 2, 2024

Choose a reason for hiding this comment

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

No problem, you can increase it for tests.
But for default values I recommend use smaller like default values because it can affect on api servers.

Copy link
Member

Choose a reason for hiding this comment

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

ok then better keep the defaults here. Buty any idea, why the owner references check e2e test starts failing with this change. Maybe we add these 2 new config values to the config of our kind cluster, too.

flag.Parse()

config.EnableJsonLogging = os.Getenv("ENABLE_JSON_LOGGING") == "true"
Expand Down Expand Up @@ -83,6 +85,9 @@ func main() {
log.Fatalf("couldn't get REST config: %v", err)
}

config.RestConfig.QPS = float32(config.KubeQPS)
config.RestConfig.Burst = config.KubeBurst

c := controller.NewController(&config, "")

c.Run(stop, wg)
Expand Down
3 changes: 3 additions & 0 deletions pkg/spec/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ type ControllerConfig struct {
IgnoredAnnotations []string

EnableJsonLogging bool

KubeQPS int
KubeBurst int
}

// cached value for the GetOperatorNamespace
Expand Down
Loading