Documentation ¶
Index ¶
- func JoinContext(parent context.Context, contextWithConfig context.Context) context.Context
- func NewContext() context.Context
- func NewContextWithDefaultConfig() context.Context
- func SetContext(ctx context.Context, setFn func(config *Config))
- func SliceToString(s []string) string
- func StringToSet(s string) map[string]struct{}
- func StringToSlice(s string) []string
- func UpdateContext(ctx context.Context, setFn func(config *Config)) context.Context
- func WithConfig(config Config) context.Context
- func WithContext(parent context.Context, config Config) context.Context
- type Config
- type FeatureStates
- type InstanceStorage
- type NetworkProviderType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JoinContext ¶
JoinContext returns a new context that contains a reference to the Config from the specified context. This function panics if the provided context does not contain a Config. This function is thread-safe.
func NewContext ¶
NewContext returns a new context with an empty Config.
func NewContextWithDefaultConfig ¶
NewContextWithDefaultConfig returns a new context with a default Config.
func SetContext ¶
SetContext allows the Config in the provided context to be updated. This function panics if the provided context is nil, does not contain a Config, or setFn is nil. This function is thread-safe.
func SliceToString ¶
SliceToString returns a comma-separated string for the provided slice. Any "," characters in the elements themselves are escaped with the "\" character. Empty elements or elements that are empty after all leading/trailing white- space is trimmed are ignored.
func StringToSet ¶
func StringToSlice ¶
func UpdateContext ¶
UpdateContext allows the Config in the provided context to be updated. This function returns the same context passed into the ctx parameter. This function panics if the provided context is nil, does not contain a Config, or setFn is nil. This function is thread-safe.
func WithConfig ¶
WithConfig returns a new context with the provided Config.
Types ¶
type Config ¶
type Config struct { BuildCommit string BuildNumber string BuildVersion string BuildType string ContainerNode bool ContentAPIWait time.Duration JSONExtraConfig string // DefaultVMClassControllerName is the default value for the // VirtualMachineClass field spec.controllerName. // // Defaults to vmoperator.vmware.com/vsphere. DefaultVMClassControllerName string // Features reflects the feature states. Features FeatureStates // InstanceStorage contains configuration details related to the instance // storage feature. InstanceStorage InstanceStorage LeaderElectionID string MaxConcurrentReconciles int // MaxCreateVMsOnProvider is the percentage of reconciler threads that can // be used to create VMs on the provider concurrently. // // Defaults to 80. MaxCreateVMsOnProvider int // MaxDeployThreadsOnProvider is the number of threads used to deploy VMs // concurrently. // // Callers should not read this value directly, instead callers should use // the GetMaxDeployThreadsOnProvider function. MaxDeployThreadsOnProvider int NetworkProviderType NetworkProviderType VSphereNetworking bool LoadBalancerProvider string PodName string PodNamespace string PodServiceAccountName string // PrivilegedUsers is a comma-delimited a list of users that are, in // addition to the kube-admin and system users, treated as privileged by // VM Operator, ex. allowed to make changes to certain // annotations/labels/properties on resources. // // For information as to why this field is not a []string, please see the // GoDocs for the Config type. PrivilegedUsers string ProfilerAddr string RateLimitBurst int RateLimitQPS int SyncPeriod time.Duration WatchNamespace string WebhookServiceContainerPort int WebhookServiceName string WebhookServiceNamespace string WebhookSecretName string WebhookSecretNamespace string WebhookSecretVolumeMountPath string }
Config represents the internal configuration of VM Operator. It should only be read/written via the context functions.
Please note that all fields in this type MUST be types that are copied by value, not reference. That means no string slices, maps, etc. The reason is to prevent the possibility of race conditions when reading/writing data to a Config instance stored in a context.
func FromContext ¶
FromContext returns the Config from the provided context. This function panics if the provided context is nil or does not contain a Config. This function is thread-safe.
func FromEnv ¶
func FromEnv() Config
FromEnv returns a new Config that has been initialized from environment variables.
func (Config) GetMaxDeployThreadsOnProvider ¶
GetMaxDeployThreadsOnProvider returns MaxDeployThreadsOnProvider if it is >0 or returns a percentage of MaxConcurrentReconciles based on MaxCreateVMsOnProvider.
type FeatureStates ¶
type InstanceStorage ¶
type InstanceStorage struct { // PVPlacementFailedTTL is the wait time before declaring PV placement // failed after the error annotation is set on a PVC. // // Defaults to 5m. PVPlacementFailedTTL time.Duration // JitterMaxFactor is used to configure the exponential backoff jitter for // instance storage. // // Please note that wait.Jitter sets the maxFactor to 1.0 if the input // maxFactor is <= 0.0. For example, with a max factor of 1.0 and seed // duration of 10s, wait.Jitter returns a requeue delay between 11 and 19. // These numbers ensures multiple reconcile threads are not requeuing at the // same intervals. // // Defaults to 1.0. JitterMaxFactor float64 // SeedRequeueDuration is the seed value for requeuing reconcile attempts // related to instance storage resources. // // Defaults to 10s. SeedRequeueDuration time.Duration }
type NetworkProviderType ¶
type NetworkProviderType string
const ( NetworkProviderTypeNamed NetworkProviderType = "NAMED" NetworkProviderTypeNSXT NetworkProviderType = "NSXT" NetworkProviderTypeVDS NetworkProviderType = "VSPHERE_NETWORK" NetworkProviderTypeVPC NetworkProviderType = "NSXT_VPC" )