Documentation
¶
Index ¶
- Constants
- Variables
- func DialInstance(baseClient client.Client, workspace *managementv1.DevPodWorkspaceInstance, ...) (*websocket.Conn, error)
- func DisplayName(name string, displayName string) string
- func FindInstance(ctx context.Context, baseClient client.Client, opts FindInstanceOptions) (*managementv1.DevPodWorkspaceInstance, error)
- func GetDevPodVersion(url string) (string, error)
- func GetProInstanceDevPodVersion(proInstance *provider.ProInstance) (string, error)
- func GetUserName(self *managementv1.Self) string
- func InitClientFromHost(ctx context.Context, devPodConfig *config.Config, devPodProHost string, ...) (client.Client, error)
- func InitClientFromProvider(ctx context.Context, devPodConfig *config.Config, providerName string, ...) (client.Client, error)
- func IsOwner(self *managementv1.Self, userOrTeam *storagev1.UserOrTeam) bool
- func LoftConfigPath(context string, providerName string) (string, error)
- func NewInstanceKubeConfig(ctx context.Context, platformOptions *devpod.PlatformOptions) ([]byte, error)
- func OptionsFromEnv(name string) url.Values
- func ProviderFromHost(ctx context.Context, devPodConfig *config.Config, devPodProHost string, ...) (string, error)
- func ReadConfig(contextName string, providerName string) (*client.Config, error)
- func Timeout() time.Duration
- func URLOptions(options any) url.Values
- func UpdateInstance(ctx context.Context, client client.Client, ...) (*managementv1.DevPodWorkspaceInstance, error)
- func WaitForInstance(ctx context.Context, client client.Client, ...) (*managementv1.DevPodWorkspaceInstance, error)
- func WaitForPodReady(ctx context.Context, kubeClient kubernetes.Interface, namespace string, ...) (*corev1.Pod, error)
- type FindInstanceOptions
- type OwnerFilter
- type VersionObject
- type WorkspaceInfo
Constants ¶
const ( WorkspaceIDEnv = "WORKSPACE_ID" WorkspaceUIDEnv = "WORKSPACE_UID" WorkspaceContextEnv = "WORKSPACE_CONTEXT" WorkspaceProviderEnv = "WORKSPACE_PROVIDER" WorkspaceInstanceEnv = "WORKSPACE_INSTANCE" WorkspacePictureEnv = "WORKSPACE_PICTURE" WorkspaceSourceEnv = "WORKSPACE_SOURCE" ConfigEnv = "LOFT_CONFIG" ProjectEnv = "LOFT_PROJECT" ClusterEnv = "LOFT_CLUSTER" RunnerEnv = "LOFT_RUNNER" TemplateOptionEnv = "LOFT_TEMPLATE" TemplateVersionOptionEnv = "LOFT_TEMPLATE_VERSION" TimeoutEnv = "LOFT_TIMEOUT" ProviderBinaryEnv = "PRO_PROVIDER" SpaceInstanceNameEnv = "LOFT_SPACE_INSTANCE_NAME" VirtualClusterInstanceNameEnv = "LOFT_VIRTUAL_CLUSTER_INSTANCE_NAME" InstanceNamespaceEnv = "LOFT_INSTANCE_NAMESPACE" DaemonFolderEnv = "DAEMON_FOLDER" )
const (
LoftPlatformConfigFileName string = "loft-config.json" // TODO: replace hardcoded strings with this
)
Variables ¶
var CriticalStatus = map[string]bool{ "Error": true, "Unknown": true, "ImagePullBackOff": true, "CrashLoopBackOff": true, "RunContainerError": true, "ErrImagePull": true, "CreateContainerConfigError": true, "InvalidImageName": true, }
CriticalStatus container status.
Functions ¶
func DialInstance ¶
func DisplayName ¶
func FindInstance ¶
func FindInstance( ctx context.Context, baseClient client.Client, opts FindInstanceOptions, ) (*managementv1.DevPodWorkspaceInstance, error)
FindInstance finds a DevPodWorkspaceInstance using the provided options. Either UID or Name must be specified. If neither is provided, returns an error.
func GetDevPodVersion ¶
func GetProInstanceDevPodVersion ¶
func GetProInstanceDevPodVersion(proInstance *provider.ProInstance) (string, error)
func GetUserName ¶
func GetUserName(self *managementv1.Self) string
func InitClientFromHost ¶
func InitClientFromProvider ¶
func IsOwner ¶
func IsOwner(self *managementv1.Self, userOrTeam *storagev1.UserOrTeam) bool
func NewInstanceKubeConfig ¶
func NewInstanceKubeConfig( ctx context.Context, platformOptions *devpod.PlatformOptions, ) ([]byte, error)
NewInstanceKubeConfig creates a KubeConfig (clientcmdapi.Config) based for either a space instance or virtual cluster instance. We return the config as byte slice to ensure correct handling and formatting through the `clientcmd` methods.
func OptionsFromEnv ¶
func ProviderFromHost ¶
func ReadConfig ¶
ReadConfig reads client.Config for given context and provider.
func URLOptions ¶
func UpdateInstance ¶
func UpdateInstance( ctx context.Context, client client.Client, oldInstance *managementv1.DevPodWorkspaceInstance, newInstance *managementv1.DevPodWorkspaceInstance, log log.Logger, ) (*managementv1.DevPodWorkspaceInstance, error)
UpdateInstance diffs two versions of a DevPodWorkspaceInstance, applies changes via a patch to reduce conflicts. Afterwards it waits until the instance is ready to be used.
func WaitForInstance ¶
func WaitForInstance( ctx context.Context, client client.Client, instance *managementv1.DevPodWorkspaceInstance, log log.Logger, ) (*managementv1.DevPodWorkspaceInstance, error)
Types ¶
type FindInstanceOptions ¶ added in v0.14.6
type FindInstanceOptions struct {
// UID searches for an instance by its UID label. Takes precedence over Name.
UID string
// Name searches for an instance by its name. Only used if UID is empty.
Name string
// Namespace specifies the namespace to search in. If empty and ProjectName is set,
// the project namespace is used. If both are empty, UID lookup searches all namespaces.
// Name lookup requires Namespace or ProjectName to avoid ambiguous cross-namespace matches.
Namespace string
// ProjectName converts to a project namespace. Ignored if Namespace is explicitly set.
ProjectName string
}
FindInstanceOptions configures how to find a DevPodWorkspaceInstance.
type OwnerFilter ¶
type OwnerFilter string
const ( SelfOwnerFilter OwnerFilter = "self" AllOwnerFilter OwnerFilter = "all" )
func (*OwnerFilter) Set ¶
func (s *OwnerFilter) Set(v string) error
func (*OwnerFilter) String ¶
func (s *OwnerFilter) String() string
func (*OwnerFilter) Type ¶
func (s *OwnerFilter) Type() string
type VersionObject ¶
type VersionObject struct {
// Version is the server version
Version string `json:"version,omitempty"`
// Version is the remote devpod version
DevPodVersion string `json:"devPodVersion,omitempty"`
}
func GetPlatformVersion ¶
func GetPlatformVersion(url string) (*VersionObject, error)
type WorkspaceInfo ¶
func GetWorkspaceInfoFromEnv ¶
func GetWorkspaceInfoFromEnv() (*WorkspaceInfo, error)