Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ResourceGroup conflicts #1575

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

karlkfi
Copy link
Contributor

@karlkfi karlkfi commented Feb 26, 2025

The ResourceGroup controller reconciles after each ResourceGroup
update to spec or status. This was causing the ResourceGroup
controller to try to make status updates after the applier made its
initial spec update, without waiting for the applier to do the
status update immediately afterwards. This caused a conflict between
the concurrent status updates.

To avoid this, the applier inventory client now correctly updates the
status.observedGeneration and the ResourceGroup controller now waits
for the status.observedGeneration to match the metadata.generation.

Depends on #1566

kpt is primarily used for its ResourceGroup inventory client
(InventoryResourceGroup), which is used by cli-utils' Applier.

This change copies the existing kpt code into the
internal/third_party directory of this repo, allowing us to make
local Config Sync specific changes, without needing to depend on
kpt as an upstream dependency.

This is a temporary solution to allow modifications until the
inventory client is rewritten from scratch with a new cleaner
interface.

Using internal/third_party allows preserving the upstream copyright
and license headers, at least until the rewrite. To facilitate this,
the internal/third_party directory is now ignored by make lint-license,
and a rewrite was added to go.mod.
Copy link

[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 ask for approval from karlkfi. For more information see the Kubernetes Code Review Process.

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

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

The ResourceGroup controller reconciles after each ResourceGroup
update to spec or status. This was causing the ResourceGroup
controller to try to make status updates after the applier made its
initial spec update, without waiting for the applier to do the
status update immediately afterwards. This caused a conflict between
the concurrent status updates.

To avoid this, the applier inventory client now correctly updates the
status.observedGeneration and the ResourceGroup controller now waits
for the status.observedGeneration to match the metadata.generation.
@karlkfi karlkfi force-pushed the karl-rgc-wait-for-status-update branch from 4c2e503 to 75b1302 Compare February 26, 2025 18:46
@karlkfi
Copy link
Contributor Author

karlkfi commented Feb 27, 2025

Looks like this will require e2e test changes to simulate the applier setting the observedGeneration in the tests that create the ResourceGroup manually.

Update the ResourceGroup controller tests to set the
status.observedGeneration after updating the spec. This simulates
the applier inventory client and unblocks the ResourceGroup controller,
which now waits for that signal to avoid update conflicts.

Since the ResourceGroup controller is already disabled for kpt-managed
ResorceGroups, this will not affect that scenario.
}

func TestResourceGroupControllerInKptGroup(t *testing.T) {
nt := nomostest.New(t, nomostesting.ACMController)

// increase logging
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: remove logging change after tests pass

Copy link

@karlkfi: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
kpt-config-sync-presubmit-e2e-multi-repo-test-group2 de71b0e link true /test kpt-config-sync-presubmit-e2e-multi-repo-test-group2
kpt-config-sync-presubmit-e2e-multi-repo-test-group1 de71b0e link true /test kpt-config-sync-presubmit-e2e-multi-repo-test-group1

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant