Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 8730dce

Browse files
authored
Merge pull request #1477 from yiqigao217/0.8
Ensure setting 'Missing' anchor state when ns cannot create
2 parents 12a1c05 + e0ae4e5 commit 8730dce

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

incubator/hnc/internal/reconcilers/anchor.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ func (r *AnchorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
9999
// If the subnamespace doesn't exist, create it.
100100
if inst.Status.State == api.Missing {
101101
if err := r.writeNamespace(ctx, log, nm, pnm); err != nil {
102+
// Write the "Missing" state to the anchor status if the subnamespace
103+
// cannot be created for some reason. Without it, the anchor status will
104+
// remain empty by default.
105+
if anchorErr := r.writeInstance(ctx, log, inst); anchorErr != nil {
106+
log.Error(anchorErr, "while setting anchor state", "state", api.Missing, "reason", err)
107+
}
102108
return ctrl.Result{}, err
103109
}
104110
}

0 commit comments

Comments
 (0)