tkgctl

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Package tkgctl placeholder package comment

Index

Constants

View Source
const (
	// DefaultTCEBomRepo is OCI repository containing the BOM for TCE
	DefaultTCEBomRepo = "projects.registry.vmware.com/tce"
	// DefaultCompatibilityPath the path (project) of the compatibility file
	DefaultCompatibilityPath = "tkg-compatibility"
)
View Source
const (
	TCEBuildEdition = "tce"
)

Variables

View Source
var False = "false"
View Source
var True = "true"

True string constant for the value "true"

View Source
var Warningvsphere7WithPacific = `` /* 550-byte string literal not displayed */

Warningvsphere7WithPacific indicates that a vSphere7 environment has been detected with vSphere with Tanzu

View Source
var Warningvsphere7WithoutPacific = `` /* 598-byte string literal not displayed */

Warningvsphere7WithoutPacific indicates that a vSphere7 environment has been detected without vSphere with Tanzu

Functions

func CheckIfInputFileIsClusterClassBased added in v0.24.0

func CheckIfInputFileIsClusterClassBased(clusterConfigFile string) (bool, unstructured.Unstructured, error)

CheckIfInputFileIsClusterClassBased checks user input file, if it has Cluster object then reads all non-empty variables in cluster.spec.topology.variables, and updates those variables in environment and also CreateClusterOptions. TODO (chandrareddyp) : need to make sure the legacy validation error and log messages should not have legacy variable names in case of cluster class use case, should refer Cluster Object attributes (https://github.com/vmware-tanzu/tanzu-framework/issues/2443)

func GetIPFamilyForGivenCIDRs added in v0.24.0

func GetIPFamilyForGivenCIDRs(cidrs []string, isIPV6Primary bool) (string, error)

GetIPFamilyForGivenCIDRs takes cidrs array and returns ip family type (ipv4, ipv6 or dual) Maximum input cidrs array length is 2 only - "[100.64.0.0/18,100.64.0.0/18]" If input cidr's can be ipv4, ipv6 or both. if isIPV6Primary is true then the first cidrs value, which is cidrs[0] must be ipv6 otherwise throws error if input cidrs has both ipv6 and ipv4 then returns "ipv6,ipv4" only if isIPV6Primary true, otherwise returns "ipv4,ipv6" If all input cidr's has only ipv6 then returns "ipv6" If all input cidr's has only ipv4 then returns "ipv4"

func GetIPFamilyForGivenClusterNetworkCIDRs added in v0.24.0

func GetIPFamilyForGivenClusterNetworkCIDRs(podsCIDRs, serviceCIDRs string, isIPV6Primary bool) (string, error)

GetIPFamilyForGivenClusterNetworkCIDRs takes clusterNetwork's pods CIDRs and service CIDRs, and returns IP family type The each input cidrs string can have multiple CIDR's separated with comma (,), but it can not have more than two on each input CIDR string. If input CIDR has both ipv6 and ipv4, and if isIPV6Primary is true then the first CIDR should be ipv6, and returns "ipv6,ipv4", else if isIPV6Primary is false then returns "ipv4,ipv6" both input CIDRs should be same family

func SetCompatibilityFileBasedOnEdition added in v0.26.0

func SetCompatibilityFileBasedOnEdition() error

SetCompatibilityFileBasedOnEdition changes the compatibility file for the edition.

Types

type AddRegionOptions

type AddRegionOptions struct {
	Overwrite          bool
	UseDirectReference bool
}

AddRegionOptions add region options

type CreateClusterOptions

type CreateClusterOptions struct {
	IsWindowsWorkloadCluster bool
	GenerateOnly             bool
	SkipPrompt               bool

	ClusterConfigFile           string
	ClusterName                 string
	Plan                        string
	InfrastructureProvider      string
	Namespace                   string
	TkrVersion                  string
	Size                        string
	ControlPlaneSize            string
	WorkerSize                  string
	CniType                     string
	EnableClusterOptions        string
	VsphereControlPlaneEndpoint string
	ControlPlaneMachineCount    int
	WorkerMachineCount          int
	Timeout                     time.Duration
	// Tanzu edition (either tce or tkg)
	Edition string
}

CreateClusterOptions options to create the cluster

type DeleteClustersOptions

type DeleteClustersOptions struct {
	ClusterName string
	Namespace   string
	SkipPrompt  bool
}

DeleteClustersOptions delete cluster options

type DeleteMachineHealthCheckOptions

type DeleteMachineHealthCheckOptions struct {
	ClusterName            string
	Namespace              string
	MachinehealthCheckName string
	SkipPrompt             bool
	MatchLabel             string
}

DeleteMachineHealthCheckOptions delete cluster options

type DeleteRegionOptions

type DeleteRegionOptions struct {
	ClusterName        string
	Force              bool
	UseExistingCluster bool
	SkipPrompt         bool
	Timeout            time.Duration
}

DeleteRegionOptions delete region options

type DescribeClusterResult

type DescribeClusterResult struct {
	Objs               *clusterctltree.ObjectTree
	Cluster            *clusterv1.Cluster
	InstalledProviders *clusterctlv1.ProviderList
	ClusterInfo        client.ClusterInfo
}

DescribeClusterResult the result object for when the cluster's description is returned

type DescribeTKGClustersOptions

type DescribeTKGClustersOptions struct {
	ClusterName         string
	Namespace           string
	ShowOtherConditions string
	ShowDetails         bool
	ShowGroupMembers    bool
}

DescribeTKGClustersOptions options that can be passed while requesting to describe a cluster

type FeatureGateHelper added in v0.23.0

type FeatureGateHelper interface {
	FeatureActivatedInNamespace(reqContext context.Context, feature, namespace string) (bool, error)
}

func NewFeatureGateHelper added in v0.25.1

func NewFeatureGateHelper(options *clusterclient.Options, contextName, kubeconfig string) FeatureGateHelper

type GetClusterPinnipedInfoOptions

type GetClusterPinnipedInfoOptions struct {
	ClusterName         string
	Namespace           string
	IsManagementCluster bool
}

GetClusterPinnipedInfoOptions options that can be passed while getting pinniped info

type GetMachineHealthCheckOptions

type GetMachineHealthCheckOptions struct {
	ClusterName            string
	MachineHealthCheckName string
	Namespace              string
	MatchLabel             string
}

GetMachineHealthCheckOptions options that can be passed while getting the machine health check of a cluster

type GetWorkloadClusterCredentialsOptions

type GetWorkloadClusterCredentialsOptions struct {
	ClusterName string
	Namespace   string
	ExportFile  string
}

GetWorkloadClusterCredentialsOptions options that can be passed while getting workload cluster credentials

type InitRegionOptions

type InitRegionOptions struct {
	ClusterConfigFile           string
	Plan                        string
	ClusterName                 string
	CoreProvider                string
	BootstrapProvider           string
	InfrastructureProvider      string
	ControlPlaneProvider        string
	Namespace                   string
	WatchingNamespace           string
	Size                        string
	ControlPlaneSize            string
	WorkerSize                  string
	CeipOptIn                   string
	CniType                     string
	Bind                        string
	Browser                     string
	VsphereControlPlaneEndpoint string
	Edition                     string
	FeatureFlags                map[string]string
	Timeout                     time.Duration
	UI                          bool
	UseExistingCluster          bool
	EnableTKGSOnVsphere7        bool
	DeployTKGonVsphere7         bool
	SkipPrompt                  bool
	GenerateOnly                bool
}

InitRegionOptions init region options

type ListTKGClustersOptions

type ListTKGClustersOptions struct {
	ClusterName string
	Namespace   string
	IncludeMC   bool
}

ListTKGClustersOptions ptions passed while getting a list of TKG Clusters

type LoggingOptions

type LoggingOptions struct {
	// File log file name where you want logs to be written
	File string
	// Quietly if set logs will not be written to stdout/stderr
	Quietly bool
	// Verbosity number for the log level verbosity
	Verbosity int32
	// LogChannel if channel is set, writer will forward log messages to this log channel
	// The result of this will be in the format of 'LogData' struct mentioned in `pkg/log/type.go`
	LogChannel chan<- []byte
}

LoggingOptions options to configure logging with tkgctl client

type Options

type Options struct {
	// Management cluster kubeconfig
	KubeConfig string
	// Management cluster kubecontext
	KubeContext string
	// ConfigDir specifies the directory where tkg will store metadata
	ConfigDir string
	// LoggingOptions options to configure logging with tkgctl client
	LogOptions LoggingOptions
	// ProviderGetter provide provider getter interface if you want to use custom providers with tkg
	// if not set, default providers bundled with tkg library will be used
	ProviderGetter providerinterface.ProviderInterface
	// CustomizerOptions allows consumers to provider customizers for underlying client definitions
	CustomizerOptions types.CustomizerOptions
	// SettingsFile should only be provided if user want to override default TKG settings file path
	// by default `ConfigDir/config.yaml` file will be used to store tkg settings
	SettingsFile string
	// ForceUpdateTKGCompatibilityImage should only be provided if user want to explicitly force update
	// TKG compatibility image which would also update the tkg-bom and tkr-bom files
	ForceUpdateTKGCompatibilityImage bool
}

Options options to create tkgctl client

type ScaleClusterOptions

type ScaleClusterOptions struct {
	ClusterName       string
	WorkerCount       int32
	ControlPlaneCount int32
	Namespace         string
	NodePoolName      string
}

ScaleClusterOptions options that can be passed while scaling a cluster

type SetMachineHealthCheckOptions

type SetMachineHealthCheckOptions struct {
	ClusterName            string
	MachineHealthCheckName string
	Namespace              string
	MatchLabels            string
	UnhealthyConditions    string
	NodeStartupTimeout     string
}

SetMachineHealthCheckOptions options that can be passed while setting machine healthcheck of a cluster

type SetRegionOptions

type SetRegionOptions struct {
	ClusterName string
	ContextName string
}

SetRegionOptions options for set active management cluster

type TKGClient

type TKGClient interface {
	// AddRegion adds region
	AddRegion(options AddRegionOptions) error
	// ConfigCluster prints cluster template to stdout
	ConfigCluster(configClusterOption CreateClusterOptions) error
	// CreateAWSCloudFormationStack create aws cloud formation stack
	CreateAWSCloudFormationStack(clusterConfigFile string) error
	// CreateCluster create tkg cluster
	CreateCluster(cc CreateClusterOptions) error
	// DeleteCluster deletes workload cluster
	DeleteCluster(options DeleteClustersOptions) error
	// DeleteMachineHealthCheck deletes MHC on cluster
	DeleteMachineHealthCheck(options DeleteMachineHealthCheckOptions) error
	// DeleteRegion deletes management cluster
	DeleteRegion(options DeleteRegionOptions) error
	// GetCEIP returns CEIP status set on management cluster
	GetCEIP() (client.ClusterCeipInfo, error)
	// GetClusters returns list of cluster
	GetClusters(options ListTKGClustersOptions) ([]client.ClusterInfo, error)
	// DescribeCluster describes all the objects in the Cluster
	DescribeCluster(options DescribeTKGClustersOptions) (DescribeClusterResult, error)
	// DescribeProviders describes all the installed providers
	DescribeProviders() (*clusterctlv1.ProviderList, error)
	// GenerateAWSCloudFormationTemplate generates a YAML template for AWS CloudFormation
	GenerateAWSCloudFormationTemplate(clusterConfigFile string) (string, error)
	// GetCredentials saves cluster credentials to a file
	GetCredentials(options GetWorkloadClusterCredentialsOptions) error
	// GetKubernetesVersions returns supported k8s versions
	GetKubernetesVersions() (*client.KubernetesVersionsInfo, error)
	// GetMachineHealthCheck return machinehealthcheck configuration for the cluster
	GetMachineHealthCheck(options GetMachineHealthCheckOptions) ([]client.MachineHealthCheck, error)
	// GetRegions return list of management clusters
	GetRegions(managementClusterName string) ([]region.RegionContext, error)
	// Init initializes tkg management cluster
	Init(options InitRegionOptions) error
	// ScaleCluster scales cluster
	ScaleCluster(options ScaleClusterOptions) error
	// SetCeip sets CEIP to the management cluster
	SetCeip(ceipOptIn, isProd, labels string) error
	// SetMachineHealthCheck apply machine health check to the cluster
	SetMachineHealthCheck(options SetMachineHealthCheckOptions) error
	// GetMachineDeployments gets machine deployments from a cluster
	GetMachineDeployments(options client.GetMachineDeploymentOptions) ([]capi.MachineDeployment, error)
	// SetMachineDeployment applies a machine deployment to the cluster
	SetMachineDeployment(options *client.SetMachineDeploymentOptions) error
	// DeleteMachineDeployment deletes a machine deployment from the cluster
	DeleteMachineDeployment(options client.DeleteMachineDeploymentOptions) error
	// SetRegion sets active management cluster
	SetRegion(options SetRegionOptions) error
	// UpgradeCluster upgrade tkg workload cluster
	UpgradeCluster(options UpgradeClusterOptions) error
	// UpgradeRegion upgrades management cluster
	UpgradeRegion(options UpgradeRegionOptions) error
	// Updates management cluster
	UpdateCredentialsRegion(options UpdateCredentialsRegionOptions) error
	// Updates workload cluster
	UpdateCredentialsCluster(options UpdateCredentialsClusterOptions) error
	// GetClusterPinnipedInfo returns the cluster and pinniped info
	GetClusterPinnipedInfo(options GetClusterPinnipedInfoOptions) (*client.ClusterPinnipedInfo, error)
	// GetTanzuKubernetesReleases returns the available TanzuKubernetesReleases
	// Deprecated: This would not be supported from TKR API version v1alpha3,
	// user can use go client to get TKR
	GetTanzuKubernetesReleases(tkrName string) ([]runv1alpha1.TanzuKubernetesRelease, error)
	// ActivateTanzuKubernetesReleases activates TanzuKubernetesRelease
	// Deprecated: This would not be supported from TKR API version v1alpha3,
	// user can use go client to set the labels to activate/deactivate the TKR
	ActivateTanzuKubernetesReleases(tkrName string) error
	// DeactivateTanzuKubernetesReleases deactivates TanzuKubernetesRelease
	// Deprecated: This would not be supported from TKR API version v1alpha3,
	// user can use go client to set the labels to activate/deactivate the TKR
	DeactivateTanzuKubernetesReleases(tkrName string) error
	// IsPacificRegionalCluster checks if the cluster pointed to by kubeconfig is Pacific management cluster(supervisor)
	IsPacificRegionalCluster() (bool, error)
	// GetPacificClusterObject gets Pacific cluster object
	GetPacificClusterObject(clusterName, namespace string) (*tkgsv1alpha2.TanzuKubernetesCluster, error)
	// GetPacificMachineDeployments gets machine deployments from a Pacific cluster
	// Note: This would be soon deprecated after TKGS and TKGm adopt the clusterclass
	GetPacificMachineDeployments(options client.GetMachineDeploymentOptions) ([]capiv1alpha3.MachineDeployment, error)
	// FeatureGateHelper returns feature gate helper to query feature gate
	FeatureGateHelper() FeatureGateHelper
}

TKGClient implements TKG client

func New

func New(options Options) (TKGClient, error)

New creates new tkgctl client

type UpdateCredentialsClusterOptions

type UpdateCredentialsClusterOptions struct {
	ClusterName     string
	Namespace       string
	VSphereUsername string
	VSpherePassword string
	Timeout         time.Duration
}

UpdateCredentialsClusterOptions options that can be passed while updating cluster credentials

type UpdateCredentialsRegionOptions

type UpdateCredentialsRegionOptions struct {
	ClusterName     string
	VSphereUsername string
	VSpherePassword string
	IsCascading     bool
	Timeout         time.Duration
}

UpdateCredentialsRegionOptions options that can passed while updating credentials of a management-cluster

type UpgradeClusterOptions

type UpgradeClusterOptions struct {
	ClusterName string
	Namespace   string
	TkrVersion  string
	SkipPrompt  bool
	Timeout     time.Duration
	OSName      string
	OSVersion   string
	OSArch      string

	// VSphereTemplateName deprecated please use
	// OSName, OSVersion and OSArch config variable
	// to filter vSphereTemplate
	VSphereTemplateName string
	// Tanzu edition (either tce or tkg)
	Edition string
}

UpgradeClusterOptions options for upgrade cluster

type UpgradeRegionOptions

type UpgradeRegionOptions struct {
	ClusterName string
	SkipPrompt  bool
	Timeout     time.Duration
	OSName      string
	OSVersion   string
	OSArch      string

	// VSphereTemplateName (deprecated: please use OSName, OSVersion and OSArch
	// config variables to filter vSphereTemplate)
	VSphereTemplateName string
	// Tanzu edition (either tce or tkg)
	Edition string
}

UpgradeRegionOptions upgrade management cluster options

Jump to

Keyboard shortcuts

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