tkg

package
v0.0.0-...-93a508a Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: Apache-2.0 Imports: 16 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. Deprecated: The tkg package will be removed in a future release.

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 Cluster

type Cluster struct {
	Name               string         `json:"name" yaml:"name"`
	Type               string         `json:"type" yaml:"type"`
	Plan               string         `json:"plan" yaml:"plan"`
	KubernetesProvider string         `json:"kubernetesProvider" yaml:"kubernetesProvider"`
	TkgVersion         string         `json:"tkgVersion" yaml:"tkgVersion"`
	Infrastructure     Infrastructure `json:"infrastructure" yaml:"infrastructure"`
}

Cluster stores information about the cluster. Deprecated: This struct type will be removed in a future release.

type ClusterMetadata

type ClusterMetadata struct {
	Cluster Cluster `json:"cluster" yaml:"cluster"`
}

ClusterMetadata is currently needed by one of the pre-defined queries in capabilities SDK to tell if a cluster is a management or a workload cluster Deprecated: This struct type will be removed in a future release.

type DiscoveryClient

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

DiscoveryClient allows clients to determine capabilities of a TKG cluster. Deprecated: This struct type will be removed in a future release.

func NewDiscoveryClient

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

NewDiscoveryClient returns a DiscoveryClient for a controller-runtime Client and ClusterQueryClient. Deprecated: This function will be removed in a future release.

func NewDiscoveryClientForConfig

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

NewDiscoveryClientForConfig returns a DiscoveryClient for a rest.Config. Deprecated: This function will be removed in a future release.

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. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) HasInfrastructureProvider

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

HasInfrastructureProvider checks the cluster's CAPI infrastructure provider. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) HasNSX

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

HasNSX indicates if a cluster has NSX capabilities. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) HasTanzuKubernetesClusterV1alpha1

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

HasTanzuKubernetesClusterV1alpha1 checks if the cluster has TanzuKubernetesCluster v1alpha1 resource. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) HasTanzuKubernetesReleaseV1alpha1

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

HasTanzuKubernetesReleaseV1alpha1 checks if the cluster has TanzuKubernetesRelease v1alpha1 resource. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) HasTanzuRunGroup

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

HasTanzuRunGroup checks if run.tanzu.vmware.com API group exists and optionally checks versions. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) IsManagementCluster

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

IsManagementCluster returns true if the cluster is a TKG management cluster. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) IsTKGS

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

IsTKGS returns true if the cluster is a TKGS cluster. Checks for the existence of any TKC API version. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) IsTKGm

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

IsTKGm returns true if the cluster is a TKGm cluster. Deprecated: This function will be removed in a future release.

func (*DiscoveryClient) IsWorkloadCluster

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

IsWorkloadCluster returns true if the cluster is a TKG workload cluster. Deprecated: This function will be removed in a future release.

type Infrastructure

type Infrastructure struct {
	Provider string `json:"provider" yaml:"provider"`
}

Infrastructure represents the cluster's infrastructure provider. Deprecated: This struct type will be removed in a future release.

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