Skip to content

feat(nomos): add --poll-until to nomos status - #2242

Open
tomatotomata wants to merge 8 commits into
GoogleContainerTools:mainfrom
tomatotomata:codex/poll-until-status-2006
Open

tomatotomata wants to merge 8 commits into
GoogleContainerTools:mainfrom
tomatotomata:codex/poll-until-status-2006

Conversation

@tomatotomata

@tomatotomata tomatotomata commented Jul 28, 2026 •

Copy link
Copy Markdown

Fixes #2006

Summary

Adds explicit completion targets for nomos status:

  • --poll-until=synced waits for the selected RootSync and RepoSync objects to report SYNCED without errors.
  • --poll-until=current also waits for every reported managed resource to become Current.

The --name filter scopes the completion check. An empty reachable cluster does not block other contexts, and at least one selected RootSync or RepoSync must be found. In current mode, a Failed resource returns an error instead of polling forever; Unknown remains incomplete. Use synced when resource readiness is not required.

Validation

  • go test ./cmd/nomos/status -run 'TestPollUntilReached|TestValidatePollUntil|TestClusterStates' -count=1 passed.
  • git diff --check passed.
  • The full status package run reaches an existing Windows timezone-sensitive TestPrintStatus expectation: the fixture expects UTC while the output uses the local Riyadh timezone. The focused polling and cluster-state tests pass, and the PR presubmits will validate the pushed head.

Follow-ups: #2326

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@google-oss-prow

Copy link
Copy Markdown

Hi @ahmadalguydi. Thanks for your PR.

I'm waiting for a GoogleContainerTools member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@google-cla

google-cla Bot commented Jul 28, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Comment thread cmd/nomos/status/cluster_state.go
Treat poll-until complete as full resource readiness, not only repository apply completion. Keep polling when a reported managed resource is not Current and document the behavior.\n\nAddresses maintainer review on GoogleContainerTools#2006.
@tomatotomata

Copy link
Copy Markdown
Author

Followed up on the readiness question in commit 64ff1554 (already pushed): --poll-until=complete now waits for both repository SYNCED status and every reported managed resource to reach Current. The design doc explicitly documents that this is full resource readiness and that it is independent of the --resources display flag. A regression test covers a non-current resource.

The Google CLA bot still requires the account holder to complete the CLA; that external signature step cannot be performed by the agent.

@tiffanny29631

Copy link
Copy Markdown
Contributor

/ok-to-test

@tomatotomata

Copy link
Copy Markdown
Author

The presubmit failure was a syntax error in the new table literal at poll_until_test.go:64. I fixed the nested literal structure in 8603456a and pushed it. The focused status tests pass locally; the full package run on this Windows host also exposes an existing timezone-sensitive TestPrintStatus expectation, so I have not treated that local result as a full pass.

Could you please rerun the presubmit on the new head?

/retest

@tomatotomata

tomatotomata commented Sep 11, 2026 •

Copy link
Copy Markdown
Author

I traced the latest results to two separate causes. The required presubmit still wanted Go's simplified composite-literal form in poll_until_test.go, so I applied gofmt -s and pushed 20db06ab. The e2e group 3 failure happened while the runner was building its Docker image and could not fetch the Ubuntu manpages package from archive.ubuntu.com, so that result looks environment-related rather than caused by this change. The focused status tests and git diff --check pass on the new head, and the push has already started a fresh full run. Let me know what you think.

Comment thread cmd/nomos/status/cluster_state.go Outdated
Comment thread cmd/nomos/status/cluster_state.go Outdated
Comment thread cmd/nomos/status/cluster_state.go Outdated
Comment thread cmd/nomos/status/poll_until_test.go Outdated
Comment thread cmd/nomos/status/status.go Outdated

@tiffanny29631 tiffanny29631 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please update the PR description and title to reflect latest changes

@tomatotomata tomatotomata changed the title feat(nomos): poll status until repositories complete feat(nomos): poll until sync or resource readiness Sep 16, 2026
@tomatotomata

Copy link
Copy Markdown
Author

I changed the polling target to separate successful Config Sync application from managed-resource readiness. --poll-until=synced stops once the selected repositories report SYNCED; --poll-until=current also waits for every reported resource to be Current, with complete kept as an alias. A Failed resource now returns an error instead of polling forever, while Unknown remains incomplete in current mode.

The completion check now respects --name, and a reachable cluster with no sync objects no longer holds up other contexts. I added coverage for name selection, empty clusters, Current/Unknown/Failed, and the separate synced target. I also split state collection from rendering so printStatus only formats the output.

The focused tests and git diff --check pass on 13cf2d1f. The full status-package run still hits the UTC-versus-local-time expectation in TestPrintStatus on this Windows host; the new presubmits are running on this head. I updated the title and description to reflect the expanded behavior. Let me know if you think the synced/current split fits the issue.

@tomatotomata tomatotomata changed the title feat(nomos): poll until sync or resource readiness feat(nomos): distinguish synced and current polling Sep 17, 2026
Comment thread cmd/nomos/status/cluster_state.go
Comment thread cmd/nomos/status/cluster_state.go
Comment thread cmd/nomos/status/cluster_state.go
}
if target != pollUntilSynced {
for _, resource := range repo.resources {
if resource.Status == kptv1alpha1.Failed {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

checkConflict sets Status: "Conflict" for ownership overlaps, which never becomes Current. Please treat it as terminal like Failed, and pull the string into a constant shared with checkConflict. Also, before looking at resources, please check that the ResourceGroup status is fresh (observedGeneration == generation, no Reconciling=True). Otherwise current can pass on the previous inventory.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not blocking 1.26. Until then, a Conflict resource keeps current polling until the caller's timeout. Note for the follow-up: checking observedGeneration == generation on the ResourceGroup is enough, because the RG controller now always sets Reconciling=False.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One related case to include in the follow-up here: when spec.override.statusMode: disabled is set on a RootSync or RepoSync (annotated on the ResourceGroup as configmanagement.gke.io/status: disabled), rg.Status.ResourceStatuses is omitted (len(repo.resources) == 0) and rg.Status.ObservedGeneration stays 0 even when rg.Spec.Resources is non-empty.

Right now, --poll-until=current treats len(repo.resources) == 0 as having no managed resources and exits 0 once the sync is SYNCED.
Once we add the rg.Status.ObservedGeneration == rg.Generation check in the follow-up, a ResourceGroup with statusMode: disabled will have ObservedGeneration (0) != Generation and would poll forever until timeout.

In the follow-up, we should check resourcegroup.IsStatusDisabled(rg) when --poll-until=current is used and fail fast with an error directing the user to --poll-until=synced (since resource-level status is disabled).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added it to #2326: with --poll-until=current, check resourcegroup.IsStatusDisabled(rg) first and fail fast with an error pointing to --poll-until=synced, before the ResourceGroup freshness check. For 1.26, a status-disabled ResourceGroup means current behaves like synced.

Comment thread cmd/nomos/status/cluster_state.go Outdated
Comment thread cmd/nomos/status/poll_until_test.go
Comment thread cmd/nomos/status/status.go Outdated
Comment thread cmd/nomos/status/status.go
Comment thread docs/design-docs/03-poll-until-status.md
@tiffanny29631

Copy link
Copy Markdown
Contributor

A few more things to address, we are on the right track, thanks for the patience!

@tiffanny29631

Copy link
Copy Markdown
Contributor

I'd recommend adding e2e test case(s) for this feature.

@tiffanny29631

Copy link
Copy Markdown
Contributor

Hi @tomatotomata, checking on the status of this PR. I want to encourage you to keep pushing this forward so we can include it in the Config Sync 1.26 release. Our feature complete date is 11/2, so time is a bit tight, but if we act quickly we can still make the cut!

@tiffanny29631

Copy link
Copy Markdown
Contributor

Hi @tomatotomata! Feature complete for 1.26 is coming up soon, and we'd love to get this in. Only two small things are left:

Drop the complete alias and keep just synced and current.
Only report success when at least one RootSync/RepoSync matches, so the command never exits 0 without checking anything.

The rest of my review can go into a follow-up. If I don't hear from you by Wednesday (10/28), I'll jump in and push these changes to your branch so we make the cut. Thanks!

…l-until

Address the remaining review feedback for 1.26:

- Support only `synced` and `current` for `--poll-until`. The `complete`
  alias added nothing over `current`, and flag values are hard to remove
  once released.
- Report success only when at least one selected RootSync or RepoSync is
  found, so the command never exits 0 without checking anything. Clusters
  without sync objects are still skipped.
Verify that both targets exit once the root-sync is synced, that
unsupported values are rejected, and that a --name matching nothing keeps
polling until the caller's timeout.
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cowsking for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tiffanny29631 tiffanny29631 changed the title feat(nomos): distinguish synced and current polling feat(nomos): add --poll-until to nomos status Oct 29, 2026

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add –poll-until to ‘nomos status’ command

3 participants