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
// 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
// SyncImageRequeueDelay is the requeue delay that is used to requeue an
// image that wants to be synced but is not yet ready.
// Defaults to 10 seconds.
SyncImageRequeueDelay time.Duration
// SnapshotInProgressRequeueDelay is the requeue delay that is
// used to requeue when a snapshot is in progress. This is used so
// we can come back and update the status of the snapshot of the
// snapshot.
// Defaults to 10 seconds.
SnapshotInProgressRequeueDelay time.Duration
NetworkProviderType NetworkProviderType
VSphereNetworking bool
LoadBalancerProvider string
PodName string
PodNamespace string
PodServiceAccountName string
DeploymentName string
// SIGUSR2RestartEnabled allows SIGUSR2 to cause the pod to restart.
SIGUSR2RestartEnabled bool
// 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
// AsyncSignalEnabled may be set to false to disable the vm-watcher service
// used to reconcile VirtualMachine objects if their backend state has
// changed.
//
// Defaults to true.
AsyncSignalEnabled bool
// AsyncCreateEnabled may be set to false to disable non-blocking create
// operations.
//
// Please note, this flag has no impact if AsyncSignalDisabled is true.
//
// Defaults to true.
AsyncCreateEnabled bool
// MemStatsPeriod describes the interval at which memory statistics are
// emitted to the log file.
//
// Defaults to 10m.
MemStatsPeriod time.Duration
// FastDeployMode determines the default mode for Fast Deploy
// feature.
//
// Please note, this flag has no impact if the Fast Deploy feature is not
// enabled.
//
// The valid values are "direct" and "linked." If the FSS is enabled and:
//
// - the value is "direct," then the VM is deployed using cached disks.
// - the value is "linked," then the VM is deployed as a linked clone.
// - the value is empty, then "direct" mode is used.
// - the value is anything else, then fast deploy is not used to deploy
// VMs.
//
// Defaults to "direct".
FastDeployMode string
// VCCredsSecretName is the name of the secret in the pod namespace that
// contains the VC credentials.
//
// Defaults to "wcp-vmop-sa-vc-auth".
VCCredsSecretName string
// CRDCleanupEnabled indicates to delete CRDs or remove their fields when a
// feature/capability is disabled.
//
// Please note, this field has no effect if a CRD is being installed for the
// first time.
CRDCleanupEnabled 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 {
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
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
FastDeploy bool // FSS_WCP_VMSERVICE_FAST_DEPLOY
MutableNetworks bool
VMGroups bool
ImmutableClasses bool
VMSnapshots bool
InventoryContentLibrary bool
VMPlacementPolicies bool
VSpherePolicies bool
VMWaitForFirstConsumerPVC bool
GuestCustomizationVCDParity bool
AllDisksArePVCs bool
}
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" )