Skip to content

Commit 9db9b7c

Browse files
committed
Update a restore feature based on code review
Signed-off-by: Ales Raszka <araszka@redhat.com>
1 parent 5480c1c commit 9db9b7c

File tree

11 files changed

+59
-28
lines changed

11 files changed

+59
-28
lines changed

apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ type ProjectCloneConfig struct {
380380
}
381381

382382
type RestoreConfig struct {
383+
// ImagePullPolicy configures the imagePullPolicy for the restore container.
384+
// If undefined, the general setting .config.workspace.imagePullPolicy is used instead.
383385
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
384386
// Resources defines the resource (cpu, memory) limits and requests for the restore
385387
// container. To explicitly not specify a limit or request, define the resource

controllers/workspace/devworkspace_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func (r *DevWorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request
365365
} else {
366366
restoreOptions.PullPolicy = corev1.PullIfNotPresent
367367
}
368-
if workspaceRestore, err := restore.GetWorkspaceRestoreInitContainer(ctx, workspace, clusterAPI.Client, restoreOptions, reqLogger); err != nil {
368+
if workspaceRestore, err := restore.GetWorkspaceRestoreInitContainer(ctx, workspace, restoreOptions); err != nil {
369369
return r.failWorkspace(workspace, fmt.Sprintf("Failed to set up workspace-restore init container: %s", err), metrics.ReasonInfrastructureFailure, reqLogger, &reconcileStatus), nil
370370
} else if workspaceRestore != nil {
371371
devfilePodAdditions.InitContainers = append([]corev1.Container{*workspaceRestore}, devfilePodAdditions.InitContainers...)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
kind: DevWorkspace
2+
apiVersion: workspace.devfile.io/v1alpha2
3+
metadata:
4+
labels:
5+
controller.devfile.io/creator: ""
6+
spec:
7+
started: true
8+
routingClass: 'basic'
9+
template:
10+
attributes:
11+
controller.devfile.io/storage-type: common
12+
controller.devfile.io/restore-workspace: 'false'
13+
projects:
14+
- name: web-nodejs-sample
15+
git:
16+
remotes:
17+
origin: "https://github.com/che-samples/web-nodejs-sample.git"
18+
components:
19+
- name: web-terminal
20+
container:
21+
image: quay.io/wto/web-terminal-tooling:latest
22+
memoryLimit: 512Mi
23+
mountSources: true
24+
command:
25+
- "tail"
26+
- "-f"
27+
- "/dev/null"

deploy/bundle/manifests/controller.devfile.io_devworkspaceoperatorconfigs.yaml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/deployment/kubernetes/combined.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/deployment/kubernetes/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/deployment/openshift/combined.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/deployment/openshift/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/templates/crd/bases/controller.devfile.io_devworkspaceoperatorconfigs.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/constants/attributes.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ const (
153153
BootstrapDevWorkspaceAttribute = "controller.devfile.io/bootstrap-devworkspace"
154154

155155
// WorkspaceRestoreAttribute defines whether workspace restore should be performed for a DevWorkspace.
156-
// If this attribute is present, the restore process will be performed during workspace
157-
// initialization before the workspace containers start.
158-
159-
// The backup source is automatically determined from the cluster configuration or can be overridden
160-
// by specifying the WorkspaceRestoreSourceImageAttribute.
156+
// If this attribute is present and set to true, the restore process will be performed during
157+
// workspace initialization, before workspace containers start.
158+
//
159+
// The backup source is automatically determined from the cluster configuration unless overridden
160+
// by WorkspaceRestoreSourceImageAttribute.
161161
WorkspaceRestoreAttribute = "controller.devfile.io/restore-workspace"
162162

163163
// WorkspaceRestoreSourceImageAttribute defines the backup image source to restore from for a DevWorkspace.

0 commit comments

Comments
 (0)