Skip to content

reconcile: update statefulset status on success for OnDelete update strategy#2207

Open
AndrewChubatiuk wants to merge 1 commit into
masterfrom
update-sts-status-for-ondelete-strategy
Open

reconcile: update statefulset status on success for OnDelete update strategy#2207
AndrewChubatiuk wants to merge 1 commit into
masterfrom
update-sts-status-for-ondelete-strategy

Conversation

@AndrewChubatiuk
Copy link
Copy Markdown
Contributor

@AndrewChubatiuk AndrewChubatiuk commented May 22, 2026

fixes #1242


Summary by cubic

Update StatefulSet status for OnDelete strategy by setting status.currentRevision to status.updateRevision and syncing currentReplicas after pods converge or when no updates are needed. Prevents stale status in monitoring and fixes #1242.

  • Bug Fixes
    • Update StatefulSet status after rolling update completes and when no update is needed.
    • Set status.currentRevision and status.currentReplicas to reflect the actual rollout state.
    • Grant RBAC to get/update/patch apps/statefulsets/status for vlagent, vmagent, vmalertmanager, vmanomaly, and vmcluster controllers; add changelog entry.

Written for commit 390b88e. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Re-trigger cubic

@AndrewChubatiuk AndrewChubatiuk force-pushed the update-sts-status-for-ondelete-strategy branch from 3c8907d to 390b88e Compare May 22, 2026 19:21
Comment thread internal/controller/operator/factory/reconcile/statefulset.go
}
logger.WithContext(ctx).Info(fmt.Sprintf("updating statefulset=%s/%s status currentRevision from %q to %q", nsn.Namespace, nsn.Name, sts.Status.CurrentRevision, updateRevision))
sts.Status.CurrentRevision = updateRevision
sts.Status.CurrentReplicas = replicas
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why are we using desired number of replicas here - my understanding we should read status.updatedReplicas, which corresponds to the replicas from updateRevision

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status is only updated in case of success or if no actions are needed, which means statefulset is in desired state, where replicas count is equal to expected and all of them are healthy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StatefulSet using OnDelete update strategy have stale currentRevision

2 participants