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

Configurable burst_limit #1012

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions helm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ func Provider() *schema.Provider {
}
},
},
"burst_limit": {
Type: schema.TypeInt,
Optional: true,
Default: 100,
Description: "Helm burst limit. Increase this if you have a cluster with many CRDs",
},
"kubernetes": {
Type: schema.TypeList,
MaxItems: 1,
Expand Down
7 changes: 5 additions & 2 deletions helm/structure_kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
type KubeConfig struct {
ClientConfig clientcmd.ClientConfig

Burst int

sync.Mutex
}

Expand All @@ -44,7 +46,7 @@ func (k *KubeConfig) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, er
// The more groups you have, the more discovery requests you need to make.
// given 25 groups (our groups + a few custom resources) with one-ish version each, discovery needs to make 50 requests
// double it just so we don't end up here again for a while. This config is only used for discovery.
config.Burst = 100
config.Burst = k.Burst

return memcached.NewMemCacheClient(discovery.NewDiscoveryClientForConfigOrDie(config)), nil
}
Expand Down Expand Up @@ -186,6 +188,7 @@ func newKubeConfig(configData *schema.ResourceData, namespace *string) (*KubeCon
if namespace != nil {
overrides.Context.Namespace = *namespace
}
burstLimit := configData.Get("burst_limit").(int)

client := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loader, overrides)
if client == nil {
Expand All @@ -194,5 +197,5 @@ func newKubeConfig(configData *schema.ResourceData, namespace *string) (*KubeCon
}
log.Printf("[INFO] Successfully initialized kubernetes config")

return &KubeConfig{ClientConfig: client}, nil
return &KubeConfig{ClientConfig: client, Burst: burstLimit}, nil
}
1 change: 1 addition & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ The following arguments are supported:
* `repository_cache` - (Optional) The path to the file containing cached repository indexes. Defaults to `HELM_REPOSITORY_CACHE` env if it is set, otherwise uses the default path set by helm.
* `helm_driver` - (Optional) "The backend storage driver. Valid values are: `configmap`, `secret`, `memory`, `sql`. Defaults to `secret`.
Note: Regarding the sql driver, as of helm v3.2.0 SQL support exists only for the postgres dialect. The connection string can be configured by setting the `HELM_DRIVER_SQL_CONNECTION_STRING` environment variable e.g. `HELM_DRIVER_SQL_CONNECTION_STRING=postgres://username:password@host/dbname` more info [here](https://pkg.go.dev/github.com/lib/pq).
* `burst_limit` - (Optional) The helm burst limit to use. Set this value higher if your cluster has many CRDs. Default: `100`
* `kubernetes` - Kubernetes configuration block.
* `registry` - Private OCI registry configuration block. Can be specified multiple times.

Expand Down