capisdk

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxUpdateRetries = 10

	StatusComponentNameCAPVCD = "cluster-api-provider-cloud-director"

	CAPVCDTypeVendor                    = "vmware"
	CAPVCDTypeNss                       = "capvcdCluster"
	CAPVCDEntityTypePrefix              = "urn:vcloud:type:vmware:capvcdCluster"
	CAPVCDEntityTypeDefaultMajorVersion = "1"

	CAPVCDClusterKind             = "CAPVCDCluster"
	CAPVCDClusterEntityApiVersion = "capvcd.vmware.com/v1.1"
	DefaultRollingWindowSize      = 20

	// VCDCluster Events
	RdeUpgraded           = "RdeUpgraded"
	LoadBalancerAvailable = "LoadBalancerAvailable"
	InfraVappAvailable    = "InfraVappAvailable"
	ControlplaneReady     = "ControlplaneReady"
	LoadbalancerDeleted   = "LoadbalancerDeleted"
	VappDeleted           = "vAppDeleted"

	// VCDCluster Errors
	// Set RdeError for any errors that occurs during Rde update/validation errors
	RdeError = "RdeError"
	// Set LoadBalancerPending for loadBalancer components not created fully
	LoadBalancerPending = "LoadBalancerPending"
	// Set LoadBalancerError for any errors that occurs during load balance components create/get/delete
	LoadBalancerError = "LoadBalancerError"
	// Set VCDClusterVappCreationError for any errors that occurs during cluster creation
	VCDClusterVappCreationError = "VCDClusterVAppCreationError"
	// Set VCDClusterVappDeleteError for any errors that occurs during cluster deletion
	VCDClusterVappDeleteError = "VCDClusterVAppDeleteError"
	// Set VCDClusterError for metadata errors; newVdcManager errors; newGWManager errors
	VCDClusterError = "VCDClusterError"

	// VCDMachine Events
	InfraVmPoweredOn         = "VcdMachineInfraVMPoweredOn"
	CloudInitScriptGenerated = "VcdMachineBootstrapScriptGenerated"
	InfraVmBootstrapped      = "VcdMachineBootstrapped"
	InfraVmDeleted           = "VcdMachineInfraVmDeleted"
	NodeHealthCheckFailed    = "VcdMachineHealthCheckFailedEvent"
	NodeUnhealthy            = "VcdMachineNodeUnhealthy"

	// VCDMachine Errors
	// Set VCDMachineScriptGenerationError for any errors that occurs during the process of generating and setting the script on the VM
	VCDMachineScriptGenerationError = "VcdMachineScriptGenerationError"
	// Set VCDMachineCreationError for any errors that occurs during vcdMachine infrastructure creation
	VCDMachineCreationError = "VcdMachineCreationError"
	// Set VCDMachineScriptExecutionError for any errors that occurs during the process of executing the script on the VM
	VCDMachineScriptExecutionError = "VcdMachineScriptExecutionError"
	// Set VCDMachineDeletionError for any errors that occurs during vcdMachine infrastructure deletion
	VCDMachineDeletionError = "VcdMachineDeletionError"
	// Set VCDMachineError for any errors that occurs during metadata validation, getting newVdcManager/newGateWayManager
	VCDMachineError = "VCDMachineError"
	// Set CAPVCDObjectPatchError for any errors during patch execution of vcdmachine object and vcdcluster object
	CAPVCDObjectPatchError = "CAPVCDObjectPatchError"
)

Variables

This section is empty.

Functions

func CheckIfClusterRdeNeedsUpgrade

func CheckIfClusterRdeNeedsUpgrade(srcRdeTypeVersion string, tgtRdeTypeVersion string) bool

func GetLoadBalancerIpClaimMarker added in v1.3.0

func GetLoadBalancerIpClaimMarker(clusterName string, clusterID string) string

func GetLoadBalancerPoolNamePrefix

func GetLoadBalancerPoolNamePrefix(clusterName string, clusterID string) string

func GetLoadBalancerPoolNameUsingPrefix

func GetLoadBalancerPoolNameUsingPrefix(lbPoolNamePrefix string, portSuffix string) string

func GetVirtualServiceNamePrefix

func GetVirtualServiceNamePrefix(clusterName string, clusterID string) string

func GetVirtualServiceNameUsingPrefix

func GetVirtualServiceNameUsingPrefix(virtualServiceNamePrefix string, portSuffix string) string

Types

type CapvcdRdeManager

type CapvcdRdeManager struct {
	Client     *vcdsdk.Client
	RdeManager *vcdsdk.RDEManager
}

func NewCapvcdRdeManager

func NewCapvcdRdeManager(client *vcdsdk.Client, clusterID string) *CapvcdRdeManager

func (*CapvcdRdeManager) AddToErrorSet

func (capvcdRdeManager *CapvcdRdeManager) AddToErrorSet(ctx context.Context, errorName, vcdResourceId, vcdResourceName, detailedErrorMsg string) error

func (*CapvcdRdeManager) AddToEventSet

func (capvcdRdeManager *CapvcdRdeManager) AddToEventSet(ctx context.Context, eventName, vcdResourceId, vcdResourceName, detailedEventMsg string, skipRDEEventUpdates bool) error

func (*CapvcdRdeManager) CheckForEmptyRDEAndUpdateCreatedByVersions

func (capvcdRdeManager *CapvcdRdeManager) CheckForEmptyRDEAndUpdateCreatedByVersions(ctx context.Context, infraId string) error

CheckForEmptyRDEAndUpdateCreatedByVersions updates createdBy version and also sets the value for capvcdVersion in the RDE

func (*CapvcdRdeManager) ConvertToLatestRDEVersionFormat

func (capvcdRdeManager *CapvcdRdeManager) ConvertToLatestRDEVersionFormat(ctx context.Context, rdeID string) (*swagger.DefinedEntity, error)

ConvertToLatestRDEVersionFormat updates the RDE version. The upgraded RDE will only contain minimal information related to the cluster after upgrade.

CAPVCD will reconcile the RDE eventually with proper data by CAPVCD.

Invokes the right converter to convert the srcRDE into the format of latest RDE version in use

The function attempts upgrade multiple times as defined by MaxUpdateRetries to avoid failures due to incorrect ETag.

func (*CapvcdRdeManager) GetCAPVCDEntity

func (capvcdRdeManager *CapvcdRdeManager) GetCAPVCDEntity(ctx context.Context, rdeID string) (*swagger.DefinedEntity, *rdeType.CAPVCDSpec, *rdeType.Metadata, *rdeType.CAPVCDStatus, error)

GetCAPVCDEntity parses CAPVCDStatus and CAPVCD

func (*CapvcdRdeManager) GetRDEVersion

func (capvcdRdeManager *CapvcdRdeManager) GetRDEVersion(ctx context.Context, rdeID string) (*swagger.DefinedEntity, string, error)

func (*CapvcdRdeManager) IsCapvcdEntityTypeRegistered

func (capvcdRdeManager *CapvcdRdeManager) IsCapvcdEntityTypeRegistered(version string) bool

func (*CapvcdRdeManager) IsVCDKECluster

func (capvcdRdeManager *CapvcdRdeManager) IsVCDKECluster(ctx context.Context, rdeID string) bool

IsVCDKECluster only returns true/false, not return error. all the errors showing inside the function are all checked in the previous code.

func (*CapvcdRdeManager) PatchRDE

func (capvcdRdeManager *CapvcdRdeManager) PatchRDE(ctx context.Context, specPatch, metadataPatch,
	capvcdStatusPatch map[string]interface{}, rdeID string, externalID string, updateExternalID bool) (rde *swagger.DefinedEntity, err error)

PatchRDE : Update only specific fields in the RDE. Takes in a map with keys, which contain "." delimitted strings, representing the spec, metadata and cavcd status fields to be updated. Example: To patch only the "spec.capiYaml", "metadata.name", "status.capvcd.version" portion of the RDE, specPatch map should be something like this - specPatch["CapiYaml"] = updated-yaml metadataPatch["Name"] = updated-name capvcdStatusPatch["Version"] = updated-version

func (*CapvcdRdeManager) SetIsManagementClusterInRDE

func (capvcdRdeManager *CapvcdRdeManager) SetIsManagementClusterInRDE(ctx context.Context, managementClusterRDEId string) error

SetIsManagementClusterInRDE : sets the isManagementCluster flag in RDE for the management cluster

type EntityType

type EntityType struct {
	ID      string                 `json:"id"`
	Name    string                 `json:"name"`
	Nss     string                 `json:"nss"`
	Version string                 `json:"version"`
	Schema  map[string]interface{} `json:"schema"`
}

EntityType contains only the required properties in get entity type response

Jump to

Keyboard shortcuts

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