Skip to content

Commit

Permalink
fix: do not delete workspace pod on authz errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rquitales committed Feb 5, 2025
1 parent 5aa3454 commit a169516
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions operator/internal/controller/auto/workspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,20 @@ func (r *WorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
initializedV, ok := pod.Annotations[PodAnnotationInitialized]
initialized, _ := strconv.ParseBool(initializedV)
if !ok || !initialized {
l.Info("Running whoami to ensure authentication is setup correctly with the workspace pod")
_, err = wc.WhoAmI(ctx, &agentpb.WhoAmIRequest{})
if err != nil {
l.Error(err, "unable to authenticate; retaining the workspace pod to retry later")
ready.Status = metav1.ConditionFalse
ready.Reason = "AuthenticationFailed"
ready.Message = "Unable to authenticate with the workspace pod."
if statusErr := updateStatus(); statusErr != nil {
return ctrl.Result{}, statusErr
}

return ctrl.Result{}, err
}

l.Info("Running pulumi install")
ready.Status = metav1.ConditionFalse
ready.Reason = "Installing"
Expand Down

0 comments on commit a169516

Please sign in to comment.