Documentation ¶
Index ¶
- func ConstructInClusterKubeconfig(ctx context.Context, restConfig *rest.Config, namespace string) (*clientcmdapi.Config, error)
- func GetClusterKubeconfig(ctx context.Context, cluster *clusterv1.Cluster) (string, error)
- func InitInClusterKubeconfig(ctx context.Context) (*cluster.Kubeconfig, error)
- func WriteInClusterKubeconfigToFile(ctx context.Context, filePath string, clientConfig clientcmdapi.Config) error
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 ¶
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.