k8s

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructInClusterKubeconfig

func ConstructInClusterKubeconfig(ctx context.Context, restConfig *rest.Config, namespace string) (*clientcmdapi.Config, error)

ConstructInClusterKubeconfig generates a kubeconfig file for the management cluster using a rest.Config. This is a bit of a workaround since the k8s.io/client-go/tools/clientcmd/api expects to be run from a CLI context, but within a pod we don't have that. As a result, we have to manually fill in the fields that would normally be present in ~/.kube/config. This seems to work for now.

func GetClusterKubeconfig

func GetClusterKubeconfig(ctx context.Context, cluster *clusterv1.Cluster) (string, error)

GetClusterKubeconfig returns the kubeconfig for a selected Cluster as a string.

func InitInClusterKubeconfig

func InitInClusterKubeconfig(ctx context.Context) (*cluster.Kubeconfig, error)

InitInClusterKubeconfig generates a kubeconfig file for the management cluster. Note: The k8s.io/client-go/tools/clientcmd/api package and associated tools require a path to a kubeconfig file rather than the data stored in an object.

func WriteInClusterKubeconfigToFile

func WriteInClusterKubeconfigToFile(ctx context.Context, filePath string, clientConfig clientcmdapi.Config) error

WriteInClusterKubeconfigToFile writes the clientcmdapi.Config to a kubeconfig file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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