kubeconfig

package
v2.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextPrefix    = "gs-"
	ClientCertSuffix = "-clientcert"
	AWSIAMSuffix     = "-awsiam"
)
View Source
const (
	CertFileName = "k8s-ca.crt"
)

Variables

This section is empty.

Functions

func GenerateKubeContextName

func GenerateKubeContextName(installationCodeName string) string

GenerateKubeContextName creates a context name, from an installation's code name.

func GenerateWCAWSIAMKubeContextName added in v2.41.0

func GenerateWCAWSIAMKubeContextName(mcKubeContextName string, wcName string) string

func GenerateWCClientCertKubeContextName

func GenerateWCClientCertKubeContextName(mcKubeContextName string, wcName string) string

func GenerateWCKubeContextName

func GenerateWCKubeContextName(mcKubeContextName string, wcName string) string

func GetAuthProvider

func GetAuthProvider(config *clientcmdapi.Config, contextName string) (*clientcmdapi.AuthProviderConfig, bool)

GetAuthProvider fetches the authentication provider from kubeconfig, for a desired context name.

func GetClientCertContextName

func GetClientCertContextName(identifier string) string

GetClientCertContextName returns the name of the client cert context name for an identifier

func GetClusterNameFromKubeContext

func GetClusterNameFromKubeContext(c string) string

func GetClusterServer

func GetClusterServer(config *clientcmdapi.Config, contextName string) (string, bool)

func GetCodeNameFromKubeContext

func GetCodeNameFromKubeContext(c string) string

GetCodeNameFromKubeContext gets an installation's code name, by knowing the context used to reference it.

func GetKubeCertFilePath

func GetKubeCertFilePath(clusterName string) (string, error)

func GetKubeCertPath

func GetKubeCertPath(clusterName string) (string, error)

func IsCodeName

func IsCodeName(s string) bool

IsCodeName checks whether a provided name is an installation's code name.

func IsWCCodeName

func IsWCCodeName(s string) bool

IsWCCodeName checks whether a provided name is a WC id with installation code name prefix.

func WriteCertificate

func WriteCertificate(cert, clusterName string, fs afero.Fs) error

Types

type AuthType

type AuthType int
const (
	AuthTypeUnknown AuthType = iota
	AuthTypeServiceAccount
	AuthTypeAuthProvider
	AuthTypeClientCertificate
)

func GetAuthType

func GetAuthType(config *clientcmdapi.Config, contextName string) AuthType

type ContextType

type ContextType int
const (
	ContextTypeNone ContextType = iota
	ContextTypeMC
	ContextTypeWC
)

func GetKubeContextType

func GetKubeContextType(s string) ContextType

func IsKubeContext

func IsKubeContext(s string) (bool, ContextType)

IsKubeContext checks whether the name provided, matches our pattern for naming kubernetes contexts.

Jump to

Keyboard shortcuts

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