clustername

package
v0.0.0-...-92348d9 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package clustername provides helpers to get a Kubernetes cluster name.

Index

Constants

This section is empty.

Variables

View Source
var ProviderCatalog map[string]Provider

ProviderCatalog holds all the various kinds of clustername providers

Functions

func GetClusterID

func GetClusterID() (string, error)

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

func GetClusterName(ctx context.Context, hostname string) string

GetClusterName returns a k8s cluster name if it exists, either directly specified or autodiscovered

func GetClusterNameTagValue

func GetClusterNameTagValue(ctx context.Context, hostname string) string

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

func GetRFC1123CompliantClusterName(ctx context.Context, hostname string) string

GetRFC1123CompliantClusterName returns an RFC-1123 compliant k8s cluster name if it exists, either directly specified or autodiscovered

func IsRFC1123CompliantClusterName

func IsRFC1123CompliantClusterName(clusterName string) bool

IsRFC1123CompliantClusterName check if the clusterName is RFC1123 compliant return false if not compliant

func MakeClusterNameRFC1123Compliant

func MakeClusterNameRFC1123Compliant(clusterName string) string

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

Types

type Provider

type Provider func(context.Context) (string, error)

Provider is a generic function to grab the clustername and return it

Jump to

Keyboard shortcuts

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