Documentation ¶
Overview ¶
Package clustername provides helpers to get a Kubernetes cluster name.
Index ¶
- Variables
- func GetClusterID() (string, error)
- func GetClusterName(ctx context.Context, hostname string) string
- func GetClusterNameTagValue(ctx context.Context, hostname string) string
- func GetRFC1123CompliantClusterName(ctx context.Context, hostname string) string
- func IsRFC1123CompliantClusterName(clusterName string) bool
- func MakeClusterNameRFC1123Compliant(clusterName string) string
- func ResetClusterName()
- type Provider
Constants ¶
This section is empty.
Variables ¶
var ProviderCatalog map[string]Provider
ProviderCatalog holds all the various kinds of clustername providers
Functions ¶
func GetClusterID ¶
GetClusterID looks for an env variable which should contain the cluster ID. This variable should come from a configmap, created by the cluster-agent. This function is meant for the node-agent to call (cluster-agent should call GetOrCreateClusterID)
func GetClusterName ¶
GetClusterName returns a k8s cluster name if it exists, either directly specified or autodiscovered
func GetClusterNameTagValue ¶
GetClusterNameTagValue a k8s cluster name if it exists, either directly specified or autodiscovered
This function also "normalize" the k8s cluster name if the configuration option "enabled_rfc1123_compliant_cluster_name_tag" is set to "true" this allow to limit the risk of breaking user that currently rely on previous `kube_cluster_name` tag value.
func GetRFC1123CompliantClusterName ¶
GetRFC1123CompliantClusterName returns an RFC-1123 compliant k8s cluster name if it exists, either directly specified or autodiscovered
func IsRFC1123CompliantClusterName ¶
IsRFC1123CompliantClusterName check if the clusterName is RFC1123 compliant return false if not compliant
func MakeClusterNameRFC1123Compliant ¶
MakeClusterNameRFC1123Compliant returns the RFC-1123 compliant cluster name.
func ResetClusterName ¶
func ResetClusterName()
ResetClusterName resets the clustername, which allows it to be detected again. Used for tests