From 9e1f2334ba9add17aa012fcc85c4acfbe5730a44 Mon Sep 17 00:00:00 2001 From: Mangirdas Judeikis Date: Sat, 21 Dec 2024 14:50:40 +0200 Subject: [PATCH 1/2] Mount API POC --- sdk/apis/tenancy/v1alpha1/types_workspace.go | 8 +++++++- sdk/apis/tenancy/v1alpha1/types_workspacetype.go | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sdk/apis/tenancy/v1alpha1/types_workspace.go b/sdk/apis/tenancy/v1alpha1/types_workspace.go index 199661c482b..2411f44fe8e 100644 --- a/sdk/apis/tenancy/v1alpha1/types_workspace.go +++ b/sdk/apis/tenancy/v1alpha1/types_workspace.go @@ -155,11 +155,17 @@ type WorkspaceSpec struct { // +kubebuilder:validation:XValidation:rule="!has(oldSelf.path) || !has(self.path) || self.path == oldSelf.path",message="path is immutable" Type WorkspaceTypeReference `json:"type,omitempty"` + // MountName is the name of the mount that this workspace is mounted under. + // + // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="mountName is immutable" + MountName *string `json:"mountName,omitempty"` + // location constraints where this workspace can be scheduled to. // // If the no location is specified, an arbitrary location is chosen. // - // +optional + // +optionalz`` Location *WorkspaceLocation `json:"location,omitempty"` // cluster is the name of the logical cluster this workspace is stored under. diff --git a/sdk/apis/tenancy/v1alpha1/types_workspacetype.go b/sdk/apis/tenancy/v1alpha1/types_workspacetype.go index 496833effc7..bd660cf3665 100644 --- a/sdk/apis/tenancy/v1alpha1/types_workspacetype.go +++ b/sdk/apis/tenancy/v1alpha1/types_workspacetype.go @@ -116,6 +116,12 @@ type WorkspaceTypeSpec struct { // // +optional DefaultAPIBindings []APIExportReference `json:"defaultAPIBindings,omitempty"` + + // Mount is the mount configuration for the workspace type. Single type can have only one mount kind. + // If set, the workspace will be backed by a mount. + // + // +optional + Mount *metav1.TypeMeta `json:"mount,omitempty"` } // APIExportReference provides the fields necessary to resolve an APIExport. From ddabe610cf7610ce6edb81b2f3b2b8f4fd2c23e2 Mon Sep 17 00:00:00 2001 From: Mangirdas Judeikis Date: Sat, 21 Dec 2024 14:54:33 +0200 Subject: [PATCH 2/2] nit --- sdk/apis/tenancy/v1alpha1/types_workspace.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/apis/tenancy/v1alpha1/types_workspace.go b/sdk/apis/tenancy/v1alpha1/types_workspace.go index 2411f44fe8e..8b270a9ae7d 100644 --- a/sdk/apis/tenancy/v1alpha1/types_workspace.go +++ b/sdk/apis/tenancy/v1alpha1/types_workspace.go @@ -158,8 +158,9 @@ type WorkspaceSpec struct { // MountName is the name of the mount that this workspace is mounted under. // // +optional - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="mountName is immutable" - MountName *string `json:"mountName,omitempty"` + // +kubebuilder:validation:XValidation:rule="!has(oldSelf.name) || !has(self.name) || self.name == oldSelf.name",message="name is immutable" + // +kubebuilder:validation:XValidation:rule="!has(oldSelf.namespace) || !has(self.namespace) || self.namespace == oldSelf.namespace",message="namespace is immutable" + Mount *metav1.ObjectMeta `json:"mount,omitempty"` // location constraints where this workspace can be scheduled to. //