tkg

package
v0.0.0-...-0f7df2a Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

README

TKG Discovery

This repository is a collection of constants and functions which expose Discovery queries aimed at making it simple to extend and integrate with TKG.

Initialize a new TKG DiscoveryClient using rest.Config. Then, you can run any existing queries:

tkg, err := NewDiscoveryClientForConfig(cfg)
if err != nil {
    log.Fatal(err)
}

if tkg.IsManagementCluster() {
    log.Info("Management cluster")
}

Documentation

Overview

Package tkg exports constants and functions to help evaluate the state of a TKG cluster.

Index

Constants

View Source
const (
	// CloudProviderAWS is the AWS cloud provider.
	CloudProviderAWS = CloudProvider("aws")
	// CloudProviderAzure is the Azure cloud provider.
	CloudProviderAzure = CloudProvider("azure")
	// CloudProviderVsphere is the Vsphere cloud provider.
	CloudProviderVsphere = CloudProvider("vsphere")
)
View Source
const (
	// InfrastructureProviderAWS is the AWS infrastructure provider.
	InfrastructureProviderAWS = InfrastructureProvider("aws")
	// InfrastructureProviderAzure is the Azure infrastructure provider.
	InfrastructureProviderAzure = InfrastructureProvider("azure")
	// InfrastructureProviderVsphere is the Vsphere infrastructure provider.
	InfrastructureProviderVsphere = InfrastructureProvider("vsphere")
)

Variables

View Source
var Scheme = runtime.NewScheme()

Scheme is a scheme that knows about TKG resources that are used to determine capabilities.

Functions

This section is empty.

Types

type CloudProvider

type CloudProvider string

CloudProvider represents the cloud provider of the cluster.

type DiscoveryClient

type DiscoveryClient struct {
	// contains filtered or unexported fields
}

DiscoveryClient allows clients to determine capabilities of a TKG cluster.

func NewDiscoveryClient

func NewDiscoveryClient(c client.Client, clusterQueryClient *discovery.ClusterQueryClient) *DiscoveryClient

NewDiscoveryClient returns a DiscoveryClient for a controller-runtime Client and ClusterQueryClient.

func NewDiscoveryClientForConfig

func NewDiscoveryClientForConfig(config *rest.Config) (*DiscoveryClient, error)

NewDiscoveryClientForConfig returns a DiscoveryClient for a rest.Config.

func (*DiscoveryClient) HasCloudProvider

func (dc *DiscoveryClient) HasCloudProvider(ctx context.Context, cloudProvider CloudProvider) (bool, error)

HasCloudProvider checks if the cluster is configured with the given cloud provider.

func (*DiscoveryClient) HasInfrastructureProvider

func (dc *DiscoveryClient) HasInfrastructureProvider(ctx context.Context, infraProvider InfrastructureProvider) (bool, error)

HasInfrastructureProvider checks the cluster's CAPI infrastructure provider.

func (*DiscoveryClient) HasNSX

func (dc *DiscoveryClient) HasNSX(ctx context.Context) (bool, error)

HasNSX indicates if a cluster has NSX capabilities.

func (*DiscoveryClient) HasTanzuKubernetesClusterV1alpha1

func (dc *DiscoveryClient) HasTanzuKubernetesClusterV1alpha1(ctx context.Context) (bool, error)

HasTanzuKubernetesClusterV1alpha1 checks if the cluster has TanzuKubernetesCluster v1alpha1 resource.

func (*DiscoveryClient) HasTanzuKubernetesReleaseV1alpha1

func (dc *DiscoveryClient) HasTanzuKubernetesReleaseV1alpha1(ctx context.Context) (bool, error)

HasTanzuKubernetesReleaseV1alpha1 checks if the cluster has TanzuKubernetesRelease v1alpha1 resource.

func (*DiscoveryClient) HasTanzuRunGroup

func (dc *DiscoveryClient) HasTanzuRunGroup(ctx context.Context, versions ...string) (bool, error)

HasTanzuRunGroup checks if run.tanzu.vmware.com API group exists and optionally checks versions.

func (*DiscoveryClient) IsManagementCluster

func (dc *DiscoveryClient) IsManagementCluster(ctx context.Context) (bool, error)

IsManagementCluster returns true if the cluster is a TKG management cluster.

func (*DiscoveryClient) IsTKGS

func (dc *DiscoveryClient) IsTKGS(ctx context.Context) (bool, error)

IsTKGS returns true if the cluster is a TKGS cluster. Checks for the existence of any TKC API version.

func (*DiscoveryClient) IsTKGm

func (dc *DiscoveryClient) IsTKGm(ctx context.Context) (bool, error)

IsTKGm returns true if the cluster is a TKGm cluster.

func (*DiscoveryClient) IsWorkloadCluster

func (dc *DiscoveryClient) IsWorkloadCluster(ctx context.Context) (bool, error)

IsWorkloadCluster returns true if the cluster is a TKG workload cluster.

type InfrastructureProvider

type InfrastructureProvider string

InfrastructureProvider represents the CAPI infrastructure provider of the cluster.

Jump to

Keyboard shortcuts

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