Skip to content

Commit afcd8b7

Browse files
committed
1
1 parent d382a9b commit afcd8b7

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,17 @@ type WorkspaceImageInfo struct {
181181

182182
// WorkspaceStatus defines the observed state of Workspace
183183
type WorkspaceStatus struct {
184-
PodStarts int `json:"podStarts"`
185-
PodRecreated int `json:"podRecreated"`
184+
PodStarts int `json:"podStarts"`
185+
186+
// +kubebuilder:validation:Optional
187+
PodRecreated int `json:"podRecreated"`
188+
// +kubebuilder:validation:Optional
186189
PodDeletionTime *metav1.Time `json:"podDeletionTime,omitempty"`
190+
// +kubebuilder:validation:Optional
187191
PodStoppingTime *metav1.Time `json:"podStoppingTime,omitempty"`
188-
URL string `json:"url,omitempty" scrub:"redact"`
189-
OwnerToken string `json:"ownerToken,omitempty" scrub:"redact"`
192+
193+
URL string `json:"url,omitempty" scrub:"redact"`
194+
OwnerToken string `json:"ownerToken,omitempty" scrub:"redact"`
190195

191196
// +kubebuilder:default=Unknown
192197
Phase WorkspacePhase `json:"phase,omitempty"`

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,6 @@ spec:
590590
url:
591591
type: string
592592
required:
593-
- podRecreated
594593
- podStarts
595594
type: object
596595
type: object

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ func (r *WorkspaceReconciler) updateWorkspaceStatus(ctx context.Context, workspa
5959
defer func() {
6060
if oldPhase != workspace.Status.Phase {
6161
log.Info("workspace phase updated", "oldPhase", oldPhase, "phase", workspace.Status.Phase)
62+
if workspace.Status.Phase == workspacev1.WorkspacePhaseStopping {
63+
t := metav1.Now()
64+
workspace.Status.PodStoppingTime = &t
65+
}
6266
}
6367
}()
6468

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,6 @@ 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.PodStoppingTime = &t
477475
r.Recorder.Event(ws, corev1.EventTypeNormal, "Stopping", "")
478476
}
479477
}

0 commit comments

Comments
 (0)