restconfig

package
v1.13.1-rc.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout = 5 * time.Second

DefaultTimeout is the default REST config timeout.

Variables

View Source
var CurrentContextName = currentContextNameFromConfig

CurrentContextName returns the name of the currently active k8s context as a string Can be changed in tests by reassigning this pointer.

Functions

func AllKubectlConfigs

func AllKubectlConfigs(timeout time.Duration) (map[string]*rest.Config, error)

AllKubectlConfigs creates a config for every context available in the kubeconfig. The configs are mapped by context name. There is no way to detect unhealthy clusters specified by a context, so timeout can be used to prevent calls to those clusters from hanging for long periods of time.

func MonoRepoRestClient added in v1.13.1

func MonoRepoRestClient(timeout time.Duration) (*rest.Config, error)

MonoRepoRestClient will attempt to create a new rest config from all configured options and return the first successfully created configuration. It always enables the client-side throttling to fix the commit stuck in the inProgress state issue. It is only used in the legacy mono-repo mode.

func NewConfigFlags

func NewConfigFlags(config *rest.Config) (*genericclioptions.ConfigFlags, error)

NewConfigFlags builds ConfigFlags based on an existing rest config. Burst QPS is increased by 3x for discovery. CacheDir is populated from the KUBECACHEDIR env var, if set.

func NewRestConfig

func NewRestConfig(timeout time.Duration) (*rest.Config, error)

NewRestConfig will attempt to create a new rest config from all configured options and return the first successfully created configuration. The client-side throttling is only determined by if server-side flow control is enabled or not. If server-side flow control is enabled, then client-side throttling is disabled, vice versa. It is used by the multi-repo mode.

func UpdateQPS

func UpdateQPS(config *rest.Config, isMonoRepo bool)

UpdateQPS modifies a rest.Config to update the client-side throttling QPS and Burst QPS.

If it is running in the legacy mono-repo mode, set the client-side throttling: QPS: 20, burst 40.

If it is the new multi-repo mode: - If Flow Control is enabled on the apiserver, and client-side throttling is not forced to be enabled, client-side throttling is disabled! - If Flow Control is disabled or undetected on the apiserver, client-side throttling QPS will be increased to at least 30 (burst: 60).

Flow Control is enabled by default on Kubernetes v1.20+. https://kubernetes.io/docs/concepts/cluster-administration/flow-control/

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL