Documentation
¶
Index ¶
- Constants
- func AnyImmutableFieldChanged(oldVdc, newVdc *v1alpha1.VSphereDatacenterConfig, ...) bool
- func FailureDomainTemplateName(spec *cluster.Spec, failureDomainName string) string
- func NeedsNewControlPlaneTemplate(oldSpec, newSpec *cluster.Spec, ...) bool
- func NeedsNewEtcdTemplate(oldSpec, newSpec *cluster.Spec, ...) bool
- func NeedsNewKubeadmConfigTemplate(newWorkerNodeGroup, oldWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration, ...) bool
- func NeedsNewWorkloadTemplate(oldSpec, newSpec *cluster.Spec, ...) bool
- func NewProvider(datacenterConfig *v1alpha1.VSphereDatacenterConfig, ...) *vsphereProvider
- func NewProviderCustomNet(datacenterConfig *v1alpha1.VSphereDatacenterConfig, ...) *vsphereProvider
- func SetupEnvVars(datacenterConfig *anywherev1.VSphereDatacenterConfig) error
- type BaseControlPlane
- type ControlPlane
- type ControlPlaneBuilder
- type Defaulter
- type FailureDomainGroup
- type FailureDomains
- type FailureDomainsBuilder
- func (fb *FailureDomainsBuilder) BuildFromParsed(lookup yamlutil.ObjectLookup) error
- func (fb *FailureDomainsBuilder) ProcessFailureDomainGroupObjects(g *FailureDomainGroup, lookup yamlutil.ObjectLookup)
- func (fb *FailureDomainsBuilder) ProcessFailureDomainObjects(f *FailureDomains, lookup yamlutil.ObjectLookup)
- type FailureDomainsYamlProcessor
- type IPValidator
- type MachineConfigCount
- type PrivAssociation
- type ProviderGovcClient
- type ProviderKubectlClient
- type Spec
- type VSphereClientBuilder
- type Validator
- func (v *Validator) ValidateClusterMachineConfigs(ctx context.Context, vsphereClusterSpec *Spec) error
- func (v *Validator) ValidateFailureDomains(vsphereClusterSpec *Spec) error
- func (v *Validator) ValidateVCenterConfig(ctx context.Context, datacenterConfig *anywherev1.VSphereDatacenterConfig) error
- type VsphereTemplateBuilder
- func (vs *VsphereTemplateBuilder) CAPIWorkersSpecWithInitialNames(spec *cluster.Spec) (content []byte, err error)
- func (vs *VsphereTemplateBuilder) GenerateCAPISpecControlPlane(clusterSpec *cluster.Spec, buildOptions ...providers.BuildMapOption) (content []byte, err error)
- func (vs *VsphereTemplateBuilder) GenerateCAPISpecWorkers(clusterSpec *cluster.Spec, ...) (content []byte, err error)
- func (vs *VsphereTemplateBuilder) GenerateVsphereFailureDomainsSpec(spec *cluster.Spec, templateNames map[string]string) (content []byte, err error)
- type Workers
Constants ¶
const ( // VsphereDataCenterConfigNameLabel is label for VsphereDataCenter name in Cluster.Spec.VsphereDataCenter.Name. VsphereDataCenterConfigNameLabel = "infrastructure.cluster.x-k8s.io/vsphere-datacenter-config-name" // ClusterNameLabel is label for cluster name. ClusterNameLabel = "infrastructure.cluster.x-k8s.io/cluster-name" )
const ( CredentialsObjectName = "vsphere-credentials" MemoryAvailable = "Memory_Available" )
const ( // VSphereFailureDomainKind is kind for capv failure domain. VSphereFailureDomainKind = "VSphereFailureDomain" // VSphereDeploymentZoneKind is kind for capv vsphere deployment zone. VSphereDeploymentZoneKind = "VSphereDeploymentZone" )
Variables ¶
This section is empty.
Functions ¶
func AnyImmutableFieldChanged ¶
func AnyImmutableFieldChanged(oldVdc, newVdc *v1alpha1.VSphereDatacenterConfig, oldVmc, newVmc *v1alpha1.VSphereMachineConfig) bool
func FailureDomainTemplateName ¶ added in v0.22.0
FailureDomainTemplateName generates the template name for failure domain.
func NeedsNewControlPlaneTemplate ¶
func NeedsNewControlPlaneTemplate(oldSpec, newSpec *cluster.Spec, oldVdc, newVdc *v1alpha1.VSphereDatacenterConfig, oldVmc, newVmc *v1alpha1.VSphereMachineConfig) bool
func NeedsNewEtcdTemplate ¶
func NeedsNewEtcdTemplate(oldSpec, newSpec *cluster.Spec, oldVdc, newVdc *v1alpha1.VSphereDatacenterConfig, oldVmc, newVmc *v1alpha1.VSphereMachineConfig) bool
func NeedsNewKubeadmConfigTemplate ¶ added in v0.7.1
func NeedsNewKubeadmConfigTemplate(newWorkerNodeGroup, oldWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration, oldWorkerNodeVmc, newWorkerNodeVmc *v1alpha1.VSphereMachineConfig) bool
func NeedsNewWorkloadTemplate ¶
func NeedsNewWorkloadTemplate(oldSpec, newSpec *cluster.Spec, oldVdc, newVdc *v1alpha1.VSphereDatacenterConfig, oldVmc, newVmc *v1alpha1.VSphereMachineConfig, oldWorker, newWorker v1alpha1.WorkerNodeGroupConfiguration) bool
NeedsNewWorkloadTemplate determines if a new workload template is needed.
func NewProvider ¶
func NewProvider( datacenterConfig *v1alpha1.VSphereDatacenterConfig, clusterConfig *v1alpha1.Cluster, providerGovcClient ProviderGovcClient, providerKubectlClient ProviderKubectlClient, writer filewriter.FileWriter, ipValidator IPValidator, now types.NowFunc, skipIPCheck bool, skippedValidations map[string]bool, ) *vsphereProvider
NewProvider initializes and returns a new vsphereProvider.
func NewProviderCustomNet ¶
func NewProviderCustomNet( datacenterConfig *v1alpha1.VSphereDatacenterConfig, clusterConfig *v1alpha1.Cluster, providerGovcClient ProviderGovcClient, providerKubectlClient ProviderKubectlClient, writer filewriter.FileWriter, ipValidator IPValidator, now types.NowFunc, skipIPCheck bool, v *Validator, skippedValidations map[string]bool, ) *vsphereProvider
NewProviderCustomNet initializes and returns a new vsphereProvider.
func SetupEnvVars ¶ added in v0.7.0
func SetupEnvVars(datacenterConfig *anywherev1.VSphereDatacenterConfig) error
Types ¶
type BaseControlPlane ¶ added in v0.13.0
type BaseControlPlane = clusterapi.ControlPlane[*vspherev1.VSphereCluster, *vspherev1.VSphereMachineTemplate]
BaseControlPlane represents a CAPI VSphere control plane.
type ControlPlane ¶ added in v0.13.0
type ControlPlane struct { BaseControlPlane Secrets []*corev1.Secret ConfigMaps []*corev1.ConfigMap ClusterResourceSets []*addonsv1.ClusterResourceSet }
ControlPlane holds the VSphere specific objects for a CAPI VSphere control plane.
func ControlPlaneSpec ¶ added in v0.13.0
func ControlPlaneSpec(ctx context.Context, logger logr.Logger, client kubernetes.Client, spec *cluster.Spec) (*ControlPlane, error)
ControlPlaneSpec builds a vsphere ControlPlane definition based on an eks-a cluster spec.
func (ControlPlane) Objects ¶ added in v0.13.0
func (p ControlPlane) Objects() []kubernetes.Object
Objects returns the control plane objects associated with the VSphere cluster.
type ControlPlaneBuilder ¶ added in v0.13.0
type ControlPlaneBuilder struct { BaseBuilder *yamlcapi.ControlPlaneBuilder[*vspherev1.VSphereCluster, *vspherev1.VSphereMachineTemplate] ControlPlane *ControlPlane }
ControlPlaneBuilder defines the builder for all objects in the CAPI VSphere control plane.
func (*ControlPlaneBuilder) BuildFromParsed ¶ added in v0.13.0
func (b *ControlPlaneBuilder) BuildFromParsed(lookup yamlutil.ObjectLookup) error
BuildFromParsed implements the base yamlcapi.BuildFromParsed and processes any additional objects for the VSphere control plane.
type Defaulter ¶ added in v0.7.0
type Defaulter struct {
// contains filtered or unexported fields
}
func NewDefaulter ¶ added in v0.7.0
func NewDefaulter(govc ProviderGovcClient) *Defaulter
func (*Defaulter) SetDefaultsForDatacenterConfig ¶ added in v0.7.0
func (d *Defaulter) SetDefaultsForDatacenterConfig(ctx context.Context, datacenterConfig *anywherev1.VSphereDatacenterConfig) error
type FailureDomainGroup ¶ added in v0.22.0
type FailureDomainGroup struct { VsphereDeploymentZone *vspherev1.VSphereDeploymentZone VsphereFailureDomain *vspherev1.VSphereFailureDomain }
FailureDomainGroup represents the Vsphere failure domains objects group.
type FailureDomains ¶ added in v0.22.0
type FailureDomains struct {
Groups []FailureDomainGroup
}
FailureDomains represents the list of failure domain groups.
func FailureDomainsSpec ¶ added in v0.22.0
FailureDomainsSpec generates a vSphere Failure domains spec for the cluster.
func (*FailureDomains) Objects ¶ added in v0.22.0
func (f *FailureDomains) Objects() []client.Object
Objects returns a list of API objects for a collection of failure domain groups.
type FailureDomainsBuilder ¶ added in v0.22.0
type FailureDomainsBuilder struct {
FailureDomains *FailureDomains
}
FailureDomainsBuilder implements yamlutil.Builder It's a wrapper around FailureDomains to provide yaml parsing functionality.
func (*FailureDomainsBuilder) BuildFromParsed ¶ added in v0.22.0
func (fb *FailureDomainsBuilder) BuildFromParsed(lookup yamlutil.ObjectLookup) error
BuildFromParsed reads parsed objects in ObjectLookup and sets them in the FailureDomains.
func (*FailureDomainsBuilder) ProcessFailureDomainGroupObjects ¶ added in v0.22.0
func (fb *FailureDomainsBuilder) ProcessFailureDomainGroupObjects(g *FailureDomainGroup, lookup yamlutil.ObjectLookup)
ProcessFailureDomainGroupObjects looks in the parsed objects for the VsphereFailureDomain by the kind, apiversion and VsphereFailureDomain name. Once it is found, it sets in the FailureDomainGroup. VsphereDeploymentZone needs to be already set in the FailureDomainGroup.
func (*FailureDomainsBuilder) ProcessFailureDomainObjects ¶ added in v0.22.0
func (fb *FailureDomainsBuilder) ProcessFailureDomainObjects(f *FailureDomains, lookup yamlutil.ObjectLookup)
ProcessFailureDomainObjects finds all necessary objects in the parsed objects and sets them in FailureDomains.
type FailureDomainsYamlProcessor ¶ added in v0.22.0
type FailureDomainsYamlProcessor struct {
// contains filtered or unexported fields
}
FailureDomainsYamlProcessor handles parsing and transformation of failure domains YAML into FailureDomains Objects.
func NewFailureDomainsYamlProcessor ¶ added in v0.22.0
func NewFailureDomainsYamlProcessor(logger logr.Logger) *FailureDomainsYamlProcessor
NewFailureDomainsYamlProcessor initializes and returns a new FailureDomainsYamlProcessor.
func (*FailureDomainsYamlProcessor) ProcessYAML ¶ added in v0.22.0
func (fbp *FailureDomainsYamlProcessor) ProcessYAML(failureDomainYaml []byte) (*FailureDomains, error)
ProcessYAML processes the YAML content and returns the failure domains.
type IPValidator ¶ added in v0.13.0
IPValidator is an interface that defines methods to validate the control plane IP.
type MachineConfigCount ¶ added in v0.18.0
type MachineConfigCount struct { *anywherev1.VSphereMachineConfig Count int }
MachineConfigCount represents a machineConfig with it's associated count.
type PrivAssociation ¶ added in v0.11.2
type PrivAssociation struct {
// contains filtered or unexported fields
}
type ProviderGovcClient ¶
type ProviderGovcClient interface { SearchTemplate(ctx context.Context, datacenter, template string) (string, error) LibraryElementExists(ctx context.Context, library string) (bool, error) GetLibraryElementContentVersion(ctx context.Context, element string) (string, error) DeleteLibraryElement(ctx context.Context, element string) error TemplateHasSnapshot(ctx context.Context, template string) (bool, error) GetWorkloadAvailableSpace(ctx context.Context, datastore string) (float64, error) ValidateVCenterSetupMachineConfig(ctx context.Context, datacenterConfig *v1alpha1.VSphereDatacenterConfig, machineConfig *v1alpha1.VSphereMachineConfig, selfSigned *bool) error ValidateVCenterConnection(ctx context.Context, server string) error ValidateVCenterAuthentication(ctx context.Context) error IsCertSelfSigned(ctx context.Context) bool GetCertThumbprint(ctx context.Context) (string, error) ConfigureCertThumbprint(ctx context.Context, server, thumbprint string) error DatacenterExists(ctx context.Context, datacenter string) (bool, error) NetworkExists(ctx context.Context, network string) (bool, error) CreateLibrary(ctx context.Context, datastore, library string) error DeployTemplateFromLibrary(ctx context.Context, templateDir, templateName, library, datacenter, datastore, network, resourcePool string, resizeDisk2 bool) error ImportTemplate(ctx context.Context, library, ovaURL, name string) error GetVMDiskSizeInGB(ctx context.Context, vm, datacenter string) (int, error) GetTags(ctx context.Context, path string) (tags []string, err error) ListTags(ctx context.Context) ([]executables.Tag, error) CreateTag(ctx context.Context, tag, category string) error AddTag(ctx context.Context, path, tag string) error ListCategories(ctx context.Context) ([]string, error) CreateCategoryForVM(ctx context.Context, name string) error CreateUser(ctx context.Context, username, password string) error UserExists(ctx context.Context, username string) (bool, error) CreateGroup(ctx context.Context, name string) error GroupExists(ctx context.Context, name string) (bool, error) AddUserToGroup(ctx context.Context, name, username string) error RoleExists(ctx context.Context, name string) (bool, error) CreateRole(ctx context.Context, name string, privileges []string) error SetGroupRoleOnObject(ctx context.Context, principal, role, object, domain string) error GetHardDiskSize(ctx context.Context, vm, datacenter string) (map[string]float64, error) GetResourcePoolInfo(ctx context.Context, datacenter, resourcepool string, args ...string) (map[string]int, error) }
type ProviderKubectlClient ¶
type ProviderKubectlClient interface { ApplyKubeSpecFromBytes(ctx context.Context, cluster *types.Cluster, data []byte) error CreateNamespaceIfNotPresent(ctx context.Context, kubeconfig, namespace string) error LoadSecret(ctx context.Context, secretObject, secretObjType, secretObjectName, kubeConfFile string) error GetEksaCluster(ctx context.Context, cluster *types.Cluster, clusterName string) (*v1alpha1.Cluster, error) GetEksaVSphereDatacenterConfig(ctx context.Context, vsphereDatacenterConfigName, kubeconfigFile, namespace string) (*v1alpha1.VSphereDatacenterConfig, error) GetEksaVSphereMachineConfig(ctx context.Context, vsphereMachineConfigName, kubeconfigFile, namespace string) (*v1alpha1.VSphereMachineConfig, error) GetMachineDeployment(ctx context.Context, machineDeploymentName string, opts ...executables.KubectlOpt) (*clusterv1.MachineDeployment, error) GetKubeadmControlPlane(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*controlplanev1.KubeadmControlPlane, error) GetEtcdadmCluster(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*etcdv1.EtcdadmCluster, error) GetSecretFromNamespace(ctx context.Context, kubeconfigFile, name, namespace string) (*corev1.Secret, error) UpdateAnnotation(ctx context.Context, resourceType, objectName string, annotations map[string]string, opts ...executables.KubectlOpt) error RemoveAnnotationInNamespace(ctx context.Context, resourceType, objectName, key string, cluster *types.Cluster, namespace string) error SearchVsphereMachineConfig(ctx context.Context, name, kubeconfigFile, namespace string) ([]*v1alpha1.VSphereMachineConfig, error) SearchVsphereDatacenterConfig(ctx context.Context, name, kubeconfigFile, namespace string) ([]*v1alpha1.VSphereDatacenterConfig, error) SetDaemonSetImage(ctx context.Context, kubeconfigFile, name, namespace, container, image string) error DeleteEksaDatacenterConfig(ctx context.Context, vsphereDatacenterResourceType, vsphereDatacenterConfigName, kubeconfigFile, namespace string) error DeleteEksaMachineConfig(ctx context.Context, vsphereMachineResourceType, vsphereMachineConfigName, kubeconfigFile, namespace string) error ApplyTolerationsFromTaintsToDaemonSet(ctx context.Context, oldTaints, newTaints []corev1.Taint, dsName, kubeconfigFile string) error }
type VSphereClientBuilder ¶ added in v0.11.2
type Validator ¶ added in v0.7.0
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶ added in v0.7.0
func NewValidator(govc ProviderGovcClient, vscb VSphereClientBuilder) *Validator
NewValidator initializes the client for VSphere provider validations.
func (*Validator) ValidateClusterMachineConfigs ¶ added in v0.7.0
func (v *Validator) ValidateClusterMachineConfigs(ctx context.Context, vsphereClusterSpec *Spec) error
ValidateClusterMachineConfigs validates all the attributes of etcd, control plane, and worker node VSphereMachineConfigs.
func (*Validator) ValidateFailureDomains ¶ added in v0.22.0
ValidateFailureDomains validates the provided list of failure domains.
func (*Validator) ValidateVCenterConfig ¶ added in v0.7.0
func (v *Validator) ValidateVCenterConfig(ctx context.Context, datacenterConfig *anywherev1.VSphereDatacenterConfig) error
type VsphereTemplateBuilder ¶
type VsphereTemplateBuilder struct {
// contains filtered or unexported fields
}
func NewVsphereTemplateBuilder ¶
func NewVsphereTemplateBuilder( now types.NowFunc, ) *VsphereTemplateBuilder
func (*VsphereTemplateBuilder) CAPIWorkersSpecWithInitialNames ¶ added in v0.13.0
func (vs *VsphereTemplateBuilder) CAPIWorkersSpecWithInitialNames(spec *cluster.Spec) (content []byte, err error)
CAPIWorkersSpecWithInitialNames generates a yaml spec with the CAPI objects representing the worker nodes for a particular eks-a cluster. It uses default initial names (ended in '-1') for the vsphere machine templates and kubeadm config templates.
func (*VsphereTemplateBuilder) GenerateCAPISpecControlPlane ¶ added in v0.6.0
func (vs *VsphereTemplateBuilder) GenerateCAPISpecControlPlane( clusterSpec *cluster.Spec, buildOptions ...providers.BuildMapOption, ) (content []byte, err error)
func (*VsphereTemplateBuilder) GenerateCAPISpecWorkers ¶ added in v0.6.0
func (*VsphereTemplateBuilder) GenerateVsphereFailureDomainsSpec ¶ added in v0.22.0
func (vs *VsphereTemplateBuilder) GenerateVsphereFailureDomainsSpec(spec *cluster.Spec, templateNames map[string]string) (content []byte, err error)
GenerateVsphereFailureDomainsSpec generates a yaml spec with the Vsphere failure domains objects. It uses the provided template names for the VsphereFailureDomain and VsphereDeploymentZone.
type Workers ¶ added in v0.13.0
type Workers = clusterapi.Workers[*vspherev1.VSphereMachineTemplate]
Workers represents the vSphere specific CAPI spec for worker nodes.
func WorkersSpec ¶ added in v0.13.0
func WorkersSpec(ctx context.Context, logger logr.Logger, client kubernetes.Client, spec *cluster.Spec) (*Workers, error)
WorkersSpec generates a vSphere specific CAPI spec for an eks-a cluster worker nodes. It talks to the cluster with a client to detect changes in immutable objects and generates new names for them.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
internal
|
|
tags/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
templates/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |