Documentation ¶
Overview ¶
Package client implements core functionality of the tkg client
Index ¶
- Constants
- Variables
- func DeleteContextFromKubeConfig(kubeconfigPath, context string) error
- func GetCurrentClusterKubeConfigFromFile(kubeConfigPath string) ([]byte, error)
- func MergeKubeConfigAndSwitchContext(kubeConfig []byte, mergeFile string) (string, error)
- func MergeKubeConfigWithoutSwitchContext(kubeConfig []byte, mergeFile string) error
- func ParseProviderName(provider string) (name, providerVersion string, err error)
- func TimedExecution(command func() error) (time.Duration, error)
- type ApplyProvidersUpgradeOptions
- type Client
- type ClusterCeipInfo
- type ClusterConfigOptions
- type ClusterIPFamily
- type ClusterInfo
- type ClusterPinnipedInfo
- type Components
- type CreateClusterOptions
- type DeleteMachineDeploymentOptions
- type DeleteRegionOptions
- type DeleteWorkloadClusterOptions
- type DescribeTKGClustersOptions
- type GetClusterPinnipedInfoOptions
- type GetMachineDeploymentOptions
- type GetWorkloadClusterCredentialsOptions
- type InitRegionOptions
- type KubernetesVersionsInfo
- type ListTKGClustersOptions
- type MachineHealthCheck
- type MachineHealthCheckOptions
- type NodePool
- type NodeSizeOptions
- type Options
- type Provider
- type ScaleClusterOptions
- type SetMachineDeploymentOptions
- type SetMachineHealthCheckOptions
- type TKGClusterPhase
- type TKGClusterType
- type TkgClient
- func (c *TkgClient) ActivateTanzuKubernetesReleases(tkrName string) error
- func (c *TkgClient) AddRegionContext(r region.RegionContext, overwrite, useDirectReference bool) error
- func (c *TkgClient) BuildRegionalClusterConfiguration(options *InitRegionOptions) ([]byte, string, error)
- func (c *TkgClient) ConfigureAndValidateAWSConfig(tkrVersion string, nodeSizes NodeSizeOptions, ...) error
- func (c *TkgClient) ConfigureAndValidateAwsConfig(tkrVersion string, skipValidation, isProdConfig bool, workerMachineCount int64, ...) error
- func (c *TkgClient) ConfigureAndValidateAzureConfig(tkrVersion string, nodeSizes NodeSizeOptions, ...) error
- func (c *TkgClient) ConfigureAndValidateCNIType(cniType string) error
- func (c *TkgClient) ConfigureAndValidateDockerConfig(tkrVersion string, nodeSizes NodeSizeOptions, skipValidation bool) error
- func (c *TkgClient) ConfigureAndValidateHTTPProxyConfiguration(infrastructureName string) error
- func (c *TkgClient) ConfigureAndValidateManagementClusterConfiguration(options *InitRegionOptions, skipValidation bool) *ValidationError
- func (c *TkgClient) ConfigureAndValidateNameserverConfiguration() error
- func (c *TkgClient) ConfigureAndValidateTkrVersion(tkrVersion string) (string, string, error)
- func (c *TkgClient) ConfigureAndValidateVSphereTemplate(vcClient vc.Client, tkrVersion, dc string) error
- func (c *TkgClient) ConfigureAndValidateVsphereConfig(tkrVersion string, nodeSizes NodeSizeOptions, vip string, skipValidation bool, ...) *ValidationError
- func (c *TkgClient) ConfigureAndValidateWorkloadClusterConfiguration(options *CreateClusterOptions, clusterClient clusterclient.Client, ...) error
- func (c *TkgClient) ConfigureAzureVMImage(tkrVersion string) error
- func (c *TkgClient) ConfigureTimeout(timeout time.Duration)
- func (c *TkgClient) CreateAWSCloudFormationStack() error
- func (c *TkgClient) CreateCluster(options *CreateClusterOptions, waitForCluster bool) error
- func (c *TkgClient) CreateMachineHealthCheck(clusterClient clusterclient.Client, options *SetMachineHealthCheckOptions) error
- func (c *TkgClient) DeRegisterManagementClusterFromTmc(clusterName string) error
- func (c *TkgClient) DeactivateTanzuKubernetesReleases(tkrName string) error
- func (c *TkgClient) DeleteMachineDeployment(options DeleteMachineDeploymentOptions) error
- func (c *TkgClient) DeleteMachineHealthCheck(options MachineHealthCheckOptions) error
- func (c *TkgClient) DeleteMachineHealthCheckWithClusterClient(clusterClient clusterclient.Client, options MachineHealthCheckOptions) error
- func (c *TkgClient) DeleteRegion(options DeleteRegionOptions) error
- func (c *TkgClient) DeleteWorkloadCluster(options DeleteWorkloadClusterOptions) error
- func (c *TkgClient) DescribeCluster(options DescribeTKGClustersOptions) (*clusterctltree.ObjectTree, *clusterv1.Cluster, *clusterctlv1.ProviderList, ...)
- func (c *TkgClient) DescribeProvider() (*clusterctlv1.ProviderList, error)
- func (c *TkgClient) DistributeMachineDeploymentWorkers(workerMachineCount int64, isProdConfig, isManagementCluster bool, ...) ([]int, error)
- func (c *TkgClient) DoClusterUpgrade(regionalClusterClient clusterclient.Client, ...) error
- func (c *TkgClient) DoCreateCluster(clusterClient clusterclient.Client, name, namespace, manifest string) error
- func (c *TkgClient) DoGetCEIPParticipation(clusterClient clusterclient.Client, clusterName string) (ClusterCeipInfo, error)
- func (c *TkgClient) DoGetTanzuKubernetesReleases(regionalClusterClient clusterclient.Client) (*KubernetesVersionsInfo, error)
- func (c *TkgClient) DoPacificClusterUpgrade(regionalClusterClient clusterclient.Client, options *UpgradeClusterOptions) error
- func (c *TkgClient) DoProvidersUpgrade(regionalClusterClient clusterclient.Client, ctx string, ...) error
- func (c *TkgClient) DoScaleCluster(clusterClient clusterclient.Client, options *ScaleClusterOptions) error
- func (c *TkgClient) DoSetCEIPParticipation(clusterClient clusterclient.Client, context region.RegionContext, ...) error
- func (c *TkgClient) DoUpgradeAddon(regionalClusterClient clusterclient.Client, ...) error
- func (c *TkgClient) DownloadBomFile(tkrName string) error
- func (c *TkgClient) EncodeAWSCredentialsAndGetClient(clusterClient clusterclient.Client) (aws.Client, error)
- func (c *TkgClient) EncodeAzureCredentialsAndGetClient(clusterClient clusterclient.Client) (azure.Client, error)
- func (c *TkgClient) GenerateProvidersUpgradeOptions(pUpgradeInfo *providersUpgradeInfo) (*ApplyProvidersUpgradeOptions, error)
- func (c *TkgClient) GetAWSCreds() (*credentials.AWSCredentials, error)
- func (c *TkgClient) GetCEIPParticipation() (ClusterCeipInfo, error)
- func (c *TkgClient) GetClusterConfiguration(options *CreateClusterOptions) ([]byte, error)
- func (c *TkgClient) GetClusterObjects(clusterClient clusterclient.Client, listOptions *crtclient.ListOptions, ...) ([]ClusterInfo, error)
- func (c *TkgClient) GetClusterObjectsForPacific(clusterClient clusterclient.Client, apiVersion string, ...) ([]ClusterInfo, error)
- func (c *TkgClient) GetClusterPinnipedInfo(options GetClusterPinnipedInfoOptions) (*ClusterPinnipedInfo, error)
- func (c *TkgClient) GetCurrentRegionContext() (region.RegionContext, error)
- func (c *TkgClient) GetKubernetesVersions() (*KubernetesVersionsInfo, error)
- func (c *TkgClient) GetMCClusterPinnipedInfo(regionalClusterClient clusterclient.Client, curRegion region.RegionContext) (*ClusterPinnipedInfo, error)
- func (c *TkgClient) GetMachineDeployments(options GetMachineDeploymentOptions) ([]capi.MachineDeployment, error)
- func (c *TkgClient) GetMachineHealthChecks(options MachineHealthCheckOptions) ([]MachineHealthCheck, error)
- func (c *TkgClient) GetMachineHealthChecksWithClusterClient(clusterClient clusterclient.Client, options MachineHealthCheckOptions) ([]MachineHealthCheck, error)
- func (c *TkgClient) GetRegionContexts(clusterName string) ([]region.RegionContext, error)
- func (c *TkgClient) GetTanzuKubernetesReleases(tkrName string) ([]runv1alpha1.TanzuKubernetesRelease, error)
- func (c *TkgClient) GetVSphereEndpoint(clusterClient clusterclient.Client) (vc.Client, error)
- func (c *TkgClient) GetWCClusterPinnipedInfo(regionalClusterClient clusterclient.Client, curRegion region.RegionContext, ...) (*ClusterPinnipedInfo, error)
- func (c *TkgClient) GetWorkloadClusterCredentials(options GetWorkloadClusterCredentialsOptions) (string, string, error)
- func (c *TkgClient) InitRegion(options *InitRegionOptions) error
- func (c *TkgClient) InitRegionDryRun(options *InitRegionOptions) ([]byte, error)
- func (c *TkgClient) InitializeProviders(options *InitRegionOptions, clusterClient clusterclient.Client, ...) error
- func (c *TkgClient) IsManagementClusterAKindCluster(clusterName string) (bool, error)
- func (c *TkgClient) IsPacificManagementCluster() (bool, error)
- func (c *TkgClient) ListTKGClusters(options ListTKGClustersOptions) ([]ClusterInfo, error)
- func (c *TkgClient) MoveObjects(fromKubeconfigPath, toKubeconfigPath, namespace string) error
- func (c *TkgClient) OverrideAWSNodeSizeWithOptions(options NodeSizeOptions, awsClient aws.Client, skipValidation bool) error
- func (c *TkgClient) OverrideAzureNodeSizeWithOptions(client azure.Client, options NodeSizeOptions, skipValidation bool) error
- func (c *TkgClient) OverrideVsphereNodeSizeWithOptions(options NodeSizeOptions) error
- func (c *TkgClient) ParseHiddenArgsAsFeatureFlags(options *InitRegionOptions)
- func (c *TkgClient) PatchClusterInitOperations(regionalClusterClient clusterclient.Client, options *InitRegionOptions, ...) error
- func (c *TkgClient) RegisterManagementClusterToTmc(clusterName, tmcRegistrationURL string) error
- func (c *TkgClient) RetrieveRegionalClusterConfiguration(regionalClusterClient clusterclient.Client) error
- func (c *TkgClient) RetrieveWorkloadClusterConfiguration(regionalClusterClient, workloadClusterClient clusterclient.Client, ...) error
- func (c *TkgClient) SaveFeatureFlags(featureFlags map[string]string) error
- func (c *TkgClient) ScaleCluster(options ScaleClusterOptions) error
- func (c *TkgClient) ScalePacificCluster(options ScaleClusterOptions, clusterClient clusterclient.Client) error
- func (c *TkgClient) SetAndValidateDefaultAWSVPCConfiguration(isProdConfig bool, awsClient aws.Client, skipValidation bool) (bool, error)
- func (c *TkgClient) SetBuildEdition(buildEdition string)
- func (c *TkgClient) SetCEIPParticipation(ceipOptIn bool, isProd, labels string) error
- func (c *TkgClient) SetDefaultProxySettings()
- func (c *TkgClient) SetMachineDeployment(options *SetMachineDeploymentOptions) error
- func (c *TkgClient) SetMachineDeploymentWorkerCounts(workerCounts []int, totalWorkerMachineCount int64, isProdConfig bool)
- func (c *TkgClient) SetMachineHealthCheck(options *SetMachineHealthCheckOptions) error
- func (c *TkgClient) SetPinnipedConfigForWorkloadCluster(issuerURL, issuerCA string)
- func (c *TkgClient) SetPlan(planName string)
- func (c *TkgClient) SetProviderType(providerType string)
- func (c *TkgClient) SetRegionContext(clusterName, contextName string) error
- func (c *TkgClient) SetTKGClusterRole(clusterType TKGClusterType)
- func (c *TkgClient) SetTKGVersion()
- func (c *TkgClient) SetVsphereNodeSize()
- func (c *TkgClient) SetVsphereVersion(vsphereVersion string)
- func (c *TkgClient) TKGConfigReaderWriter() tkgconfigreaderwriter.TKGConfigReaderWriter
- func (c *TkgClient) TrimVsphereSSHKey()
- func (c *TkgClient) UpdateCredentialsCluster(options *UpdateCredentialsOptions) error
- func (c *TkgClient) UpdateCredentialsRegion(options *UpdateCredentialsOptions) error
- func (c *TkgClient) UpdateMachineHealthCheck(candidate *capi.MachineHealthCheck, clusterClient clusterclient.Client, ...) error
- func (c *TkgClient) UpdateVSphereClusterCredentials(clusterClient clusterclient.Client, options *UpdateCredentialsOptions) error
- func (c *TkgClient) UpgradeAddon(options *UpgradeAddonOptions) error
- func (c *TkgClient) UpgradeCluster(options *UpgradeClusterOptions) error
- func (c *TkgClient) UpgradeManagementCluster(options *UpgradeClusterOptions) error
- func (c *TkgClient) ValidateAndConfigureClusterOptions(options *CreateClusterOptions) error
- func (c *TkgClient) ValidateAzurePublicSSHKey() error
- func (c *TkgClient) ValidateManagementClusterVersionWithCLI(regionalClusterClient clusterclient.Client) error
- func (c *TkgClient) ValidatePacificVersionWithCLI(regionalClusterClient clusterclient.Client) error
- func (c *TkgClient) ValidatePrerequisites(validateDocker, validateKubectl bool) error
- func (c *TkgClient) ValidateSupportOfK8sVersionForManagmentCluster(regionalClusterClient clusterclient.Client, kubernetesVersion string, ...) error
- func (c *TkgClient) ValidateVsphereControlPlaneEndpointIP(endpointIP string) *ValidationError
- func (c *TkgClient) ValidateVsphereNodeSize() error
- func (c *TkgClient) ValidateVsphereResources(vcClient vc.Client, dcPath string) error
- func (c *TkgClient) ValidateVsphereVipWorkloadCluster(clusterClient clusterclient.Client, vip string, skipValidation bool) error
- func (c *TkgClient) VerifyRegion(kubeConfigPath string) (region.RegionContext, error)
- func (c *TkgClient) WaitForAddons(options waitForAddonsOptions) error
- func (c *TkgClient) WaitForAddonsDeployments(clusterClient clusterclient.Client) error
- func (c *TkgClient) WaitForClusterInitializedAndGetKubeConfig(clusterClient clusterclient.Client, name, targetNamespace string) ([]byte, error)
- func (c *TkgClient) WaitForClusterReadyAfterCreate(clusterClient clusterclient.Client, name, targetNamespace string) error
- func (c *TkgClient) WaitForClusterReadyAfterReverseMove(clusterClient clusterclient.Client, name, targetNamespace string) error
- func (c *TkgClient) WaitForClusterReadyForMove(clusterClient clusterclient.Client, name, targetNamespace string) error
- func (c *TkgClient) WaitForPackages(regionalClusterClient, currentClusterClient clusterclient.Client, ...) error
- func (c *TkgClient) WaitForProviders(clusterClient clusterclient.Client, options waitForProvidersOptions) error
- type UpdateCredentialsOptions
- type UpgradeAddonOptions
- type UpgradeClusterOptions
- type UpgradeManagementClusterOptions
- type VSphereNodePool
- type VSphereUpdateClusterOptions
- type ValidationError
Constants ¶
const ( CeipOptInStatus = "Opt-in" CeipOptOutStatus = "Opt-out" CeipPacificCluster = "N/A" )
CeipOptOutStatus and CeipOptInStatus are constants for the CEIP opt-in/out verbiage
const ( // PacificProviderName tkgs provider name PacificProviderName = "tkg-service-vsphere" // VSphereProviderName vsphere provider name VSphereProviderName = "vsphere" // AWSProviderName aws provider name AWSProviderName = "aws" // AzureProviderName azure provider name AzureProviderName = "azure" // DockerProviderName docker provider name DockerProviderName = "docker" )
const ( // TkgLabelClusterRolePrefix cluster-role label prefix TkgLabelClusterRolePrefix = "cluster-role.tkg.tanzu.vmware.com/" // TkgLabelClusterRoleManagement cluster-role management label TkgLabelClusterRoleManagement = "management" // TkgLabelClusterRoleWorkload cluster-role workload label TkgLabelClusterRoleWorkload = "workload" )
const ( ErrorMissingRegionalClusterObject = "management cluster object is not present in given management cluster" ErrorNoClusterObject = "no Cluster object present in the given management cluster" ErrorGettingClusterObjects = "unable to get cluster resources, %s. Are you sure the cluster you are using is a management cluster?" ErrorDeleteAbort = `` /* 362-byte string literal not displayed */ )
Error message constants
const ( StepConfigPrerequisite = "Configure prerequisite" StepValidateConfiguration = "Validate configuration" StepGenerateClusterConfiguration = "Generate cluster configuration" StepSetupBootstrapCluster = "Setup bootstrap cluster" StepInstallProvidersOnBootstrapCluster = "Install providers on bootstrap cluster" StepCreateManagementCluster = "Create management cluster" StepInstallProvidersOnRegionalCluster = "Install providers on management cluster" StepMoveClusterAPIObjects = "Move cluster-api objects from bootstrap cluster to management cluster" StepRegisterWithTMC = "Register management cluster with Tanzu Mission Control" )
management cluster init step constants
const ( DefaulUnhealthyConditionTimeout = "5m" DefaultNodeStartupTimeout = "20m" DefaultNodePoolSuffix = "worker-pool" NodePoolKey = "node-pool" )
machinehealthcheck related default and constants
const ( // TKGClusterPhaseCreating means the cluster control plane is under creation, // or that infrastructure has been created and configured but not yet with // an initialized control plane. TKGClusterPhaseCreating = TKGClusterPhase("creating") // TKGClusterPhaseCreationStalled indicates that the cluster is in the // process of creating control plane and the process is possibly // stalled and user intervention is required. TKGClusterPhaseCreationStalled = TKGClusterPhase("createStalled") // TKGClusterPhaseRunning means that the infrastructure has been created // and configured, and that the control plane has been fully initialized. TKGClusterPhaseRunning = TKGClusterPhase("running") // TKGClusterPhaseDeleting means that the cluster is being deleted. TKGClusterPhaseDeleting = TKGClusterPhase("deleting") // TKGClusterPhaseFailed means that cluster control plane // creation failed. Possible user intervention required. // This Phase to be used for TKC(pacific cluster). TKGClusterPhaseFailed = TKGClusterPhase("failed") // TKGClusterPhaseUpdating indicates that the cluster is in the // process of rolling out an update or scaling nodes TKGClusterPhaseUpdating = TKGClusterPhase("updating") // TKGClusterPhaseUpdateFailed indicates that the cluster's // rolling update failed and likely requires user intervention. // This Phase to be used for TKC(pacific cluster). TKGClusterPhaseUpdateFailed = TKGClusterPhase("updateFailed") // TKGClusterPhaseUpdateStalled indicates that the cluster is in the // process of rolling out an update and the update process is possibly // stalled and user intervention is required. TKGClusterPhaseUpdateStalled = TKGClusterPhase("updateStalled") // TKGClusterPhaseEmpty is useful for the initial reconcile, // before we even state the phase as creating. TKGClusterPhaseEmpty = TKGClusterPhase("") )
const ( ValidationErrorCode = 1 PacificInVC7ErrorCode = 2 PacificNotInVC7ErrorCode = 3 )
error code constants
const ErrorBlockUpgradeTMCIncompatible = "" /* 178-byte string literal not displayed */
ErrorBlockUpgradeTMCIncompatible defines the error message to display during upgrade when cluster is registred to TMC and TMC does not support latest version of TKG
const (
// TKGPlanAnnotation plan annotation
TKGPlanAnnotation = "tkg/plan"
)
const (
TKGsystemNamespace = "tkg-system"
)
TKGsystemNamespace and DefaultNamespace are constants for setting the namespaces
Variables ¶
var ( AWSNewVPCConfigVariables = []string{constants.ConfigVariableAWSPublicNodeCIDR, constants.ConfigVariableAWSPrivateNodeCIDR, constants.ConfigVariableAWSVPCCIDR} AWSProdNewVPCConfigVariables = []string{constants.ConfigVariableAWSPublicNodeCIDR1, constants.ConfigVariableAWSPrivateNodeCIDR1, constants.ConfigVariableAWSPublicNodeCIDR2, constants.ConfigVariableAWSPrivateNodeCIDR2} AWSSubnetIDConfigVariables = []string{constants.ConfigVariableAWSPrivateSubnetID, constants.ConfigVariableAWSPublicSubnetID} AWSProdSubnetIDConfigVariables = []string{constants.ConfigVariableAWSPrivateSubnetID1, constants.ConfigVariableAWSPublicSubnetID1, constants.ConfigVariableAWSPrivateSubnetID2, constants.ConfigVariableAWSPublicSubnetID2} VsphereNodeCPUVarName = []string{constants.ConfigVariableVsphereCPNumCpus, constants.ConfigVariableVsphereWorkerNumCpus} VsphereNodeMemVarName = []string{constants.ConfigVariableVsphereCPMemMib, constants.ConfigVariableVsphereWorkerMemMib} VsphereNodeDiskVarName = []string{constants.ConfigVariableVsphereCPDiskGib, constants.ConfigVariableVsphereWorkerDiskGib} AWSPrivateSubnetIDConfigVariables = []string{constants.ConfigVariableAWSPrivateSubnetID, constants.ConfigVariableAWSPrivateSubnetID1, constants.ConfigVariableAWSPrivateSubnetID2} AWSPublicSubnetIDConfigVariables = []string{constants.ConfigVariableAWSPublicSubnetID, constants.ConfigVariableAWSPublicSubnetID1, constants.ConfigVariableAWSPublicSubnetID2} )
AWS config variables
CNITypes supported CNI types
var ConditionStatus = map[string]bool{ string(corev1.ConditionTrue): true, string(corev1.ConditionFalse): true, string(corev1.ConditionUnknown): true, }
ConditionStatus condition status map
var InitRegionSteps []string = []string{ StepConfigPrerequisite, StepValidateConfiguration, StepGenerateClusterConfiguration, StepSetupBootstrapCluster, StepInstallProvidersOnBootstrapCluster, StepCreateManagementCluster, StepInstallProvidersOnRegionalCluster, StepMoveClusterAPIObjects, }
InitRegionSteps management cluster init step sequence
var Scheme = runtime.NewScheme()
Scheme runtime scheme
var TKGSupportedClusterOptions string
TKGSupportedClusterOptions is the comma separated list of cluster options that could be enabled by user !!!NOTE this is set during the build time. Only the cluster options mentioned in "AllowedEnableOptions" could be enabled by user through command line option("enable-cluster-options"), if TKGSupportedClusterOptions is set to ""(for development purpose) the check would be deactivated
var UnhealthyConditions = map[string]bool{ string(corev1.NodeReady): true, string(corev1.NodeMemoryPressure): true, string(corev1.NodeDiskPressure): true, string(corev1.NodePIDPressure): true, string(corev1.NodeNetworkUnavailable): true, }
UnhealthyConditions unhealthy condition map
var VsphereResourceType = []string{constants.ConfigVariableVsphereResourcePool, constants.ConfigVariableVsphereDatastore, constants.ConfigVariableVsphereFolder}
VsphereResourceType vsphere resource types
Functions ¶
func DeleteContextFromKubeConfig ¶
DeleteContextFromKubeConfig deletes the context and the cluster information from give kubeconfigPath
func GetCurrentClusterKubeConfigFromFile ¶
GetCurrentClusterKubeConfigFromFile gets current cluster kubeconfig from kubeconfig file
func MergeKubeConfigAndSwitchContext ¶
MergeKubeConfigAndSwitchContext merges kubeconfig and switches the kube-context
func MergeKubeConfigWithoutSwitchContext ¶
MergeKubeConfigWithoutSwitchContext merges kubeconfig without updating kubecontext
func ParseProviderName ¶
ParseProviderName defines a utility function that parses the abbreviated syntax for name[:version]
Types ¶
type ApplyProvidersUpgradeOptions ¶
type ApplyProvidersUpgradeOptions struct { // Kubeconfig file to use for accessing the management cluster. If empty, default discovery rules apply. Kubeconfig clusterctl.Kubeconfig // ManagementGroup that should be upgraded (e.g. capi-system/cluster-api). ManagementGroup string // Contract defines the API Version of Cluster API (contract e.g. v1alpha3) the management group should upgrade to. // When upgrading by contract, the latest versions available will be used for all the providers; if you want // a more granular control on upgrade, use CoreProvider, BootstrapProviders, ControlPlaneProviders, InfrastructureProviders. // Note: For tkg we will ignore this option as tkg management cluster is opinionated and it controls version of the providers to be upgraded Contract string // CoreProvider instance and version (e.g. capi-system/cluster-api:v0.3.0) to upgrade to. This field can be used as alternative to Contract. CoreProvider string // BootstrapProviders instance and versions (e.g. capi-kubeadm-bootstrap-system/kubeadm:v0.3.0) to upgrade to. This field can be used as alternative to Contract. BootstrapProviders []string // ControlPlaneProviders instance and versions (e.g. capi-kubeadm-control-plane-system/kubeadm:v0.3.0) to upgrade to. This field can be used as alternative to Contract. ControlPlaneProviders []string // InfrastructureProviders instance and versions (e.g. capa-system/aws:v0.5.0) to upgrade to. This field can be used as alternative to Contract. InfrastructureProviders []string }
ApplyProvidersUpgradeOptions carries the options supported by upgrade apply.
type Client ¶
type Client interface { // InitRegion creates and initializes a management cluster via a // self-provisioned bootstrap cluster if necessary InitRegion(options *InitRegionOptions) error // InitRegionDryRun generates the management cluster manifest that would be // used by InitRegion to provision a new cluster InitRegionDryRun(options *InitRegionOptions) ([]byte, error) // GetClusterConfiguration returns a cluster configuration generated with // parameters provided in the set of provided template options GetClusterConfiguration(options *CreateClusterOptions) ([]byte, error) // ConfigureAndValidateTkrVersion takes tkrVersion, if empty fetches default tkr & k8s version from config // and validates k8s version format is valid semantic version ConfigureAndValidateTkrVersion(tkrVersion string) (string, string, error) // CreateCluster creates a workload cluster based on a cluster template // generated from the provided options CreateCluster(options *CreateClusterOptions, waitForCluster bool) error // CreateAWSCloudFormationStack create aws cloud formation stack CreateAWSCloudFormationStack() error // DeleteRegion deletes management cluster via a self-provisioned kind cluster DeleteRegion(options DeleteRegionOptions) error // DeRegisterManagementClusterFromTmc deregisters management cluster from Tanzu Mission Control DeRegisterManagementClusterFromTmc(clusterName string) error // VerifyRegion checks if the kube context points to a management clusters, VerifyRegion(kubeConfigPath string) (region.RegionContext, error) // AddRegionContext adds a management cluster context to tkg config file AddRegionContext(region region.RegionContext, overwrite bool, useDirectReference bool) error // GetRegionContexts gets all tkg managed management cluster context context GetRegionContexts(clusterName string) ([]region.RegionContext, error) // SetRegionContext sets a management cluster context to be current context SetRegionContext(clusterName string, contextName string) error // GetCurrentRegionContext() gets the current management cluster context GetCurrentRegionContext() (region.RegionContext, error) // GetWorkloadClusterCredentials merges workload cluster credentials into kubeconfig path GetWorkloadClusterCredentials(options GetWorkloadClusterCredentialsOptions) (string, string, error) // ListTKGClusters lists workload clusters managed by the management cluster ListTKGClusters(options ListTKGClustersOptions) ([]ClusterInfo, error) // DeleteWorkloadCluster deletes a workload cluster managed by the management cluster DeleteWorkloadCluster(options DeleteWorkloadClusterOptions) error // ScaleCluster scales the cluster ScaleCluster(options ScaleClusterOptions) error // UpgradeCluster upgrades tkg cluster to specific kubernetes version UpgradeCluster(options *UpgradeClusterOptions) error // ConfigureAndValidateManagementClusterConfiguration validates the management cluster configuration // User is expected to validate the configuration before creating management cluster using init operation ConfigureAndValidateManagementClusterConfiguration(options *InitRegionOptions, skipValidation bool) *ValidationError // UpgradeManagementCluster upgrades tkg cluster to specific kubernetes version UpgradeManagementCluster(options *UpgradeClusterOptions) error // Register management cluster to Tanzu Mission Control RegisterManagementClusterToTmc(kubeConfigPath string, tmcRegistrationURL string) error // Opt-in/out to CEIP on Management Cluster SetCEIPParticipation(ceipOptIn bool, isProd string, labels string) error // Get opt-in/out status for CEIP on all Management Clusters GetCEIPParticipation() (ClusterCeipInfo, error) // DeleteMachineHealthCheck deletes MachineHealthCheck for the given cluster DeleteMachineHealthCheck(options MachineHealthCheckOptions) error // ListMachineHealthChecks lists all the machine health check GetMachineHealthChecks(options MachineHealthCheckOptions) ([]MachineHealthCheck, error) // IsPacificManagementCluster checks if the cluster pointed to by kubeconfig is Pacific management cluster(supervisor) IsPacificManagementCluster() (bool, error) // SetMachineHealthCheck create or update a machine health check object SetMachineHealthCheck(options *SetMachineHealthCheckOptions) error // GetMachineDeployments gets a list of MachineDeployments for a cluster GetMachineDeployments(options GetMachineDeploymentOptions) ([]capi.MachineDeployment, error) // SetMachineDeployment create machine deployment in a cluster SetMachineDeployment(options *SetMachineDeploymentOptions) error // DeleteMachineDeployment deletes a machine deployment in a cluster DeleteMachineDeployment(options DeleteMachineDeploymentOptions) error // GetKubernetesVersions returns the supported k8s versions for workload cluster GetKubernetesVersions() (*KubernetesVersionsInfo, error) // ParseHiddenArgsAsFeatureFlags adds the hidden flags from InitRegionOptions as enabled feature flags ParseHiddenArgsAsFeatureFlags(options *InitRegionOptions) // SaveFeatureFlags saves the feature flags to the config file via featuresClient SaveFeatureFlags(featureFlags map[string]string) error // ValidatePrerequisites valides prerequisites for init command ValidatePrerequisites(validateDocker, validateKubectl bool) error // GetVSphereEndpoint creates the vSphere client using the credentials from the management cluster if cluster client is provided, // otherwise, the vSphere client will be created from the credentials set in the user's environment. GetVSphereEndpoint(client clusterclient.Client) (vc.Client, error) // ConfigureTimeout updates/configures timeout already set in the tkgClient ConfigureTimeout(timeout time.Duration) // TKGConfigReaderWriter returns tkgConfigReaderWriter client TKGConfigReaderWriter() tkgconfigreaderwriter.TKGConfigReaderWriter // UpdateManagementCluster updates a management cluster UpdateCredentialsRegion(options *UpdateCredentialsOptions) error // UpdateCredentialsCluster updates a workload cluster UpdateCredentialsCluster(options *UpdateCredentialsOptions) error // GetClusterPinnipedInfo returns the cluster and pinniped info GetClusterPinnipedInfo(options GetClusterPinnipedInfoOptions) (*ClusterPinnipedInfo, error) // DescribeCluster describes all the objects in the Cluster DescribeCluster(options DescribeTKGClustersOptions) (*clusterctltree.ObjectTree, *capi.Cluster, *clusterctlv1.ProviderList, error) // DescribeProvider describes all the installed providers DescribeProvider() (*clusterctlv1.ProviderList, error) // DownloadBomFile downloads BomFile from management cluster's config map DownloadBomFile(tkrName string) error // IsManagementClusterAKindCluster determines if the creation of management cluster is successful IsManagementClusterAKindCluster(clusterName string) (bool, error) // GetTanzuKubernetesReleases returns the available TanzuKubernetesReleases GetTanzuKubernetesReleases(tkrName string) ([]runv1alpha1.TanzuKubernetesRelease, error) // ActivateTanzuKubernetesReleases activates TanzuKubernetesRelease ActivateTanzuKubernetesReleases(tkrName string) error // DeactivateTanzuKubernetesReleases deactivates TanzuKubernetesRelease DeactivateTanzuKubernetesReleases(tkrName string) error }
Client is used to interact with the tkg client library
type ClusterCeipInfo ¶
type ClusterCeipInfo struct { ClusterName string `json:"name" yaml:"name"` CeipStatus string `json:"ceipOptIn" yaml:"ceipOptIn"` }
ClusterCeipInfo is the cmd object for outputting the CEIP status of a clsuter
type ClusterConfigOptions ¶
type ClusterConfigOptions clusterctl.GetClusterTemplateOptions
ClusterConfigOptions contains options required to generate a cluster configuration
type ClusterIPFamily ¶
type ClusterIPFamily int
ClusterIPFamily defines the types of supported IP families.
const ( InvalidIPFamily ClusterIPFamily = iota IPv4IPFamily IPv6IPFamily DualStackIPFamily )
Define the ClusterIPFamily constants.
func GetIPFamily ¶
func GetIPFamily(c *capi.Cluster) (ClusterIPFamily, error)
GetIPFamily returns a ClusterIPFamily from the configuration provided.
func (ClusterIPFamily) String ¶
func (f ClusterIPFamily) String() string
type ClusterInfo ¶
type ClusterInfo struct { Name string `json:"name" yaml:"name"` Namespace string `json:"namespace" yaml:"namespace"` Status string `json:"status" yaml:"status"` Plan string `json:"plan" yaml:"plan"` ControlPlaneCount string `json:"controlplane" yaml:"controlplane"` WorkerCount string `json:"workers" yaml:"workers"` K8sVersion string `json:"kubernetes" yaml:"kubernetes"` Roles []string `json:"roles" yaml:"roles"` Labels map[string]string `json:"labels" yaml:"labels"` }
ClusterInfo defines the fields of get cluster output
type ClusterPinnipedInfo ¶
type ClusterPinnipedInfo struct { ClusterName string ClusterInfo *clientcmdapi.Cluster PinnipedInfo *utils.PinnipedConfigMapInfo }
ClusterPinnipedInfo defines the fields of cluster pinniped info
type Components ¶
type Components repository.Components
Components CAPI repostory components interface
type CreateClusterOptions ¶
type CreateClusterOptions struct { ClusterConfigOptions TKRVersion string NodeSizeOptions NodeSizeOptions CniType string ClusterOptionsEnableList []string VsphereControlPlaneEndpoint string SkipValidation bool ClusterType TKGClusterType Edition string }
CreateClusterOptions contains options required to create a cluster
type DeleteMachineDeploymentOptions ¶
DeleteMachineDeploymentOptions a struct describing options for DeleteMachineDeployments
type DeleteRegionOptions ¶
type DeleteRegionOptions struct { Kubeconfig string ClusterName string Force bool UseExistingCluster bool }
DeleteRegionOptions contains options supported by DeleteRegion
type DeleteWorkloadClusterOptions ¶
DeleteWorkloadClusterOptions contains options supported by DeleteWorkloadCluster
type DescribeTKGClustersOptions ¶
type DescribeTKGClustersOptions struct { ClusterName string Namespace string ShowOtherConditions string ShowDetails bool ShowGroupMembers bool IsManagementCluster bool }
DescribeTKGClustersOptions contains options supported by DescribeCluster
type GetClusterPinnipedInfoOptions ¶
type GetClusterPinnipedInfoOptions struct { ClusterName string Namespace string IsManagementCluster bool }
GetClusterPinnipedInfoOptions contains options supported by GetClusterPinnipedInfo
type GetMachineDeploymentOptions ¶
GetMachineDeploymentOptions a struct describing options for retrieving MachineDeployments
type GetWorkloadClusterCredentialsOptions ¶
type GetWorkloadClusterCredentialsOptions struct { ClusterName string Namespace string ExportFile string }
GetWorkloadClusterCredentialsOptions contains options supported by GetWorkloadClusterCredntials
type InitRegionOptions ¶
type InitRegionOptions struct { NodeSizeOptions NodeSizeOptions ClusterConfigFile string Kubeconfig string Plan string ClusterName string CoreProvider string BootstrapProvider string InfrastructureProvider string ControlPlaneProvider string Namespace string WatchingNamespace string TmcRegistrationURL string CniType string VsphereControlPlaneEndpoint string Edition string Annotations map[string]string Labels map[string]string FeatureFlags map[string]string LaunchUI bool DisableYTT bool CeipOptIn bool UseExistingCluster bool }
InitRegionOptions contains options supported by InitRegion
type KubernetesVersionsInfo ¶
type KubernetesVersionsInfo struct {
Versions []string `json:"versions" yaml:"versions"`
}
KubernetesVersionsInfo kubernetes version info struct
type ListTKGClustersOptions ¶
ListTKGClustersOptions contains options supported by ListClusters
type MachineHealthCheck ¶
type MachineHealthCheck struct { Name string `json:"name"` Namespace string `json:"namespace"` Spec capi.MachineHealthCheckSpec `json:"spec"` Status capi.MachineHealthCheckStatus `json:"status"` }
MachineHealthCheck object
type MachineHealthCheckOptions ¶
type MachineHealthCheckOptions struct { ClusterName string MachineHealthCheckName string Namespace string MatchLabel string }
MachineHealthCheckOptions machinehealthcheck options
type NodePool ¶
type NodePool struct { Name string `yaml:"name"` Replicas *int32 `yaml:"replicas,omitempty"` AZ string `yaml:"az,omitempty"` NodeMachineType string `yaml:"nodeMachineType,omitempty"` Labels map[string]string `yaml:"labels,omitempty"` VSphere VSphereNodePool `yaml:"vsphere,omitempty"` }
NodePool a struct describing a node pool
type NodeSizeOptions ¶
NodeSizeOptions contains node size options specified by user
type Options ¶
type Options struct { ClusterCtlClient clusterctl.Client ReaderWriterConfigClient tkgconfigreaderwriter.Client RegionManager region.Manager TKGConfigDir string Timeout time.Duration FeaturesClient features.Client TKGConfigProvidersClient tkgconfigproviders.Client TKGBomClient tkgconfigbom.Client TKGConfigUpdater tkgconfigupdater.Client TKGPathsClient tkgconfigpaths.Client ClusterKubeConfig *types.ClusterKubeConfig ClusterClientFactory clusterclient.ClusterClientFactory }
Options new client options
type ScaleClusterOptions ¶
type ScaleClusterOptions struct { Kubeconfig string ClusterName string Namespace string WorkerCount int32 ControlPlaneCount int32 }
ScaleClusterOptions defines options to scale tkg cluster
type SetMachineDeploymentOptions ¶
SetMachineDeploymentOptions a struct describing options for creating/updating MachineDeployments
type SetMachineHealthCheckOptions ¶
type SetMachineHealthCheckOptions struct { ClusterName string Namespace string MachineHealthCheckName string MatchLables []string UnhealthyConditions []string NodeStartupTimeout string }
SetMachineHealthCheckOptions machinehealthcheck setter options
type TKGClusterPhase ¶
type TKGClusterPhase string
TKGClusterPhase is used to type the constants describing possible cluster status.
type TKGClusterType ¶
type TKGClusterType string
TKGClusterType specifies cluster type
const ( ManagementCluster TKGClusterType = "Management" WorkloadCluster TKGClusterType = "Workload" )
cluster types
type TkgClient ¶
type TkgClient struct {
// contains filtered or unexported fields
}
TkgClient implements Client.
func (*TkgClient) ActivateTanzuKubernetesReleases ¶
ActivateTanzuKubernetesReleases activates TKr
func (*TkgClient) AddRegionContext ¶
func (c *TkgClient) AddRegionContext(r region.RegionContext, overwrite, useDirectReference bool) error
AddRegionContext adds management cluster context
func (*TkgClient) BuildRegionalClusterConfiguration ¶
func (c *TkgClient) BuildRegionalClusterConfiguration(options *InitRegionOptions) ([]byte, string, error)
BuildRegionalClusterConfiguration build management cluster configuration
func (*TkgClient) ConfigureAndValidateAWSConfig ¶
func (c *TkgClient) ConfigureAndValidateAWSConfig(tkrVersion string, nodeSizes NodeSizeOptions, skipValidation, isProdConfig bool, workerMachineCount int64, clusterClient clusterclient.Client, isManagementCluster bool) error
ConfigureAndValidateAWSConfig configures and validates aws configuration
func (*TkgClient) ConfigureAndValidateAwsConfig ¶
func (c *TkgClient) ConfigureAndValidateAwsConfig(tkrVersion string, skipValidation, isProdConfig bool, workerMachineCount int64, isManagementCluster, useExistingVPC bool) error
ConfigureAndValidateAwsConfig configures and validates aws configuration
func (*TkgClient) ConfigureAndValidateAzureConfig ¶
func (c *TkgClient) ConfigureAndValidateAzureConfig(tkrVersion string, nodeSizes NodeSizeOptions, skipValidation, isProdConfig bool, workerMachineCount int64, clusterClient clusterclient.Client, isManagementCluster bool) error
ConfigureAndValidateAzureConfig configures and validates azure configurationn
func (*TkgClient) ConfigureAndValidateCNIType ¶
ConfigureAndValidateCNIType configures and validates cni
func (*TkgClient) ConfigureAndValidateDockerConfig ¶
func (c *TkgClient) ConfigureAndValidateDockerConfig(tkrVersion string, nodeSizes NodeSizeOptions, skipValidation bool) error
ConfigureAndValidateDockerConfig configures and validates docker configuration
func (*TkgClient) ConfigureAndValidateHTTPProxyConfiguration ¶
ConfigureAndValidateHTTPProxyConfiguration configures and validates http proxy configuration
func (*TkgClient) ConfigureAndValidateManagementClusterConfiguration ¶
func (c *TkgClient) ConfigureAndValidateManagementClusterConfiguration(options *InitRegionOptions, skipValidation bool) *ValidationError
ConfigureAndValidateManagementClusterConfiguration configure and validate management cluster configuration
func (*TkgClient) ConfigureAndValidateNameserverConfiguration ¶ added in v0.8.0
ConfigureAndValidateNameserverConfiguration validates the configuration of the control plane node and workload node nameservers
func (*TkgClient) ConfigureAndValidateTkrVersion ¶
ConfigureAndValidateTkrVersion takes tkrVersion, if empty fetches default tkr & k8s version from config and validates k8s version format is valid semantic version
func (*TkgClient) ConfigureAndValidateVSphereTemplate ¶
func (c *TkgClient) ConfigureAndValidateVSphereTemplate(vcClient vc.Client, tkrVersion, dc string) error
ConfigureAndValidateVSphereTemplate validate the k8s version provided matches with VM template's k8s version
func (*TkgClient) ConfigureAndValidateVsphereConfig ¶
func (c *TkgClient) ConfigureAndValidateVsphereConfig(tkrVersion string, nodeSizes NodeSizeOptions, vip string, skipValidation bool, clusterClient clusterclient.Client) *ValidationError
ConfigureAndValidateVsphereConfig configures and validates vsphere configuration
func (*TkgClient) ConfigureAndValidateWorkloadClusterConfiguration ¶
func (c *TkgClient) ConfigureAndValidateWorkloadClusterConfiguration(options *CreateClusterOptions, clusterClient clusterclient.Client, skipValidation bool) error
ConfigureAndValidateWorkloadClusterConfiguration configures and validates workload cluster configuration
func (*TkgClient) ConfigureAzureVMImage ¶
ConfigureAzureVMImage configures azure image from BoM or user config file
func (*TkgClient) ConfigureTimeout ¶
ConfigureTimeout updates/configures timeout already set in the tkgClient
func (*TkgClient) CreateAWSCloudFormationStack ¶
CreateAWSCloudFormationStack create aws cloud formation stack
func (*TkgClient) CreateCluster ¶
func (c *TkgClient) CreateCluster(options *CreateClusterOptions, waitForCluster bool) error
CreateCluster create workload cluster
func (*TkgClient) CreateMachineHealthCheck ¶
func (c *TkgClient) CreateMachineHealthCheck(clusterClient clusterclient.Client, options *SetMachineHealthCheckOptions) error
CreateMachineHealthCheck creates machinehealthchecks
func (*TkgClient) DeRegisterManagementClusterFromTmc ¶
DeRegisterManagementClusterFromTmc performs steps to register management cluster to TMC
func (*TkgClient) DeactivateTanzuKubernetesReleases ¶
DeactivateTanzuKubernetesReleases deactivates TKR
func (*TkgClient) DeleteMachineDeployment ¶
func (c *TkgClient) DeleteMachineDeployment(options DeleteMachineDeploymentOptions) error
DeleteMachineDeployment deletes a machine deployment
func (*TkgClient) DeleteMachineHealthCheck ¶
func (c *TkgClient) DeleteMachineHealthCheck(options MachineHealthCheckOptions) error
DeleteMachineHealthCheck delete machinehealthcheck
func (*TkgClient) DeleteMachineHealthCheckWithClusterClient ¶
func (c *TkgClient) DeleteMachineHealthCheckWithClusterClient(clusterClient clusterclient.Client, options MachineHealthCheckOptions) error
DeleteMachineHealthCheckWithClusterClient delete machinehealthcheck with client
func (*TkgClient) DeleteRegion ¶
func (c *TkgClient) DeleteRegion(options DeleteRegionOptions) error
DeleteRegion delete management cluster
func (*TkgClient) DeleteWorkloadCluster ¶
func (c *TkgClient) DeleteWorkloadCluster(options DeleteWorkloadClusterOptions) error
DeleteWorkloadCluster deletes workload cluster
func (*TkgClient) DescribeCluster ¶
func (c *TkgClient) DescribeCluster(options DescribeTKGClustersOptions) (*clusterctltree.ObjectTree, *clusterv1.Cluster, *clusterctlv1.ProviderList, error)
DescribeCluster describes cluster details and status
func (*TkgClient) DescribeProvider ¶
func (c *TkgClient) DescribeProvider() (*clusterctlv1.ProviderList, error)
DescribeProvider describes provider information
func (*TkgClient) DistributeMachineDeploymentWorkers ¶
func (c *TkgClient) DistributeMachineDeploymentWorkers(workerMachineCount int64, isProdConfig, isManagementCluster bool, infraProviderName string) ([]int, error)
DistributeMachineDeploymentWorkers distributes machine deployment for worker nodes
func (*TkgClient) DoClusterUpgrade ¶
func (c *TkgClient) DoClusterUpgrade(regionalClusterClient clusterclient.Client, currentClusterClient clusterclient.Client, options *UpgradeClusterOptions) error
DoClusterUpgrade upgrades cluster
func (*TkgClient) DoCreateCluster ¶
func (c *TkgClient) DoCreateCluster(clusterClient clusterclient.Client, name, namespace, manifest string) error
DoCreateCluster performs steps to create cluster
func (*TkgClient) DoGetCEIPParticipation ¶
func (c *TkgClient) DoGetCEIPParticipation(clusterClient clusterclient.Client, clusterName string) (ClusterCeipInfo, error)
DoGetCEIPParticipation get CEIP participation details
func (*TkgClient) DoGetTanzuKubernetesReleases ¶
func (c *TkgClient) DoGetTanzuKubernetesReleases(regionalClusterClient clusterclient.Client) (*KubernetesVersionsInfo, error)
DoGetTanzuKubernetesReleases gets TKr
func (*TkgClient) DoPacificClusterUpgrade ¶
func (c *TkgClient) DoPacificClusterUpgrade(regionalClusterClient clusterclient.Client, options *UpgradeClusterOptions) error
DoPacificClusterUpgrade perform TKGS cluster upgrade
func (*TkgClient) DoProvidersUpgrade ¶
func (c *TkgClient) DoProvidersUpgrade(regionalClusterClient clusterclient.Client, ctx string, providersUpgradeClient providersupgradeclient.Client, options *UpgradeClusterOptions) error
DoProvidersUpgrade upgrades the providers of the management cluster
func (*TkgClient) DoScaleCluster ¶ added in v0.6.0
func (c *TkgClient) DoScaleCluster(clusterClient clusterclient.Client, options *ScaleClusterOptions) error
DoScaleCluster performs the scale operation using the given clusterclient.Client
func (*TkgClient) DoSetCEIPParticipation ¶
func (c *TkgClient) DoSetCEIPParticipation(clusterClient clusterclient.Client, context region.RegionContext, ceipOptIn bool, isProd, labels string) error
DoSetCEIPParticipation performs steps to set CEIP participation
func (*TkgClient) DoUpgradeAddon ¶
func (c *TkgClient) DoUpgradeAddon(regionalClusterClient clusterclient.Client, currentClusterClient clusterclient.Client, options *UpgradeAddonOptions, clusterConfigurationGetter func(*CreateClusterOptions) ([]byte, error)) error
DoUpgradeAddon performs steps for addons upgrade
func (*TkgClient) DownloadBomFile ¶
DownloadBomFile downloads BoM file
func (*TkgClient) EncodeAWSCredentialsAndGetClient ¶
func (c *TkgClient) EncodeAWSCredentialsAndGetClient(clusterClient clusterclient.Client) (aws.Client, error)
EncodeAWSCredentialsAndGetClient encodes aws credentials and returns aws client
func (*TkgClient) EncodeAzureCredentialsAndGetClient ¶
func (c *TkgClient) EncodeAzureCredentialsAndGetClient(clusterClient clusterclient.Client) (azure.Client, error)
EncodeAzureCredentialsAndGetClient encodes azure credentials and returns azure client
func (*TkgClient) GenerateProvidersUpgradeOptions ¶
func (c *TkgClient) GenerateProvidersUpgradeOptions(pUpgradeInfo *providersUpgradeInfo) (*ApplyProvidersUpgradeOptions, error)
GenerateProvidersUpgradeOptions generates provider upgrade options
func (*TkgClient) GetAWSCreds ¶
func (c *TkgClient) GetAWSCreds() (*credentials.AWSCredentials, error)
GetAWSCreds get aws credentials
func (*TkgClient) GetCEIPParticipation ¶
func (c *TkgClient) GetCEIPParticipation() (ClusterCeipInfo, error)
GetCEIPParticipation get CEIP participation details
func (*TkgClient) GetClusterConfiguration ¶
func (c *TkgClient) GetClusterConfiguration(options *CreateClusterOptions) ([]byte, error)
GetClusterConfiguration gets cluster configuration
func (*TkgClient) GetClusterObjects ¶
func (c *TkgClient) GetClusterObjects(clusterClient clusterclient.Client, listOptions *crtclient.ListOptions, managementClusterName string, includeMC bool) ([]ClusterInfo, error)
GetClusterObjects gets cluster objects
func (*TkgClient) GetClusterObjectsForPacific ¶
func (c *TkgClient) GetClusterObjectsForPacific(clusterClient clusterclient.Client, apiVersion string, listOptions *crtclient.ListOptions) ([]ClusterInfo, error)
GetClusterObjectsForPacific get cluster objects for TKGS clusters
func (*TkgClient) GetClusterPinnipedInfo ¶
func (c *TkgClient) GetClusterPinnipedInfo(options GetClusterPinnipedInfoOptions) (*ClusterPinnipedInfo, error)
GetClusterPinnipedInfo gets pinniped information from cluster
func (*TkgClient) GetCurrentRegionContext ¶
func (c *TkgClient) GetCurrentRegionContext() (region.RegionContext, error)
GetCurrentRegionContext gets current management cluster contexts
func (*TkgClient) GetKubernetesVersions ¶
func (c *TkgClient) GetKubernetesVersions() (*KubernetesVersionsInfo, error)
GetKubernetesVersions get kubernetes version info
func (*TkgClient) GetMCClusterPinnipedInfo ¶
func (c *TkgClient) GetMCClusterPinnipedInfo(regionalClusterClient clusterclient.Client, curRegion region.RegionContext) (*ClusterPinnipedInfo, error)
GetMCClusterPinnipedInfo get pinniped information for management cluster
func (*TkgClient) GetMachineDeployments ¶
func (c *TkgClient) GetMachineDeployments(options GetMachineDeploymentOptions) ([]capi.MachineDeployment, error)
GetMachineDeployments retrieves machine deployments for a cluster
func (*TkgClient) GetMachineHealthChecks ¶
func (c *TkgClient) GetMachineHealthChecks(options MachineHealthCheckOptions) ([]MachineHealthCheck, error)
GetMachineHealthChecks gets machinehealthcheck
func (*TkgClient) GetMachineHealthChecksWithClusterClient ¶
func (c *TkgClient) GetMachineHealthChecksWithClusterClient(clusterClient clusterclient.Client, options MachineHealthCheckOptions) ([]MachineHealthCheck, error)
GetMachineHealthChecksWithClusterClient gets machinehealthcheck with client
func (*TkgClient) GetRegionContexts ¶
func (c *TkgClient) GetRegionContexts(clusterName string) ([]region.RegionContext, error)
GetRegionContexts returns mangement cluster contexts
func (*TkgClient) GetTanzuKubernetesReleases ¶
func (c *TkgClient) GetTanzuKubernetesReleases(tkrName string) ([]runv1alpha1.TanzuKubernetesRelease, error)
GetTanzuKubernetesReleases returns TKr list
func (*TkgClient) GetVSphereEndpoint ¶
GetVSphereEndpoint gets vsphere client based on credentials set in config variables
func (*TkgClient) GetWCClusterPinnipedInfo ¶
func (c *TkgClient) GetWCClusterPinnipedInfo(regionalClusterClient clusterclient.Client, curRegion region.RegionContext, options GetClusterPinnipedInfoOptions) (*ClusterPinnipedInfo, error)
GetWCClusterPinnipedInfo gets pinniped information for workload cluster
func (*TkgClient) GetWorkloadClusterCredentials ¶
func (c *TkgClient) GetWorkloadClusterCredentials(options GetWorkloadClusterCredentialsOptions) (string, string, error)
GetWorkloadClusterCredentials gets and saves workload cluster credentials
func (*TkgClient) InitRegion ¶
func (c *TkgClient) InitRegion(options *InitRegionOptions) error
InitRegion create management cluster
func (*TkgClient) InitRegionDryRun ¶
func (c *TkgClient) InitRegionDryRun(options *InitRegionOptions) ([]byte, error)
InitRegionDryRun run management cluster dry-run
func (*TkgClient) InitializeProviders ¶
func (c *TkgClient) InitializeProviders(options *InitRegionOptions, clusterClient clusterclient.Client, kubeconfigPath string) error
InitializeProviders initializes providers
func (*TkgClient) IsManagementClusterAKindCluster ¶
IsManagementClusterAKindCluster Determining if the management cluster creation is successful based on the presence of Annotation 'TKGVERSION: <version>'.
Management clusters are annotated with the TKG version if they are successful. If the annotation is not present, the cluster is determined to be failed management cluster (kind cluster) with some un-deleted infrastructure resources
func (*TkgClient) IsPacificManagementCluster ¶
IsPacificManagementCluster check if management cluster is TKGS cluster
func (*TkgClient) ListTKGClusters ¶
func (c *TkgClient) ListTKGClusters(options ListTKGClustersOptions) ([]ClusterInfo, error)
ListTKGClusters lists tkg cluster information
func (*TkgClient) MoveObjects ¶
MoveObjects moves all the Cluster API objects from all the namespaces to a target management cluster.
func (*TkgClient) OverrideAWSNodeSizeWithOptions ¶
func (c *TkgClient) OverrideAWSNodeSizeWithOptions(options NodeSizeOptions, awsClient aws.Client, skipValidation bool) error
OverrideAWSNodeSizeWithOptions overrides aws node size with options
func (*TkgClient) OverrideAzureNodeSizeWithOptions ¶
func (c *TkgClient) OverrideAzureNodeSizeWithOptions(client azure.Client, options NodeSizeOptions, skipValidation bool) error
OverrideAzureNodeSizeWithOptions overrides azure node size with options
func (*TkgClient) OverrideVsphereNodeSizeWithOptions ¶
func (c *TkgClient) OverrideVsphereNodeSizeWithOptions(options NodeSizeOptions) error
OverrideVsphereNodeSizeWithOptions overrides vsphere node size with options
func (*TkgClient) ParseHiddenArgsAsFeatureFlags ¶
func (c *TkgClient) ParseHiddenArgsAsFeatureFlags(options *InitRegionOptions)
ParseHiddenArgsAsFeatureFlags adds the hidden flags from InitRegionOptions as enabled feature flags
func (*TkgClient) PatchClusterInitOperations ¶
func (c *TkgClient) PatchClusterInitOperations(regionalClusterClient clusterclient.Client, options *InitRegionOptions, targetClusterNamespace string) error
PatchClusterInitOperations Patches cluster
func (*TkgClient) RegisterManagementClusterToTmc ¶
RegisterManagementClusterToTmc register management cluster to TMC
func (*TkgClient) RetrieveRegionalClusterConfiguration ¶ added in v0.3.0
func (c *TkgClient) RetrieveRegionalClusterConfiguration(regionalClusterClient clusterclient.Client) error
RetrieveRegionalClusterConfiguration gets TKG configurations from regional cluster and updates the in-memory config. this is required when we want to mutate the existing regional cluster.
func (*TkgClient) RetrieveWorkloadClusterConfiguration ¶ added in v0.3.0
func (c *TkgClient) RetrieveWorkloadClusterConfiguration(regionalClusterClient, workloadClusterClient clusterclient.Client, clusterName, clusterNamespace string) error
RetrieveWorkloadClusterConfiguration gets TKG configurations from regional cluster as well as workload cluster and updates the in-memory config. This is required when we want to mutate the existing workload cluster.
func (*TkgClient) SaveFeatureFlags ¶
SaveFeatureFlags saves the feature flags to the config file via featuresClient
func (*TkgClient) ScaleCluster ¶
func (c *TkgClient) ScaleCluster(options ScaleClusterOptions) error
ScaleCluster scales cluster vertically
func (*TkgClient) ScalePacificCluster ¶
func (c *TkgClient) ScalePacificCluster(options ScaleClusterOptions, clusterClient clusterclient.Client) error
ScalePacificCluster scale TKGS cluster
func (*TkgClient) SetAndValidateDefaultAWSVPCConfiguration ¶
func (c *TkgClient) SetAndValidateDefaultAWSVPCConfiguration(isProdConfig bool, awsClient aws.Client, skipValidation bool) (bool, error)
SetAndValidateDefaultAWSVPCConfiguration sets default value for AWS configuration variables Depending on whether AWS_VPC_ID is set/unset in the tkgconfig, values pertaining to configuring for existing/new VPC needs to be initialized to "" It returns whether creating cluster within existing vpc.
func (*TkgClient) SetBuildEdition ¶
SetBuildEdition saves the build edition
func (*TkgClient) SetCEIPParticipation ¶
SetCEIPParticipation sets CEIP participation
func (*TkgClient) SetDefaultProxySettings ¶
func (c *TkgClient) SetDefaultProxySettings()
SetDefaultProxySettings is used to configure default proxy settings. The TKG proxy variables are required for cloud-api component templates rendering. Need to set them to "" if the proxy variables are not available.
func (*TkgClient) SetMachineDeployment ¶
func (c *TkgClient) SetMachineDeployment(options *SetMachineDeploymentOptions) error
SetMachineDeployment sets a MachineDeployment on a cluster.
func (*TkgClient) SetMachineDeploymentWorkerCounts ¶
func (c *TkgClient) SetMachineDeploymentWorkerCounts(workerCounts []int, totalWorkerMachineCount int64, isProdConfig bool)
SetMachineDeploymentWorkerCounts sets machine deployment counts
func (*TkgClient) SetMachineHealthCheck ¶
func (c *TkgClient) SetMachineHealthCheck(options *SetMachineHealthCheckOptions) error
SetMachineHealthCheck sets machinehealthcheck
func (*TkgClient) SetPinnipedConfigForWorkloadCluster ¶
SetPinnipedConfigForWorkloadCluster sets the pinniped configuration(concierge) for workload cluster
func (*TkgClient) SetProviderType ¶
SetProviderType saves the provider type
func (*TkgClient) SetRegionContext ¶
SetRegionContext sets management cluster contexts
func (*TkgClient) SetTKGClusterRole ¶
func (c *TkgClient) SetTKGClusterRole(clusterType TKGClusterType)
SetTKGClusterRole sets the value of label tkg.tanzu.vmware.com/cluster-role for CAPI Cluster object.
func (*TkgClient) SetTKGVersion ¶
func (c *TkgClient) SetTKGVersion()
SetTKGVersion saves the tkg version based on Default BoM file
func (*TkgClient) SetVsphereNodeSize ¶
func (c *TkgClient) SetVsphereNodeSize()
SetVsphereNodeSize sets vsphere node size
func (*TkgClient) SetVsphereVersion ¶
SetVsphereVersion saves the vsphere version
func (*TkgClient) TKGConfigReaderWriter ¶
func (c *TkgClient) TKGConfigReaderWriter() tkgconfigreaderwriter.TKGConfigReaderWriter
TKGConfigReaderWriter returns tkgConfigReaderWriter client
func (*TkgClient) TrimVsphereSSHKey ¶
func (c *TkgClient) TrimVsphereSSHKey()
TrimVsphereSSHKey trim the comment part of the vsphere ssh key
func (*TkgClient) UpdateCredentialsCluster ¶
func (c *TkgClient) UpdateCredentialsCluster(options *UpdateCredentialsOptions) error
UpdateCredentialsCluster update cluster credentials
func (*TkgClient) UpdateCredentialsRegion ¶
func (c *TkgClient) UpdateCredentialsRegion(options *UpdateCredentialsOptions) error
UpdateCredentialsRegion update management cluster credentials
func (*TkgClient) UpdateMachineHealthCheck ¶
func (c *TkgClient) UpdateMachineHealthCheck(candidate *capi.MachineHealthCheck, clusterClient clusterclient.Client, options *SetMachineHealthCheckOptions) error
UpdateMachineHealthCheck updates machinehealthcheck
func (*TkgClient) UpdateVSphereClusterCredentials ¶
func (c *TkgClient) UpdateVSphereClusterCredentials(clusterClient clusterclient.Client, options *UpdateCredentialsOptions) error
UpdateVSphereClusterCredentials update vsphere cluster credentials
func (*TkgClient) UpgradeAddon ¶
func (c *TkgClient) UpgradeAddon(options *UpgradeAddonOptions) error
UpgradeAddon upgrades addons
func (*TkgClient) UpgradeCluster ¶
func (c *TkgClient) UpgradeCluster(options *UpgradeClusterOptions) error
UpgradeCluster upgrades workload and management clusters k8s version Steps:
- Verify k8s version
- Get the Upgrade configuration by reading BOM file to get the ImageTag and ImageRepository information for CoreDNS and Etcd, Read AWS_AMI_ID map from BOM for AWS upgrade scenario. Also use command line argument options to fill the upgrade configuration
- Create InfrastructureMachineTemplates(VSphereMachineTemplate, AWSMachineTemplate, AzureMachineTemplate) required for upgrade
- Patch KCP object to upgrade control-plane nodes
- Wait for k8s version to be updated for the cluster
- Patch MachineDeployment object to upgrade worker nodes
- Wait for k8s version to be updated for all worker nodes
func (*TkgClient) UpgradeManagementCluster ¶
func (c *TkgClient) UpgradeManagementCluster(options *UpgradeClusterOptions) error
UpgradeManagementCluster upgrades management clusters providers and k8s version Steps:
- Upgrade providers a) Get the Upgrade configuration by reading BOM file to get the providers versions b) Get the providers information from the management cluster c) Prepare the providers upgrade information d) Call the clusterctl ApplyUpgrade() to upgrade providers e) Wait for providers to be up and running
- call the UpgradeCluster() for upgrading the k8s version of the Management cluster
func (*TkgClient) ValidateAndConfigureClusterOptions ¶
func (c *TkgClient) ValidateAndConfigureClusterOptions(options *CreateClusterOptions) error
ValidateAndConfigureClusterOptions validates and configures the cluster options user want to enable through command line options
func (*TkgClient) ValidateAzurePublicSSHKey ¶
ValidateAzurePublicSSHKey validates AZURE_SSH_PUBLIC_KEY_B64 exists and is base64 encoded
func (*TkgClient) ValidateManagementClusterVersionWithCLI ¶
func (c *TkgClient) ValidateManagementClusterVersionWithCLI(regionalClusterClient clusterclient.Client) error
ValidateManagementClusterVersionWithCLI validate management cluster version with cli version
func (*TkgClient) ValidatePacificVersionWithCLI ¶ added in v0.8.0
func (c *TkgClient) ValidatePacificVersionWithCLI(regionalClusterClient clusterclient.Client) error
ValidatePacificVersionWithCLI validate Pacific TKC API version with cli version
func (*TkgClient) ValidatePrerequisites ¶
ValidatePrerequisites validate docker and kubectl commands
func (*TkgClient) ValidateSupportOfK8sVersionForManagmentCluster ¶
func (c *TkgClient) ValidateSupportOfK8sVersionForManagmentCluster(regionalClusterClient clusterclient.Client, kubernetesVersion string, skipValidation bool) error
ValidateSupportOfK8sVersionForManagmentCluster validate k8s version support for management cluster
func (*TkgClient) ValidateVsphereControlPlaneEndpointIP ¶
func (c *TkgClient) ValidateVsphereControlPlaneEndpointIP(endpointIP string) *ValidationError
ValidateVsphereControlPlaneEndpointIP validates if the control plane endpoint has been used by another cluster in the same network
func (*TkgClient) ValidateVsphereNodeSize ¶
ValidateVsphereNodeSize validates vsphere node size
func (*TkgClient) ValidateVsphereResources ¶
ValidateVsphereResources validates vsphere resource path specified in tkgconfig
func (*TkgClient) ValidateVsphereVipWorkloadCluster ¶
func (c *TkgClient) ValidateVsphereVipWorkloadCluster(clusterClient clusterclient.Client, vip string, skipValidation bool) error
ValidateVsphereVipWorkloadCluster validates that the control plane endpoint is unique
func (*TkgClient) VerifyRegion ¶
func (c *TkgClient) VerifyRegion(kubeConfigPath string) (region.RegionContext, error)
VerifyRegion verifies management cluster
func (*TkgClient) WaitForAddons ¶
WaitForAddons wait for addons to be installed
func (*TkgClient) WaitForAddonsDeployments ¶
func (c *TkgClient) WaitForAddonsDeployments(clusterClient clusterclient.Client) error
WaitForAddonsDeployments wait for addons deployments
func (*TkgClient) WaitForClusterInitializedAndGetKubeConfig ¶
func (c *TkgClient) WaitForClusterInitializedAndGetKubeConfig(clusterClient clusterclient.Client, name, targetNamespace string) ([]byte, error)
WaitForClusterInitializedAndGetKubeConfig wait for cluster initialization and once initialized get kubeconfig
func (*TkgClient) WaitForClusterReadyAfterCreate ¶
func (c *TkgClient) WaitForClusterReadyAfterCreate(clusterClient clusterclient.Client, name, targetNamespace string) error
WaitForClusterReadyAfterCreate wait for cluster to be ready after creation
func (*TkgClient) WaitForClusterReadyAfterReverseMove ¶
func (c *TkgClient) WaitForClusterReadyAfterReverseMove(clusterClient clusterclient.Client, name, targetNamespace string) error
WaitForClusterReadyAfterReverseMove Called when relocating cluster-api objects out from the management cluster to the cleanup cluster.
func (*TkgClient) WaitForClusterReadyForMove ¶
func (c *TkgClient) WaitForClusterReadyForMove(clusterClient clusterclient.Client, name, targetNamespace string) error
WaitForClusterReadyForMove wait for cluster to be ready for move operation
func (*TkgClient) WaitForPackages ¶
func (c *TkgClient) WaitForPackages(regionalClusterClient, currentClusterClient clusterclient.Client, clusterName, namespace string) error
WaitForPackages wait for packages to be up and running
func (*TkgClient) WaitForProviders ¶
func (c *TkgClient) WaitForProviders(clusterClient clusterclient.Client, options waitForProvidersOptions) error
WaitForProviders checks and waits for each provider components to be up and running
type UpdateCredentialsOptions ¶
type UpdateCredentialsOptions struct { ClusterName string Namespace string Kubeconfig string VSphereUpdateClusterOptions *VSphereUpdateClusterOptions IsRegionalCluster bool IsCascading bool }
UpdateCredentialsOptions update credential options
type UpgradeAddonOptions ¶
type UpgradeAddonOptions struct { AddonNames []string ClusterName string Namespace string Kubeconfig string IsRegionalCluster bool Edition string }
UpgradeAddonOptions upgrade addon options
type UpgradeClusterOptions ¶
type UpgradeClusterOptions struct { ClusterName string Namespace string KubernetesVersion string TkrVersion string Kubeconfig string VSphereTemplateName string OSName string OSVersion string OSArch string IsRegionalCluster bool SkipAddonUpgrade bool SkipPrompt bool // Tanzu edition (either tce or tkg) Edition string }
UpgradeClusterOptions upgrade cluster options
type UpgradeManagementClusterOptions ¶
type UpgradeManagementClusterOptions struct { ClusterName string Namespace string KubernetesVersion string Kubeconfig string IsRegionalCluster bool VSphereTemplateName string BOMFilePath string }
UpgradeManagementClusterOptions upgrade management cluster options
type VSphereNodePool ¶
type VSphereNodePool struct { CloneMode string `yaml:"cloneMode,omitempty"` Datacenter string `yaml:"datacenter,omitempty"` Datastore string `yaml:"datastore,omitempty"` StoragePolicyName string `yaml:"storagePolicyName,omitempty"` Folder string `yaml:"folder,omitempty"` Network string `yaml:"network,omitempty"` ResourcePool string `yaml:"resourcePool,omitempty"` VCIP string `yaml:"vcIP,omitempty"` Template string `yaml:"template,omitempty"` MemoryMiB int64 `yaml:"memoryMiB,omitempty"` DiskGiB int32 `yaml:"diskGiB,omitempty"` NumCPUs int32 `yaml:"numCPUs,omitempty"` }
VSphereNodePool a struct describing properties necessary for a node pool on vSphere
type VSphereUpdateClusterOptions ¶
VSphereUpdateClusterOptions vsphere credential options
type ValidationError ¶
ValidationError defines error during config validation
func NewValidationError ¶
func NewValidationError(code int, text string) *ValidationError
NewValidationError creates new validation error object
func ValidateVSphereVersion ¶
func ValidateVSphereVersion(vcClient vc.Client) *ValidationError
ValidateVSphereVersion validates vsphere version
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error returns error message from validation error
Source Files ¶
- activate_deactivate_tkr.go
- ceip.go
- client.go
- cluster.go
- common.go
- config.go
- config_permission.go
- delete_region.go
- deregister.go
- describe_cluster.go
- get_cluster.go
- get_cluster_helper.go
- get_cluster_pinniped_info.go
- get_kubernetes_versions.go
- get_tkrs.go
- init.go
- machine_deployment.go
- machine_health_check.go
- region.go
- register.go
- scale.go
- test_utils.go
- types.go
- update_credentials.go
- upgrade_addon.go
- upgrade_cluster.go
- upgrade_region.go
- utils.go
- validate.go
- workload_cluster.go