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 ¶
- func GetAWSCredentialsSecret(ctx context.Context) ([]byte, error)
- func GetEtcdCredentialsSecret(ctx context.Context) (string, string, error)
- func GetGCPProjectID() (*string, error)
- func GetGCPRegion() (*string, error)
- func GetGoogleServiceAccountSecret(ctx context.Context) ([]byte, error)
- func GetOperatorSettingsConfigMap(ctx context.Context) ([]byte, error)
- type ClusterManager
- type NetworkConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAWSCredentialsSecret ¶ added in v0.7.0
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
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
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
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 ¶
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.
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 ¶
func GetNetworkFromEKS ¶
GetNetworkFromEKS returns the network from EKS.
func GetNetworkFromGKE ¶
func GetNetworkFromGKE(ctx context.Context, opts ...gcoption.ClientOption) (*NetworkConfiguration, error)
GetNetworkFromGKE returns the network from GKE.