Documentation
¶
Overview ¶
Package kubectl configures kubectl for Podplane clusters.
Index ¶
- func ClusterIDFromContext(kubeContext, kubeconfig string) (string, error)
- func ClusterKey(clusterID string, local bool) string
- func ConfigureClusterAccess(stdout io.Writer, clusterID, serverURL, sub, caCertPath string, local bool) error
- func ContextKey(clusterID string, local bool) string
- func CredentialsKey(sub string, clusterID string, local bool) string
- func DeleteClusterAccess(stdout io.Writer, clusterID string, subs []string, local bool) error
- func SetCluster(stdout io.Writer, clusterID string, kubeApiUrl string, caCertPath string, ...) error
- func SetContext(stdout io.Writer, sub string, clusterID string, local bool) error
- func SetCredentials(stdout io.Writer, sub string, clusterID string, local bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterIDFromContext ¶
ClusterIDFromContext returns a Podplane cluster ID from a kubeconfig context. If kubeContext is empty, the current context is used.
func ClusterKey ¶
ClusterKey returns the kubectl cluster key for the given clusterID. Remote: podplane-{clusterID} Local: podplane-local-{clusterID}
func ConfigureClusterAccess ¶
func ConfigureClusterAccess(stdout io.Writer, clusterID, serverURL, sub, caCertPath string, local bool) error
ConfigureClusterAccess configures kubectl access for a Podplane cluster by setting the cluster, credentials, and context entries used by the kubectl exec auth hook. When local is true the kubeconfig keys use a "local-" prefix so they don't collide with remote clusters.
func ContextKey ¶
ContextKey returns the kubectl context key for the given clusterID. Remote: {clusterID} Local: local-{clusterID}, or just "local" when clusterID is "default"
func CredentialsKey ¶
CredentialsKey returns the kubectl credentials (user) key for the given sub and clusterID. Remote: podplane-{clusterID}-{sub} Local: podplane-local-{clusterID}-{sub}
func DeleteClusterAccess ¶
DeleteClusterAccess removes the kubeconfig context, cluster, and user entries created by ConfigureClusterAccess. Missing entries are ignored so cleanup can safely run after partial setup or repeated delete/logout attempts.
func SetCluster ¶
func SetCluster(stdout io.Writer, clusterID string, kubeApiUrl string, caCertPath string, local bool) error
SetCluster first uses kubectl to check if a cluster with the same key already exists (and early exits if so), then runs kubectl to set a cluster
func SetContext ¶
SetContext first uses kubectl to check if a context with the same key already exists (and early exits if so), then runs kubectl to set a context
func SetCredentials ¶
SetCredentials first uses kubectl to check if a credential with the same key already exists (and early exits if so), then runs kubectl to set credentials.
The credentials key is `podplane-<clusterID>-<sub>`. The exec plugin invokes `podplane hooks kubectl-auth --cluster <clusterID> --user <sub>`.
Types ¶
This section is empty.