Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion workspaces/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ curl -X POST http://localhost:4000/api/v1/workspaces/default \
"name": "dora",
"kind": "jupyterlab",
"paused": false,
"deferUpdates": false,
"podTemplate": {
"podMetadata": {
"labels": {
Expand Down
5 changes: 2 additions & 3 deletions workspaces/backend/api/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ func NewExampleWorkspace(name string, namespace string, workspaceKind string) *k
Namespace: namespace,
},
Spec: kubefloworgv1beta1.WorkspaceSpec{
Paused: ptr.To(false),
DeferUpdates: ptr.To(false),
Kind: workspaceKind,
Paused: ptr.To(false),
Kind: workspaceKind,
PodTemplate: kubefloworgv1beta1.WorkspacePodTemplate{
PodMetadata: &kubefloworgv1beta1.WorkspacePodMetadata{
Labels: nil,
Expand Down
8 changes: 3 additions & 5 deletions workspaces/backend/api/workspaces_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,9 @@ var _ = Describe("Workspaces Handler", func() {

By("defining a WorkspaceCreate model")
workspaceCreate := &models.WorkspaceCreate{
Name: workspaceName,
Kind: workspaceKindName,
Paused: false,
DeferUpdates: false,
Name: workspaceName,
Kind: workspaceKindName,
Paused: false,
PodTemplate: models.PodTemplateMutate{
PodMetadata: models.PodMetadataMutate{
Labels: map[string]string{
Expand Down Expand Up @@ -757,7 +756,6 @@ var _ = Describe("Workspaces Handler", func() {
Expect(createdWorkspace.ObjectMeta.Name).To(Equal(workspaceName))
Expect(createdWorkspace.Spec.Kind).To(Equal(workspaceKindName))
Expect(createdWorkspace.Spec.Paused).To(Equal(&workspaceCreate.Paused))
Expect(createdWorkspace.Spec.DeferUpdates).To(Equal(&workspaceCreate.DeferUpdates))
Expect(createdWorkspace.Spec.PodTemplate.PodMetadata.Labels).To(Equal(workspaceCreate.PodTemplate.PodMetadata.Labels))
Expect(createdWorkspace.Spec.PodTemplate.PodMetadata.Annotations).To(Equal(workspaceCreate.PodTemplate.PodMetadata.Annotations))
Expect(createdWorkspace.Spec.PodTemplate.Volumes.Home).To(Equal(workspaceCreate.PodTemplate.Volumes.Home))
Expand Down
1 change: 0 additions & 1 deletion workspaces/backend/internal/models/workspaces/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func NewWorkspaceModelFromWorkspace(ws *kubefloworgv1beta1.Workspace, wsk *kubef
Icon: iconRef,
Logo: logoRef,
},
DeferUpdates: ptr.Deref(ws.Spec.DeferUpdates, false),
Paused: ptr.Deref(ws.Spec.Paused, false),
PausedTime: ws.Status.PauseTime,
PendingRestart: ws.Status.PendingRestart,
Expand Down
7 changes: 3 additions & 4 deletions workspaces/backend/internal/models/workspaces/funcs_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ func NewWorkspaceCreateModelFromWorkspace(ws *kubefloworgv1beta1.Workspace) *Wor
}

workspaceCreateModel := &WorkspaceCreate{
Name: ws.Name,
Kind: ws.Spec.Kind,
Paused: ptr.Deref(ws.Spec.Paused, false),
DeferUpdates: ptr.Deref(ws.Spec.DeferUpdates, false),
Name: ws.Name,
Kind: ws.Spec.Kind,
Paused: ptr.Deref(ws.Spec.Paused, false),
PodTemplate: PodTemplateMutate{
PodMetadata: PodMetadataMutate{
Labels: podLabels,
Expand Down
1 change: 0 additions & 1 deletion workspaces/backend/internal/models/workspaces/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type Workspace struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
WorkspaceKind WorkspaceKindInfo `json:"workspaceKind"`
DeferUpdates bool `json:"deferUpdates"`
Paused bool `json:"paused"`
PausedTime int64 `json:"pausedTime"`
PendingRestart bool `json:"pendingRestart"`
Expand Down
9 changes: 4 additions & 5 deletions workspaces/backend/internal/models/workspaces/types_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ import (

// WorkspaceCreate is used to create a new workspace.
type WorkspaceCreate struct {
Name string `json:"name"`
Kind string `json:"kind"`
Paused bool `json:"paused"`
DeferUpdates bool `json:"deferUpdates"`
PodTemplate PodTemplateMutate `json:"podTemplate"`
Name string `json:"name"`
Kind string `json:"kind"`
Paused bool `json:"paused"`
PodTemplate PodTemplateMutate `json:"podTemplate"`
}

// Validate validates the WorkspaceCreate struct.
Expand Down
5 changes: 2 additions & 3 deletions workspaces/backend/internal/repositories/workspaces/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,8 @@ func (r *WorkspaceRepository) CreateWorkspace(ctx context.Context, workspaceCrea
Namespace: namespace,
},
Spec: kubefloworgv1beta1.WorkspaceSpec{
Paused: &workspaceCreate.Paused,
DeferUpdates: &workspaceCreate.DeferUpdates,
Kind: workspaceKindName,
Paused: &workspaceCreate.Paused,
Kind: workspaceKindName,
PodTemplate: kubefloworgv1beta1.WorkspacePodTemplate{
PodMetadata: &kubefloworgv1beta1.WorkspacePodMetadata{
Labels: workspaceCreate.PodTemplate.PodMetadata.Labels,
Expand Down
8 changes: 0 additions & 8 deletions workspaces/backend/openapi/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,6 @@ const docTemplate = `{
"type": "object",
"required": [
"activity",
"deferUpdates",
"name",
"namespace",
"paused",
Expand All @@ -1758,9 +1757,6 @@ const docTemplate = `{
"activity": {
"$ref": "#/definitions/workspaces.Activity"
},
"deferUpdates": {
"type": "boolean"
},
"name": {
"type": "string"
},
Expand Down Expand Up @@ -1799,16 +1795,12 @@ const docTemplate = `{
"workspaces.WorkspaceCreate": {
"type": "object",
"required": [
"deferUpdates",
"kind",
"name",
"paused",
"podTemplate"
],
"properties": {
"deferUpdates": {
"type": "boolean"
},
"kind": {
"type": "string"
},
Expand Down
8 changes: 0 additions & 8 deletions workspaces/backend/openapi/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,6 @@
"type": "object",
"required": [
"activity",
"deferUpdates",
"name",
"namespace",
"paused",
Expand All @@ -1756,9 +1755,6 @@
"activity": {
"$ref": "#/definitions/workspaces.Activity"
},
"deferUpdates": {
"type": "boolean"
},
"name": {
"type": "string"
},
Expand Down Expand Up @@ -1797,16 +1793,12 @@
"workspaces.WorkspaceCreate": {
"type": "object",
"required": [
"deferUpdates",
"kind",
"name",
"paused",
"podTemplate"
],
"properties": {
"deferUpdates": {
"type": "boolean"
},
"kind": {
"type": "string"
},
Expand Down
6 changes: 0 additions & 6 deletions workspaces/controller/api/v1beta1/workspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ 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
5 changes: 0 additions & 5 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.

5 changes: 2 additions & 3 deletions workspaces/controller/internal/controller/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,8 @@ func NewExampleWorkspace1(name string, namespace string, workspaceKind string) *
Namespace: namespace,
},
Spec: kubefloworgv1beta1.WorkspaceSpec{
Paused: ptr.To(false),
DeferUpdates: ptr.To(false),
Kind: workspaceKind,
Paused: ptr.To(false),
Kind: workspaceKind,
PodTemplate: kubefloworgv1beta1.WorkspacePodTemplate{
PodMetadata: &kubefloworgv1beta1.WorkspacePodMetadata{
Labels: nil,
Expand Down
21 changes: 0 additions & 21 deletions workspaces/controller/internal/controller/workspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,27 +215,6 @@ func (r *WorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
// will result in a forced restart of all Workspaces using the WorkspaceKind.
//

// if a restart is pending and the Workspace is paused, update the Workspace with the new options
if workspace.Status.PendingRestart && *workspace.Spec.Paused && !*workspace.Spec.DeferUpdates {

// update the Workspace with the new options
workspace.Spec.PodTemplate.Options.ImageConfig = workspace.Status.PodTemplateOptions.ImageConfig.Desired
workspace.Spec.PodTemplate.Options.PodConfig = workspace.Status.PodTemplateOptions.PodConfig.Desired

// update the Workspace
if err := r.Update(ctx, workspace); err != nil {
if apierrors.IsConflict(err) {
log.V(2).Info("update conflict while updating Workspace, will requeue")
return ctrl.Result{Requeue: true}, nil
}
log.Error(err, "unable to update Workspace")
return ctrl.Result{}, err
}

// return and requeue to pick up the changes
return ctrl.Result{Requeue: true}, nil
}

// generate StatefulSet
statefulSet, err := generateStatefulSet(workspace, workspaceKind, currentImageConfig.Spec, currentPodConfig.Spec)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ var _ = Describe("Workspace Controller", func() {
// - when adding a redirect to the currently selected `imageConfig` or `podConfig`
// - if the workspace is NOT paused, NO resource changes are made except setting `status.pendingRestart`
// and `status.podTemplateOptions` (`desired` along with `redirectChain`)
// - if the workspace IS paused, but `deferUpdates` is true, the same as above
// - if the workspace IS paused and `deferUpdates` is false:
// - if the workspace IS paused:
// - the selected options (under `spec`) should be changed to the redirect
// and `status.pendingRestart` should become false, and `podTemplateOptions` should be empty
// - the new options should be applied to the StatefulSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ 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: "jupyterlab"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ spec:
## - hidden options are still available to the controller and manually created Workspace resources
## - options may be "redirected" by setting `redirect.to` to another option:
## - redirected options are NOT shown in the Spawner UI
## - redirected options are like an HTTP 302 redirect, the controller will use the target option
## without actually changing the `spec.podTemplate.options` field of the Workspace
## - redirected options are computed by the controller and shown in status fields
## - users must explicitly update their Workspace via the API to apply redirects
## - the Spawner UI will warn users about Workspaces with pending restarts
##

Expand Down
2 changes: 1 addition & 1 deletion workspaces/frontend/scripts/swagger.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4f0a29dec0d3c9f0d0f02caab4dc84101bfef8b0
f94d911fac3ec4f4f231fff926a4c7cd49c67b3c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ describe('useWorkspaceFormData', () => {
},
properties: {
workspaceName: mockWorkspace.name,
deferUpdates: mockWorkspace.deferUpdates,
volumes: mockWorkspace.podTemplate.volumes.data,
secrets: mockWorkspace.podTemplate.volumes.secrets,
homeDirectory: mockWorkspace.podTemplate.volumes.home?.mountPath,
Expand Down
2 changes: 0 additions & 2 deletions workspaces/frontend/src/app/hooks/useWorkspaceFormData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const EMPTY_FORM_DATA: WorkspaceFormData = {
image: undefined,
podConfig: undefined,
properties: {
deferUpdates: false,
homeDirectory: '',
volumes: [],
secrets: [],
Expand Down Expand Up @@ -59,7 +58,6 @@ const useWorkspaceFormData = (args: {
},
properties: {
workspaceName: workspace.name,
deferUpdates: workspace.deferUpdates,
volumes: workspace.podTemplate.volumes.data.map((volume) => ({ ...volume })),
secrets: workspace.podTemplate.volumes.secrets?.map((secret) => ({ ...secret })) ?? [],
homeDirectory: workspace.podTemplate.volumes.home?.mountPath ?? '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ metadata:
name: jupyterlab-workspace
spec:
paused: false
deferUpdates: false
kind: "jupyterlab"
podTemplate:
podMetadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ const WorkspaceForm: React.FC = () => {
const submitData: WorkspacesWorkspaceCreate = {
name: data.properties.workspaceName,
kind: data.kind.name,
deferUpdates: data.properties.deferUpdates,
paused: false,
podTemplate: {
podMetadata: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useMemo, useState } from 'react';
import { Checkbox } from '@patternfly/react-core/dist/esm/components/Checkbox';
import { Content } from '@patternfly/react-core/dist/esm/components/Content';
import { Divider } from '@patternfly/react-core/dist/esm/components/Divider';
import { ExpandableSection } from '@patternfly/react-core/dist/esm/components/ExpandableSection';
Expand Down Expand Up @@ -52,19 +51,6 @@ const WorkspaceFormPropertiesSelection: React.FunctionComponent<
data-testid="workspace-name"
/>
</ThemeAwareFormGroupWrapper>
<FormGroup fieldId="defer-updates" className="pf-v6-u-pt-sm pf-v6-u-pb-sm">
<Checkbox
label="Defer Updates"
isChecked={selectedProperties.deferUpdates}
onChange={() =>
onSelect({
...selectedProperties,
deferUpdates: !selectedProperties.deferUpdates,
})
}
id="defer-updates"
/>
</FormGroup>
<Divider />
<ExpandableSection
toggleText="Volumes"
Expand Down
1 change: 0 additions & 1 deletion workspaces/frontend/src/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export interface WorkspaceKindsColumns {

export interface WorkspaceFormProperties {
workspaceName: string;
deferUpdates: boolean;
homeDirectory: string;
volumes: WorkspacesPodVolumeMount[];
secrets: WorkspacesPodSecretMount[];
Expand Down
Loading