Documentation ¶
Overview ¶
Package cloudstack is a generated GoMock package.
Index ¶
- Constants
- func GetCloudstackExecConfig(ctx context.Context, cli client.Client, ...) (*decoder.CloudStackExecConfig, error)
- func GetMachineTemplate(ctx context.Context, client kubernetes.Client, name, namespace string) (*cloudstackv1.CloudStackMachineTemplate, error)
- func MachineDeployments(clusterSpec *cluster.Spec, ...) map[string]*clusterv1.MachineDeployment
- func MachineTemplate(name string, machineConfig *v1alpha1.CloudStackMachineConfigSpec) *cloudstackv1.CloudStackMachineTemplate
- func NeedNewMachineTemplate(oldDatacenterConfig, newDatacenterConfig *v1alpha1.CloudStackDatacenterConfig, ...) bool
- func NeedsNewKubeadmConfigTemplate(newWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration, ...) bool
- func NeedsNewWorkloadTemplate(oldSpec, newSpec *cluster.Spec, ...) bool
- func NewProvider(datacenterConfig *v1alpha1.CloudStackDatacenterConfig, ...) *cloudstackProvider
- type BaseControlPlane
- type CmkBuilder
- type ControlPlane
- type MockProviderValidator
- func (m *MockProviderValidator) EXPECT() *MockProviderValidatorMockRecorder
- func (m *MockProviderValidator) ValidateCloudStackDatacenterConfig(arg0 context.Context, arg1 *v1alpha1.CloudStackDatacenterConfig) error
- func (m *MockProviderValidator) ValidateClusterMachineConfigs(arg0 context.Context, arg1 *cluster.Spec) error
- func (m *MockProviderValidator) ValidateControlPlaneEndpointUniqueness(arg0 string) error
- func (m *MockProviderValidator) ValidateSecretsUnchanged(arg0 context.Context, arg1 *types.Cluster, arg2 *decoder.CloudStackExecConfig, ...) error
- type MockProviderValidatorMockRecorder
- func (mr *MockProviderValidatorMockRecorder) ValidateCloudStackDatacenterConfig(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockProviderValidatorMockRecorder) ValidateClusterMachineConfigs(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockProviderValidatorMockRecorder) ValidateControlPlaneEndpointUniqueness(arg0 interface{}) *gomock.Call
- func (mr *MockProviderValidatorMockRecorder) ValidateSecretsUnchanged(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- type MockValidatorRegistry
- type MockValidatorRegistryMockRecorder
- type ProviderCmkClient
- type ProviderKubectlClient
- type ProviderValidator
- type TemplateBuilder
- type Validator
- func (v *Validator) ValidateCloudStackDatacenterConfig(ctx context.Context, datacenterConfig *anywherev1.CloudStackDatacenterConfig) error
- func (v *Validator) ValidateClusterMachineConfigs(ctx context.Context, clusterSpec *cluster.Spec) error
- func (v *Validator) ValidateControlPlaneEndpointUniqueness(endpoint string) error
- func (v *Validator) ValidateSecretsUnchanged(ctx context.Context, cluster *types.Cluster, ...) error
- type ValidatorFactory
- type ValidatorRegistry
- type Workers
Constants ¶
const CloudStackMachineTemplateKind = "CloudStackMachineTemplate"
CloudStackMachineTemplateKind defines the K8s Kind corresponding with the MachineTemplate.
Variables ¶
This section is empty.
Functions ¶
func GetCloudstackExecConfig ¶ added in v0.16.0
func GetCloudstackExecConfig(ctx context.Context, cli client.Client, datacenterConfig *v1alpha1.CloudStackDatacenterConfig) (*decoder.CloudStackExecConfig, error)
GetCloudstackExecConfig gets cloudstack exec config from secrets.
func GetMachineTemplate ¶ added in v0.16.0
func GetMachineTemplate(ctx context.Context, client kubernetes.Client, name, namespace string) (*cloudstackv1.CloudStackMachineTemplate, error)
GetMachineTemplate gets a CloudStackMachineTemplate object using the provided client If the object doesn't exist, it returns a NotFound error.
func MachineDeployments ¶ added in v0.13.0
func MachineDeployments(clusterSpec *cluster.Spec, kubeadmConfigTemplates map[string]*bootstrapv1.KubeadmConfigTemplate, machineTemplates map[string]*cloudstackv1.CloudStackMachineTemplate) map[string]*clusterv1.MachineDeployment
MachineDeployments returns generated CAPI MachineDeployment objects for a given cluster spec.
func MachineTemplate ¶ added in v0.13.0
func MachineTemplate(name string, machineConfig *v1alpha1.CloudStackMachineConfigSpec) *cloudstackv1.CloudStackMachineTemplate
MachineTemplate returns a generated CloudStackMachineTemplate object for a given EKS-A CloudStackMachineConfig.
func NeedNewMachineTemplate ¶ added in v0.16.0
func NeedNewMachineTemplate( oldDatacenterConfig, newDatacenterConfig *v1alpha1.CloudStackDatacenterConfig, oldMachineConfig, newMachineConfig *v1alpha1.CloudStackMachineConfig, log logr.Logger, ) bool
NeedNewMachineTemplate Used by EKS-A controller and CLI upgrade workflow to compare generated CSDC/CSMC's from CAPC resources in fetcher.go with those already on the cluster when deciding whether or not to generate and apply new CloudStackMachineTemplates.
func NeedsNewKubeadmConfigTemplate ¶ added in v0.9.0
func NeedsNewKubeadmConfigTemplate(newWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration, oldWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration) bool
func NeedsNewWorkloadTemplate ¶ added in v0.9.0
func NeedsNewWorkloadTemplate(oldSpec, newSpec *cluster.Spec, oldCsdc, newCsdc *v1alpha1.CloudStackDatacenterConfig, oldCsmc, newCsmc *v1alpha1.CloudStackMachineConfig, oldWorker, newWorker *v1alpha1.WorkerNodeGroupConfiguration, log logr.Logger) bool
NeedsNewWorkloadTemplate determines if a new workload template is needed.
func NewProvider ¶
func NewProvider(datacenterConfig *v1alpha1.CloudStackDatacenterConfig, clusterConfig *v1alpha1.Cluster, providerKubectlClient ProviderKubectlClient, validator ProviderValidator, writer filewriter.FileWriter, now types.NowFunc, log logr.Logger) *cloudstackProvider
NewProvider initializes the CloudStack provider object.
Types ¶
type BaseControlPlane ¶ added in v0.16.0
type BaseControlPlane = clusterapi.ControlPlane[*cloudstackv1.CloudStackCluster, *cloudstackv1.CloudStackMachineTemplate]
BaseControlPlane represents a CAPI CloudStack control plane.
type CmkBuilder ¶ added in v0.13.0
type CmkBuilder interface {
BuildCloudstackClient(writer filewriter.FileWriter, config *decoder.CloudStackExecConfig) (ProviderCmkClient, error)
}
CmkBuilder defines the interface to be consumed by the ValidatorFactory which enables it to build a new CloudStackClient.
type ControlPlane ¶ added in v0.16.0
type ControlPlane struct {
BaseControlPlane
}
ControlPlane holds the CloudStack specific objects for a CAPI CloudStack control plane.
func ControlPlaneSpec ¶ added in v0.16.0
func ControlPlaneSpec(ctx context.Context, logger logr.Logger, client kubernetes.Client, clusterSpec *cluster.Spec) (*ControlPlane, error)
ControlPlaneSpec builds a CloudStack ControlPlane definition based on an eks-a cluster spec.
func (ControlPlane) Objects ¶ added in v0.16.0
func (p ControlPlane) Objects() []kubernetes.Object
Objects returns the control plane objects associated with the CloudStack cluster.
type MockProviderValidator ¶ added in v0.13.0
type MockProviderValidator struct {
// contains filtered or unexported fields
}
MockProviderValidator is a mock of ProviderValidator interface.
func NewMockProviderValidator ¶ added in v0.13.0
func NewMockProviderValidator(ctrl *gomock.Controller) *MockProviderValidator
NewMockProviderValidator creates a new mock instance.
func (*MockProviderValidator) EXPECT ¶ added in v0.13.0
func (m *MockProviderValidator) EXPECT() *MockProviderValidatorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockProviderValidator) ValidateCloudStackDatacenterConfig ¶ added in v0.13.0
func (m *MockProviderValidator) ValidateCloudStackDatacenterConfig(arg0 context.Context, arg1 *v1alpha1.CloudStackDatacenterConfig) error
ValidateCloudStackDatacenterConfig mocks base method.
func (*MockProviderValidator) ValidateClusterMachineConfigs ¶ added in v0.13.0
func (m *MockProviderValidator) ValidateClusterMachineConfigs(arg0 context.Context, arg1 *cluster.Spec) error
ValidateClusterMachineConfigs mocks base method.
func (*MockProviderValidator) ValidateControlPlaneEndpointUniqueness ¶ added in v0.13.0
func (m *MockProviderValidator) ValidateControlPlaneEndpointUniqueness(arg0 string) error
ValidateControlPlaneEndpointUniqueness mocks base method.
func (*MockProviderValidator) ValidateSecretsUnchanged ¶ added in v0.15.0
func (m *MockProviderValidator) ValidateSecretsUnchanged(arg0 context.Context, arg1 *types.Cluster, arg2 *decoder.CloudStackExecConfig, arg3 ProviderKubectlClient) error
ValidateSecretsUnchanged mocks base method.
type MockProviderValidatorMockRecorder ¶ added in v0.13.0
type MockProviderValidatorMockRecorder struct {
// contains filtered or unexported fields
}
MockProviderValidatorMockRecorder is the mock recorder for MockProviderValidator.
func (*MockProviderValidatorMockRecorder) ValidateCloudStackDatacenterConfig ¶ added in v0.13.0
func (mr *MockProviderValidatorMockRecorder) ValidateCloudStackDatacenterConfig(arg0, arg1 interface{}) *gomock.Call
ValidateCloudStackDatacenterConfig indicates an expected call of ValidateCloudStackDatacenterConfig.
func (*MockProviderValidatorMockRecorder) ValidateClusterMachineConfigs ¶ added in v0.13.0
func (mr *MockProviderValidatorMockRecorder) ValidateClusterMachineConfigs(arg0, arg1 interface{}) *gomock.Call
ValidateClusterMachineConfigs indicates an expected call of ValidateClusterMachineConfigs.
func (*MockProviderValidatorMockRecorder) ValidateControlPlaneEndpointUniqueness ¶ added in v0.13.0
func (mr *MockProviderValidatorMockRecorder) ValidateControlPlaneEndpointUniqueness(arg0 interface{}) *gomock.Call
ValidateControlPlaneEndpointUniqueness indicates an expected call of ValidateControlPlaneEndpointUniqueness.
func (*MockProviderValidatorMockRecorder) ValidateSecretsUnchanged ¶ added in v0.15.0
func (mr *MockProviderValidatorMockRecorder) ValidateSecretsUnchanged(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
ValidateSecretsUnchanged indicates an expected call of ValidateSecretsUnchanged.
type MockValidatorRegistry ¶ added in v0.16.0
type MockValidatorRegistry struct {
// contains filtered or unexported fields
}
MockValidatorRegistry is a mock of ValidatorRegistry interface.
func NewMockValidatorRegistry ¶ added in v0.16.0
func NewMockValidatorRegistry(ctrl *gomock.Controller) *MockValidatorRegistry
NewMockValidatorRegistry creates a new mock instance.
func (*MockValidatorRegistry) EXPECT ¶ added in v0.16.0
func (m *MockValidatorRegistry) EXPECT() *MockValidatorRegistryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockValidatorRegistry) Get ¶ added in v0.16.0
func (m *MockValidatorRegistry) Get(arg0 *decoder.CloudStackExecConfig) (ProviderValidator, error)
Get mocks base method.
type MockValidatorRegistryMockRecorder ¶ added in v0.16.0
type MockValidatorRegistryMockRecorder struct {
// contains filtered or unexported fields
}
MockValidatorRegistryMockRecorder is the mock recorder for MockValidatorRegistry.
func (*MockValidatorRegistryMockRecorder) Get ¶ added in v0.16.0
func (mr *MockValidatorRegistryMockRecorder) Get(arg0 interface{}) *gomock.Call
Get indicates an expected call of Get.
type ProviderCmkClient ¶
type ProviderCmkClient interface { GetManagementApiEndpoint(profile string) (string, error) ValidateServiceOfferingPresent(ctx context.Context, profile string, zoneId string, serviceOffering anywherev1.CloudStackResourceIdentifier) error ValidateDiskOfferingPresent(ctx context.Context, profile string, zoneId string, diskOffering anywherev1.CloudStackResourceDiskOffering) error ValidateTemplatePresent(ctx context.Context, profile string, domainId string, zoneId string, account string, template anywherev1.CloudStackResourceIdentifier) error ValidateAffinityGroupsPresent(ctx context.Context, profile string, domainId string, account string, affinityGroupIds []string) error ValidateZoneAndGetId(ctx context.Context, profile string, zone anywherev1.CloudStackZone) (string, error) ValidateNetworkPresent(ctx context.Context, profile string, domainId string, network anywherev1.CloudStackResourceIdentifier, zoneId string, account string) error ValidateDomainAndGetId(ctx context.Context, profile string, domain string) (string, error) ValidateAccountPresent(ctx context.Context, profile string, account string, domainId string) error }
ProviderCmkClient defines the methods used by Cmk as a separate interface to be mockable when injected into other objects.
type ProviderKubectlClient ¶
type ProviderKubectlClient interface { ApplyKubeSpecFromBytes(ctx context.Context, cluster *types.Cluster, data []byte) error CreateNamespaceIfNotPresent(ctx context.Context, kubeconfig string, namespace string) error LoadSecret(ctx context.Context, secretObject string, secretObjType string, secretObjectName string, kubeConfFile string) error GetEksaCluster(ctx context.Context, cluster *types.Cluster, clusterName string) (*v1alpha1.Cluster, error) GetEksaCloudStackDatacenterConfig(ctx context.Context, cloudstackDatacenterConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.CloudStackDatacenterConfig, error) GetEksaCloudStackMachineConfig(ctx context.Context, cloudstackMachineConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.CloudStackMachineConfig, error) GetKubeadmControlPlane(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*kubeadmv1beta1.KubeadmControlPlane, error) GetMachineDeployment(ctx context.Context, workerNodeGroupName string, opts ...executables.KubectlOpt) (*clusterv1.MachineDeployment, error) GetEtcdadmCluster(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*etcdv1beta1.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 SearchCloudStackMachineConfig(ctx context.Context, name string, kubeconfigFile string, namespace string) ([]*v1alpha1.CloudStackMachineConfig, error) SearchCloudStackDatacenterConfig(ctx context.Context, name string, kubeconfigFile string, namespace string) ([]*v1alpha1.CloudStackDatacenterConfig, error) DeleteEksaCloudStackDatacenterConfig(ctx context.Context, cloudstackDatacenterConfigName string, kubeconfigFile string, namespace string) error DeleteEksaCloudStackMachineConfig(ctx context.Context, cloudstackMachineConfigName string, kubeconfigFile string, namespace string) error SetEksaControllerEnvVar(ctx context.Context, envVar, envVarVal, kubeconfig string) error }
type ProviderValidator ¶ added in v0.13.0
type ProviderValidator interface { ValidateCloudStackDatacenterConfig(ctx context.Context, datacenterConfig *anywherev1.CloudStackDatacenterConfig) error ValidateClusterMachineConfigs(ctx context.Context, clusterSpec *cluster.Spec) error ValidateControlPlaneEndpointUniqueness(endpoint string) error ValidateSecretsUnchanged(ctx context.Context, cluster *types.Cluster, execConfig *decoder.CloudStackExecConfig, client ProviderKubectlClient) error }
ProviderValidator exposes a common interface to avoid coupling on implementation details and to support mocking.
type TemplateBuilder ¶ added in v0.16.0
type TemplateBuilder struct {
// contains filtered or unexported fields
}
TemplateBuilder is responsible for building the CAPI templates.
func NewTemplateBuilder ¶ added in v0.16.0
func NewTemplateBuilder(now types.NowFunc) *TemplateBuilder
NewTemplateBuilder creates a new TemplateBuilder.
func (*TemplateBuilder) GenerateCAPISpecControlPlane ¶ added in v0.16.0
func (cs *TemplateBuilder) GenerateCAPISpecControlPlane(clusterSpec *cluster.Spec, buildOptions ...providers.BuildMapOption) (content []byte, err error)
GenerateCAPISpecControlPlane builds the CAPI controlplane template containing the CAPI objects for the control plane configuration defined in the cluster.Spec.
func (*TemplateBuilder) GenerateCAPISpecWorkers ¶ added in v0.16.0
func (cs *TemplateBuilder) GenerateCAPISpecWorkers(clusterSpec *cluster.Spec, workloadTemplateNames, kubeadmconfigTemplateNames map[string]string) (content []byte, err error)
GenerateCAPISpecWorkers builds the CAPI worker template containing the CAPI objects for the worker node groups configuration defined in the cluster.Spec.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator(cmk ProviderCmkClient, netClient networkutils.NetClient, skipIpCheck bool) *Validator
func (*Validator) ValidateCloudStackDatacenterConfig ¶
func (v *Validator) ValidateCloudStackDatacenterConfig(ctx context.Context, datacenterConfig *anywherev1.CloudStackDatacenterConfig) error
func (*Validator) ValidateClusterMachineConfigs ¶
func (v *Validator) ValidateClusterMachineConfigs(ctx context.Context, clusterSpec *cluster.Spec) error
TODO: dry out machine configs validations. Cyclomatic complexity is high. The exception below can probably be removed once the above todo is done. nolint:gocyclo
func (*Validator) ValidateControlPlaneEndpointUniqueness ¶ added in v0.12.0
func (*Validator) ValidateSecretsUnchanged ¶ added in v0.15.0
func (v *Validator) ValidateSecretsUnchanged(ctx context.Context, cluster *types.Cluster, execConfig *decoder.CloudStackExecConfig, client ProviderKubectlClient) error
ValidateSecretsUnchanged checks the secret to see if it has not been changed.
type ValidatorFactory ¶ added in v0.13.0
type ValidatorFactory struct {
// contains filtered or unexported fields
}
ValidatorFactory implements the ValidatorRegistry interface and holds the necessary structs for building fresh Validator objects.
func NewValidatorFactory ¶ added in v0.13.0
func NewValidatorFactory(builder CmkBuilder, writer filewriter.FileWriter, skipIPCheck bool) ValidatorFactory
NewValidatorFactory initializes a factory for the CloudStack provider validator.
func (ValidatorFactory) Get ¶ added in v0.13.0
func (r ValidatorFactory) Get(execConfig *decoder.CloudStackExecConfig) (ProviderValidator, error)
Get returns a validator for a particular cloudstack exec config.
type ValidatorRegistry ¶ added in v0.13.0
type ValidatorRegistry interface {
Get(execConfig *decoder.CloudStackExecConfig) (ProviderValidator, error)
}
ValidatorRegistry exposes a single method for retrieving the CloudStack validator, and abstracts away how they are injected.
type Workers ¶ added in v0.16.0
type Workers = clusterapi.Workers[*cloudstackv1.CloudStackMachineTemplate]
Workers represents the cloudstack specific CAPI spec for worker nodes.
func WorkersSpec ¶ added in v0.16.0
func WorkersSpec(ctx context.Context, logger logr.Logger, client kubernetes.Client, spec *cluster.Spec) (*Workers, error)
WorkersSpec generates a cloudstack 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.