Skip to content

Commit 5256a5e

Browse files
committed
wip
1 parent dc10936 commit 5256a5e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

controllers/serviceaccount_controller.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,20 @@ func (r *GrafanaServiceAccountReconciler) removeAccount(
290290
)
291291
return nil
292292
}
293-
return fmt.Errorf("deleting service account %q: %w", status.SpecID, err)
293+
294+
// TODO: Grafana Operator currently deployes Grafana 11.3.0 (see controllers/config/operator_constants.go#L6).
295+
// Till Grafana 12.0.2 there was no reliable way to detect a 404 when deleting a service account.
296+
// The API still returns 500 (see grafana/grafana#106618).
297+
//
298+
// Once we upgrade to Grafana > 12.0.2 and bump github.com/grafana/grafana-openapi-client-go,
299+
// we can handle the real 404 explicitly.
300+
//
301+
// In the meantime we treat any non-nil error from the delete call as "already removed" and just log it for visibility.
302+
logf.FromContext(ctx).Error(err, "failed to delete service account",
303+
"serviceAccountID", status.ServiceAccountID,
304+
"specID", status.SpecID,
305+
)
306+
// return fmt.Errorf("deleting service account %q: %w", status.SpecID, err)
294307
}
295308

296309
return nil

0 commit comments

Comments
 (0)