cluster

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package cluster contains code that gets information about the cluster where we are running and if it is a managed cluster, e.g. GKE or EKS. For example: VPC, SubNetwork, Cluster Name, etc.

Additionally, it also retrieves common objects from Kubernetes, e.g.: ConfigMap and Secrets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAWSCredentialsSecret added in v0.7.0

func GetAWSCredentialsSecret(ctx context.Context) ([]byte, error)

GetAWSCredentialsSecret tries to retrieve the Google Service Account secret from Kubernetes, so that it could be used to login to AWS. TODO: as of now this function is basically the same as the one for google. For now we keep it like this, but the whole package will soon be redesigned anyways.

func GetEtcdCredentialsSecret added in v0.5.0

func GetEtcdCredentialsSecret(ctx context.Context) (string, string, error)

GetEtcdCredentials tries to retrieve the etcd credentials secret from Kubernetes, so that it could be used to start an etcd client.

func GetGCPProjectID added in v0.5.0

func GetGCPProjectID() (*string, error)

GetGCPProjectID attempts to get the project ID where GKE is running in. This is not called GetGKEProjectID but GetGCPProjectID to be consistent with GCP sdk.

func GetGCPRegion added in v0.5.0

func GetGCPRegion() (*string, error)

GetGCPRegion attempts to get the region where GKE is running in. This is not called GetGKERegion but GetGCPRegion to be consistent with GCP sdk.

func GetGoogleServiceAccountSecret

func GetGoogleServiceAccountSecret(ctx context.Context) ([]byte, error)

GetGoogleServiceAccountSecret tries to retrieve the Google Service Account secret from Kubernetes, so that it could be used to login to Google Cloud services such as Service Directory or to pull cloud metadata/configuration.

func GetOperatorSettingsConfigMap added in v0.5.0

func GetOperatorSettingsConfigMap(ctx context.Context) ([]byte, error)

Types

type ClusterManager

type ClusterManager string
const (
	GKECluster     ClusterManager = "GKE"
	EKSCluster     ClusterManager = "EKS"
	UnknownCluster ClusterManager = "UNKNOWN"
)

func WhereAmIRunning

func WhereAmIRunning() ClusterManager

WhereAmIRunning attempts to detect the platform where the CN-WAN Operator is running and returns the name of the platform if found, otherwise it returns UnknownCluster.

type NetworkConfiguration

type NetworkConfiguration struct {
	NetworkName    string
	SubNetworkName string
}

func GetNetworkFromEKS

func GetNetworkFromEKS(ctx context.Context, cfgs ...*aws.Config) (*NetworkConfiguration, error)

GetNetworkFromEKS returns the network from EKS.

func GetNetworkFromGKE

func GetNetworkFromGKE(ctx context.Context, opts ...gcoption.ClientOption) (*NetworkConfiguration, error)

GetNetworkFromGKE returns the network from GKE.

Jump to

Keyboard shortcuts

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