Skip to content

Commit 568dd91

Browse files
committed
1
1 parent a48d736 commit 568dd91

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

components/ws-daemon/pkg/controller/workspace_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func (wsc *WorkspaceController) doWorkspaceContentBackup(ctx context.Context, sp
353353
// If the container is still in a running state after that,
354354
// there may be an issue with state synchronization.
355355
// We should start backup anyway to avoid data loss.
356-
if !(ws.DeletionTimestamp != nil && time.Since(ws.DeletionTimestamp.Time) > 5*time.Minute) {
356+
if !(ws.Status.PodStoppingTime != nil && time.Since(ws.Status.PodStoppingTime.Time) > 5*time.Minute) {
357357
// We should get an event when the condition changes, but requeue
358358
// anyways to make sure we act on it in time.
359359
return ctrl.Result{RequeueAfter: 500 * time.Millisecond}, nil

components/ws-manager-api/go/crd/v1/workspace_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ type WorkspaceStatus struct {
184184
PodStarts int `json:"podStarts"`
185185
PodRecreated int `json:"podRecreated"`
186186
PodDeletionTime *metav1.Time `json:"podDeletionTime,omitempty"`
187+
PodStoppingTime *metav1.Time `json:"podStoppingTime,omitempty"`
187188
URL string `json:"url,omitempty" scrub:"redact"`
188189
OwnerToken string `json:"ownerToken,omitempty" scrub:"redact"`
189190

components/ws-manager-api/go/crd/v1/zz_generated.deepcopy.go

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

components/ws-manager-mk2/config/crd/bases/workspace.gitpod.io_workspaces.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,14 @@ spec:
548548
- Stopping
549549
- Stopped
550550
type: string
551-
podStarts:
552-
type: integer
551+
podDeletionTime:
552+
format: date-time
553+
type: string
553554
podRecreated:
554555
type: integer
555-
podDeletionTime:
556+
podStarts:
557+
type: integer
558+
podStoppingTime:
556559
format: date-time
557560
type: string
558561
runtime:
@@ -587,6 +590,7 @@ spec:
587590
url:
588591
type: string
589592
required:
593+
- podRecreated
590594
- podStarts
591595
type: object
592596
type: object

components/ws-manager-mk2/controllers/workspace_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ func (r *WorkspaceReconciler) emitPhaseEvents(ctx context.Context, ws *workspace
472472
}
473473

474474
if ws.Status.Phase == workspacev1.WorkspacePhaseStopping && old.Phase != workspacev1.WorkspacePhaseStopping {
475+
t := metav1.Now()
476+
ws.Status.PodDeletionTime = &t
475477
r.Recorder.Event(ws, corev1.EventTypeNormal, "Stopping", "")
476478
}
477479
}

0 commit comments

Comments
 (0)