-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ws-manager-mk2] Remember existing workspaces after a restart #17066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,11 @@ func (r *WorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( | |
func (r *WorkspaceReconciler) actOnStatus(ctx context.Context, workspace *workspacev1.Workspace, workspacePods corev1.PodList) (ctrl.Result, error) { | ||
log := log.FromContext(ctx) | ||
|
||
if workspace.Status.Phase != workspacev1.WorkspacePhaseStopped && !r.metrics.containsWorkspace(workspace) { | ||
// If the workspace hasn't stopped yet, and we don't know about this workspace yet, remember it. | ||
r.metrics.rememberWorkspace(workspace, nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will construct a E.g. if the workspace already has a BackupFailed condition, the We could potentially loose a few events due to this during a restart, but the alternative is re-reporting every condition for all existing workspaces after ws-manager-mk2 restarts |
||
} | ||
|
||
if len(workspacePods.Items) == 0 { | ||
// if there isn't a workspace pod and we're not currently deleting this workspace,// create one. | ||
switch { | ||
|
@@ -193,7 +198,6 @@ func (r *WorkspaceReconciler) actOnStatus(ctx context.Context, workspace *worksp | |
|
||
r.Recorder.Event(workspace, corev1.EventTypeNormal, "Creating", "") | ||
} | ||
r.metrics.rememberWorkspace(workspace, nil) | ||
|
||
case workspace.Status.Phase == workspacev1.WorkspacePhaseStopped: | ||
if err := r.deleteWorkspaceSecrets(ctx, workspace); err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes a Backup failure event being generated even on successful backups, as the error is wrapped and therefore always non-nil, so a failure event gets generated