cloudstack

package
v0.14.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

README

CloudStack Provider

The original CloudStack provider template was generated with clusterctl

Documentation

Overview

Package cloudstack is a generated GoMock package.

Index

Constants

View Source
const CloudStackMachineTemplateKind = "CloudStackMachineTemplate"

CloudStackMachineTemplateKind defines the K8s Kind corresponding with the MachineTemplate.

Variables

This section is empty.

Functions

func AnyImmutableFieldChanged added in v0.9.0

func AnyImmutableFieldChanged(generatedCsdc, actualCsdc *v1alpha1.CloudStackDatacenterConfig, generatedCsmc, actualCsmc *v1alpha1.CloudStackMachineConfig, log logr.Logger) bool

AnyImmutableFieldChanged 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 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

MachineTemplate returns a generated CloudStackMachineTemplate object for a given EKS-A CloudStackMachineConfig.

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, log logr.Logger) bool

func NewCloudStackTemplateBuilder added in v0.9.0

func NewCloudStackTemplateBuilder(CloudStackDatacenterConfigSpec *v1alpha1.CloudStackDatacenterConfigSpec, controlPlaneMachineSpec, etcdMachineSpec *v1alpha1.CloudStackMachineConfigSpec, workerNodeGroupMachineSpecs map[string]v1alpha1.CloudStackMachineConfigSpec, now types.NowFunc) providers.TemplateBuilder

func NewProvider

func NewProvider(datacenterConfig *v1alpha1.CloudStackDatacenterConfig, machineConfigs map[string]*v1alpha1.CloudStackMachineConfig, 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 CloudStackTemplateBuilder

type CloudStackTemplateBuilder struct {
	WorkerNodeGroupMachineSpecs map[string]v1alpha1.CloudStackMachineConfigSpec
	// contains filtered or unexported fields
}

func (*CloudStackTemplateBuilder) GenerateCAPISpecControlPlane

func (cs *CloudStackTemplateBuilder) GenerateCAPISpecControlPlane(clusterSpec *cluster.Spec, buildOptions ...providers.BuildMapOption) (content []byte, err error)

func (*CloudStackTemplateBuilder) GenerateCAPISpecWorkers

func (cs *CloudStackTemplateBuilder) GenerateCAPISpecWorkers(clusterSpec *cluster.Spec, workloadTemplateNames, kubeadmconfigTemplateNames map[string]string) (content []byte, err error)

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 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

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 *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.

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.

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, cloudStackClusterSpec *Spec) error
	ValidateControlPlaneEndpointUniqueness(endpoint string) error
}

ProviderValidator exposes a common interface to avoid coupling on implementation details and to support mocking.

type Spec

type Spec struct {
	*cluster.Spec
	// contains filtered or unexported fields
}

func NewSpec

func NewSpec(clusterSpec *cluster.Spec, machineConfigs map[string]*anywherev1.CloudStackMachineConfig, datacenterConfig *anywherev1.CloudStackDatacenterConfig) *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, cloudStackClusterSpec *Spec) error

TODO: dry out machine configs validations.

func (*Validator) ValidateControlPlaneEndpointUniqueness added in v0.12.0

func (v *Validator) ValidateControlPlaneEndpointUniqueness(endpoint string) error

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

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.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL