Documentation
¶
Index ¶
- Constants
- Variables
- func CreateKubeClient(context string) (kube.Interface, error)
- func CurrentContext() (string, *clientcmdapi.Config, error)
- func DetectPlatformConnectionFromKubeconfig(globalFlags *flags.GlobalFlags) (project, vClusterName string, err error)
- func FormatOptions(format string, options [][]string) []string
- func GetPlatformVCluster(ctx context.Context, platformClient platform.Client, name, project string, ...) (*platform.VirtualClusterInstanceProject, error)
- func GetPodStatus(pod *corev1.Pod) string
- func ResolveConnectedProject(ctx context.Context, platformClient platform.Client, ...) (string, error)
- func SwitchContext(kubeConfig *clientcmdapi.Config, otherContext string) error
- func VClusterConnectBackgroundProxyName(vClusterName string, vClusterNamespace string, currentContext string) string
- func VClusterContextName(vClusterName string, vClusterNamespace string, currentContext string) string
- func VClusterDockerFromContext(originalContext string) (name string, context string)
- func VClusterFromContext(originalContext string) (name string, namespace string, context string)
- func VClusterPlatformContextName(vClusterName string, projectName string, currentContext string) string
- func VClusterPlatformFromContext(originalContext string) (name string, project string, context string)
- type Status
- type VCluster
- func GetStandaloneVCluster() (*VCluster, error)
- func GetVCluster(ctx context.Context, context, name, namespace string, log log.Logger) (*VCluster, error)
- func ListOSSVClusters(ctx context.Context, kubeClient kube.Interface, ...) ([]VCluster, error)
- func ListVClusters(ctx context.Context, context, name, namespace string, log log.Logger) ([]VCluster, error)
- type VClusterNotFoundError
Constants ¶
const ( NonDeletableAnnotation = "loft.sh/non-deletable" VirtualClusterSelector = "app=vcluster" )
Variables ¶
var NonAllowedCharactersRegEx = regexp.MustCompile(`[^a-zA-Z0-9\-_]+`)
Functions ¶
func CreateKubeClient ¶ added in v0.32.0
func CurrentContext ¶
func CurrentContext() (string, *clientcmdapi.Config, error)
func DetectPlatformConnectionFromKubeconfig ¶
func DetectPlatformConnectionFromKubeconfig(globalFlags *flags.GlobalFlags) (project, vClusterName string, err error)
DetectPlatformConnectionFromKubeconfig resolves project and vCluster name from the active kubeconfig. The platform proxy server URL is preferred over context name parsing.
func FormatOptions ¶
func GetPlatformVCluster ¶
func GetPodStatus ¶
GetPodStatus returns the pod status as a string Taken from https://github.com/kubernetes/kubernetes/pkg/printers/internalversion/printers.go
func ResolveConnectedProject ¶
func ResolveConnectedProject(ctx context.Context, platformClient platform.Client, globalFlags *flags.GlobalFlags, log log.Logger) (string, error)
ResolveConnectedProject derives the platform project from the current kubeconfig connection and verifies it points at a valid platform vCluster.
func SwitchContext ¶
func SwitchContext(kubeConfig *clientcmdapi.Config, otherContext string) error
func VClusterContextName ¶
func VClusterDockerFromContext ¶ added in v0.31.0
func VClusterFromContext ¶
Types ¶
type VCluster ¶
type VCluster struct {
ClientFactory clientcmd.ClientConfig `json:"-"`
Pods []corev1.Pod `json:"-"`
Deployment *appsv1.Deployment `json:"-"`
StatefulSet *appsv1.StatefulSet `json:"-"`
VirtualClusterInstance *storagev1.VirtualClusterInstance `json:"-"`
Created metav1.Time
Name string
Namespace string
ServiceName string
Annotations map[string]string
Labels map[string]string
Status Status
Context string
Version string
IsStandalone bool
}
func GetStandaloneVCluster ¶ added in v0.34.0
GetStandaloneVCluster returns a vCluster for a standalone installation on the current host. Detection relies on the systemd service file existing on the local filesystem, so this only works when the CLI runs on the same host as the vCluster standalone. Returns nil, nil when standalone is not detected.
func GetVCluster ¶
func ListOSSVClusters ¶
func ListVClusters ¶
func (*VCluster) GetAnnotations ¶
GetAnnotations implements Annotated
func (*VCluster) HasPreventDeletionEnabled ¶ added in v0.24.2
HasPreventDeletionEnabled returns true if the virtual cluster has "Prevent Deletion" enabled in the platform, otherwise it returns false. This check works only when:
- you are running vcluster CLI while connected to the host cluster where VirtualClusterInstance resource is available, or
- for clusters that are created or updated with platform version 4.3.0 or newer.
func (*VCluster) IsSleeping ¶
type VClusterNotFoundError ¶
type VClusterNotFoundError struct {
Name string
}
func (*VClusterNotFoundError) Error ¶
func (e *VClusterNotFoundError) Error() string