find

package
v0.33.2-rc3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NonDeletableAnnotation = "loft.sh/non-deletable"
	VirtualClusterSelector = "app=vcluster"
)

Variables

View Source
var NonAllowedCharactersRegEx = regexp.MustCompile(`[^a-zA-Z0-9\-_]+`)

Functions

func CreateKubeClient added in v0.32.0

func CreateKubeClient(context string) (kube.Interface, error)

func CurrentContext

func CurrentContext() (string, *clientcmdapi.Config, error)

func FormatOptions

func FormatOptions(format string, options [][]string) []string

func GetPlatformVCluster

func GetPlatformVCluster(ctx context.Context, platformClient platform.Client, name, project string, log log.Logger) (*platform.VirtualClusterInstanceProject, error)

func GetPodStatus

func GetPodStatus(pod *corev1.Pod) string

GetPodStatus returns the pod status as a string Taken from https://github.com/kubernetes/kubernetes/pkg/printers/internalversion/printers.go

func SwitchContext

func SwitchContext(kubeConfig *clientcmdapi.Config, otherContext string) error

func VClusterConnectBackgroundProxyName

func VClusterConnectBackgroundProxyName(vClusterName string, vClusterNamespace string, currentContext string) string

func VClusterContextName

func VClusterContextName(vClusterName string, vClusterNamespace string, currentContext string) string

func VClusterDockerFromContext added in v0.31.0

func VClusterDockerFromContext(originalContext string) (name string, context string)

func VClusterFromContext

func VClusterFromContext(originalContext string) (name string, namespace string, context string)

func VClusterPlatformContextName

func VClusterPlatformContextName(vClusterName string, projectName string, currentContext string) string

func VClusterPlatformFromContext

func VClusterPlatformFromContext(originalContext string) (name string, project string, context string)

Types

type Status

type Status string
const (
	StatusRunning          Status = "Running"
	StatusPaused           Status = "Paused"
	StatusWorkloadSleeping Status = "Sleeping (workloads only)"
	StatusScaledDown       Status = "ScaledDown"
	StatusUnknown          Status = "Unknown"
)

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 GetVCluster

func GetVCluster(ctx context.Context, context, name, namespace string, log log.Logger) (*VCluster, error)

func GetVClusterStandaloneOrVCluster

func GetVClusterStandaloneOrVCluster(ctx context.Context, context, name, namespace string, log log.Logger) (*VCluster, error)

GetVClusterStandaloneOrVCluster supports both regular host-cluster lookup and local standalone lookup. The CLI selector "local-standalone" explicitly targets the standalone service on this host and makes standalone probe errors fatal. For real runtime names, standalone lookup is only an opportunistic shortcut: if the local standalone runtime name matches the requested name, use it; otherwise fall back to regular host-cluster discovery so in-cluster vClusters with arbitrary names keep working.

func ListOSSVClusters

func ListOSSVClusters(ctx context.Context, kubeClient kube.Interface, context, name, namespace string) ([]VCluster, error)

func ListVClusters

func ListVClusters(ctx context.Context, context, name, namespace string, log log.Logger) ([]VCluster, error)

func (*VCluster) GetAnnotations

func (v *VCluster) GetAnnotations() map[string]string

GetAnnotations implements Annotated

func (*VCluster) GetLabels

func (v *VCluster) GetLabels() map[string]string

GetLabels implements Labeled

func (*VCluster) HasPreventDeletionEnabled added in v0.24.2

func (v *VCluster) HasPreventDeletionEnabled() bool

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

func (v *VCluster) IsSleeping() bool

type VClusterNotFoundError

type VClusterNotFoundError struct {
	Name string
}

func (*VClusterNotFoundError) Error

func (e *VClusterNotFoundError) Error() string

Jump to

Keyboard shortcuts

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