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
// CreateVMRequeueDelay is the requeue delay that is used to retry a VM
// create that was unable to handled because MaxDeployThreadsOnProvider
// creates where already in progress.
// Defaults to 10 seconds.
CreateVMRequeueDelay time.Duration
// PoweredOnVMHasIPRequeueDelay is the requeue delay that is when a VM
// is powered on but does not yet have an IP assigned. This is used so
// the VM Status is updated sooner than waiting for the SyncPeriod to
// occur.
// Defaults to 10 seconds.
PoweredOnVMHasIPRequeueDelay time.Duration
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
// LogSensitiveData means that logs will potentially contain sensitive data
// such as passwords. Defaults to false.
LogSensitiveData bool
// AsyncSignalDisabled may be set to true to disable the vm-watcher service
// used to reconcile VirtualMachine objects if their backend state has
// changed.
//
// Please note, this flag has no impact if Features.WorkloadDomainIsolation
// is false.
//
// Defaults to false.
AsyncSignalDisabled bool
// AsyncCreateDisabled may be set to true to disable non-blocking create
// operations.
//
// Please note, this flag has no impact if AsyncSignalDisabled is true.
//
// Defaults to false.
AsyncCreateDisabled bool
}
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 FeatureStates struct {
IsoSupport bool // FSS_WCP_VMSERVICE_ISO_SUPPORT
InstanceStorage bool // FSS_WCP_INSTANCE_STORAGE
K8sWorkloadMgmtAPI bool // FSS_WCP_VMSERVICE_K8S_WORKLOAD_MGMT_API
PodVMOnStretchedSupervisor bool // FSS_PODVMONSTRETCHEDSUPERVISOR
TKGMultipleCL bool // to be fetched dynamically from capability
// TODO(akutz) This FSS is a placeholder until leadership can figure out the
// plan for FSSs going forward.
UnifiedStorageQuota bool // FSS_PLACEHOLDER_WCP_UNIFIED_STORAGE_QUOTA
VMResize bool // FSS_WCP_VMSERVICE_RESIZE
VMResizeCPUMemory bool // FSS_WCP_VMSERVICE_RESIZE_CPU_MEMORY
VMImportNewNet bool // FSS_WCP_MOBILITY_VM_IMPORT_NEW_NET
WorkloadDomainIsolation bool // FSS_WCP_WORKLOAD_DOMAIN_ISOLATION
VMIncrementalRestore bool // FSS_WCP_VMSERVICE_INCREMENTAL_RESTORE
BringYourOwnEncryptionKey bool // FSS_WCP_VMSERVICE_BYOK
SVAsyncUpgrade bool // FSS_WCP_SUPERVISOR_ASYNC_UPGRADE
// TODO(akutz) This FSS is placeholder.
FastDeploy bool // FSS_WCP_VMSERVICE_FAST_DEPLOY
}
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" )