Skip to content

Commit

Permalink
mathew updates 2
Browse files Browse the repository at this point in the history
Signed-off-by: Mathew Wicks <[email protected]>
  • Loading branch information
thesuperzapper committed Jul 9, 2024
1 parent 54e7ed2 commit 01ce3ff
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 46 deletions.
44 changes: 35 additions & 9 deletions workspaces/controller/api/v1beta1/workspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ type WorkspaceSpec struct {
//+kubebuilder:default=false
Paused *bool `json:"paused,omitempty"`

// if true, pending updates are NOT applied when the Workspace is paused
// if false, pending updates are applied when the Workspace is paused
//+kubebuilder:validation:Optional
//+kubebuilder:default=false
DeferUpdates *bool `json:"deferUpdates,omitempty"`

// the WorkspaceKind to use
//+kubebuilder:validation:MinLength:=2
//+kubebuilder:validation:MaxLength:=63
Expand Down Expand Up @@ -150,7 +156,7 @@ type WorkspaceStatus struct {
//+kubebuilder:default=false
PendingRestart bool `json:"pendingRestart"`

// the `spec.podTemplate.options` which will take effect after the next restart
// information about the current podTemplate options
PodTemplateOptions WorkspacePodOptionsStatus `json:"podTemplateOptions"`

// the current state of the Workspace
Expand All @@ -176,15 +182,35 @@ type WorkspaceActivity struct {
}

type WorkspacePodOptionsStatus struct {
// the id of an imageConfig option
// - will be "" when the Workspace is first created
//+kubebuilder:default=""
ImageConfig string `json:"imageConfig"`
// info about the current imageConfig option
ImageConfig WorkspacePodOptionInfo `json:"imageConfig"`

// the id of a podConfig option
// - will be "" when the Workspace is first created
//+kubebuilder:default=""
PodConfig string `json:"podConfig"`
// info about the current podConfig option
PodConfig WorkspacePodOptionInfo `json:"podConfig"`
}

type WorkspacePodOptionInfo struct {
// the option id which will take effect after the next restart
//+kubebuilder:validation:MinLength:=1
//+kubebuilder:validation:MaxLength:=256
//+kubebuilder:validation:Optional
Desired string `json:"desired,omitempty"`

// the chain from the current option to the desired option
//+kubebuilder:validation:Optional
RedirectChain []WorkspacePodOptionRedirectStep `json:"redirectChain,omitempty"`
}

type WorkspacePodOptionRedirectStep struct {
// the source option id
//+kubebuilder:validation:MinLength:=1
//+kubebuilder:validation:MaxLength:=256
Source string `json:"source"`

// the target option id
//+kubebuilder:validation:MinLength:=1
//+kubebuilder:validation:MaxLength:=256
Target string `json:"target"`
}

// +kubebuilder:validation:Enum:={"Running","Terminating","Paused","Pending","Error","Unknown"}
Expand Down
46 changes: 44 additions & 2 deletions workspaces/controller/api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 65 additions & 12 deletions workspaces/controller/config/crd/bases/kubeflow.org_workspaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ spec:
spec:
description: WorkspaceSpec defines the desired state of Workspace
properties:
deferUpdates:
default: false
description: |-
if true, pending updates are NOT applied when the Workspace is paused
if false, pending updates are applied when the Workspace is paused
type: boolean
kind:
description: the WorkspaceKind to use
example: jupyterlab
Expand Down Expand Up @@ -198,21 +204,68 @@ spec:
like `podMetadata`, `probes`, `extraEnv`, or `containerSecurityContext`
type: boolean
podTemplateOptions:
description: the `spec.podTemplate.options` which will take effect
after the next restart
description: information about the current podTemplate options
properties:
imageConfig:
default: ""
description: |-
the id of an imageConfig option
- will be "" when the Workspace is first created
type: string
description: info about the current imageConfig option
properties:
desired:
description: the option id which will take effect after the
next restart
maxLength: 256
minLength: 1
type: string
redirectChain:
description: the chain from the current option to the desired
option
items:
properties:
source:
description: the source option id
maxLength: 256
minLength: 1
type: string
target:
description: the target option id
maxLength: 256
minLength: 1
type: string
required:
- source
- target
type: object
type: array
type: object
podConfig:
default: ""
description: |-
the id of a podConfig option
- will be "" when the Workspace is first created
type: string
description: info about the current podConfig option
properties:
desired:
description: the option id which will take effect after the
next restart
maxLength: 256
minLength: 1
type: string
redirectChain:
description: the chain from the current option to the desired
option
items:
properties:
source:
description: the source option id
maxLength: 256
minLength: 1
type: string
target:
description: the target option id
maxLength: 256
minLength: 1
type: string
required:
- source
- target
type: object
type: array
type: object
required:
- imageConfig
- podConfig
Expand Down
4 changes: 4 additions & 0 deletions workspaces/controller/config/samples/v1beta1_workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ spec:
## if the workspace is paused (no pods running)
paused: false

## if true, pending updates are NOT applied when the Workspace is paused
## if false, pending updates are applied when the Workspace is paused
deferUpdates: false

## the WorkspaceKind to use
kind: "juptyerlab"

Expand Down
Loading

0 comments on commit 01ce3ff

Please sign in to comment.