Skip to content

Conversation

@sdowell
Copy link
Contributor

@sdowell sdowell commented Sep 23, 2025

This change reimplements the ignore-mutation feature using the native
support in the cli-utils applier. This removes the need for the
workaround of caching the object in Config Sync and passing in the
cached object to the applier.

This fixes several race conditions and side effects associated with the
caching solution.

Depends on new functionality in cli-utils: kubernetes-sigs/cli-utils@5895ad6

Fixes: #1668

@google-oss-prow
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@sdowell
Copy link
Contributor Author

sdowell commented Sep 23, 2025

/test all

@sdowell sdowell force-pushed the native-ignore-mutation-in-applier branch from 401f124 to d0620d0 Compare September 23, 2025 20:05
@sdowell
Copy link
Contributor Author

sdowell commented Sep 23, 2025

/test all

@sdowell sdowell force-pushed the native-ignore-mutation-in-applier branch from d0620d0 to e4f013c Compare September 23, 2025 20:12
@sdowell
Copy link
Contributor Author

sdowell commented Sep 23, 2025

/test all

@sdowell sdowell force-pushed the native-ignore-mutation-in-applier branch from e4f013c to 2315e88 Compare September 23, 2025 23:17
@sdowell
Copy link
Contributor Author

sdowell commented Sep 23, 2025

/test all

@sdowell sdowell force-pushed the native-ignore-mutation-in-applier branch 2 times, most recently from 2496c7c to 00faa72 Compare October 14, 2025 18:26
@sdowell
Copy link
Contributor Author

sdowell commented Oct 14, 2025

/test all

@sdowell sdowell force-pushed the native-ignore-mutation-in-applier branch from 00faa72 to 6751ae4 Compare October 21, 2025 16:02
@sdowell sdowell marked this pull request as ready for review October 21, 2025 16:03
@sdowell sdowell force-pushed the native-ignore-mutation-in-applier branch from 6751ae4 to 5658e2f Compare October 21, 2025 16:09
@sdowell sdowell force-pushed the native-ignore-mutation-in-applier branch from 5658e2f to 462ccba Compare October 21, 2025 16:18
@sdowell sdowell changed the title WIP: native ignore-mutation support in applier feat: native ignore-mutation support in applier Oct 21, 2025
@mikebz mikebz requested a review from Copilot October 22, 2025 14:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reimplements the ignore-mutation feature to use native support in the cli-utils applier, eliminating the workaround of caching objects in Config Sync and passing cached objects to the applier. This change resolves several race conditions and side effects associated with the previous caching solution.

  • Adds native IgnoreMutation field to CachedStatus for tracking mutation-ignored objects
  • Removes the mutationIgnoredObjectsMap cache and related caching logic from the Resources struct
  • Updates status computation to handle ignore-mutation objects using applier's native skip events

Reviewed Changes

Copilot reviewed 16 out of 45 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/resourcegroup/controllers/status/status.go Adds isIgnoreMutationObject function to detect and track mutation-ignored objects in status
pkg/resourcegroup/controllers/resourcemap/resourcemap.go Adds IgnoreMutation boolean field to CachedStatus struct
pkg/resourcegroup/controllers/resourcegroup/resourcegroup_controller_test.go Adds comprehensive test cases for ignore-mutation status handling with different kstatus values
pkg/resourcegroup/controllers/resourcegroup/resourcegroup_controller.go Updates status computation to handle ignore-mutation objects and compute reconcile status appropriately
pkg/remediator/watch/filteredwatcher_test.go Removes test code for obsolete ignore-mutation cache
pkg/remediator/watch/filteredwatcher.go Removes code that updated ignored objects in the Resources cache
pkg/metadata/metadata_test.go Adds test validation for the return value of UpdateConfigSyncMetadata
pkg/metadata/metadata.go Changes UpdateConfigSyncMetadata to return boolean indicating if updates were made
pkg/declared/resources_test.go Removes all tests for obsolete ignore-mutation cache methods
pkg/declared/resources.go Removes mutationIgnoredObjectsMap and all related cache management methods
pkg/applier/utils_test.go Removes tests for obsolete handleIgnoredObjects function
pkg/applier/utils.go Removes handleIgnoredObjects function that merged cached state with declared objects
pkg/applier/applier_test.go Removes tests for mutation-ignored object caching behavior and updates remaining tests
pkg/applier/applier.go Removes caching logic, adds metadata update handling for skip events, removes ignore cache cleanup from event processors
go.mod Updates cli-utils and gomega dependencies to newer versions
e2e/testcases/ignore_mutation_test.go Adds explicit ResourceGroup status verification for ignore-mutation objects

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mikebz
Copy link
Contributor

mikebz commented Oct 22, 2025

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request focuses on enhancing the Config Sync's applier to natively support the ignore-mutation feature, eliminating the previous workaround that involved caching objects. The changes include updating dependencies, modifying the applier's logic to handle skipped actuations due to the ignore-mutation annotation, and adjusting tests to reflect the new implementation. The most significant changes are in pkg/applier/applier.go and e2e/testcases/ignore_mutation_test.go, where the core logic for applying resources and testing the ignore-mutation feature has been updated.

This change reimplements the ignore-mutation feature using the native
support in the cli-utils applier. This removes the need for the
workaround of caching the object in Config Sync and passing in the
cached object to the applier.

This fixes several race conditions and side effects associated with the
caching solution.
@sdowell sdowell force-pushed the native-ignore-mutation-in-applier branch from 462ccba to 4961cc5 Compare October 22, 2025 19:29
@Camila-B
Copy link
Contributor

/lgtm

@tiffanny29631
Copy link
Contributor

Nit: suggest linking the change from cli-utils in commit message. Otherwise lgtm.

@sdowell
Copy link
Contributor Author

sdowell commented Oct 22, 2025

Nit: suggest linking the change from cli-utils in commit message. Otherwise lgtm.

Added a link in the PR description

Copy link
Contributor

@tiffanny29631 tiffanny29631 left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tiffanny29631

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

The pull request process is described 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

@google-oss-prow google-oss-prow bot merged commit 1b13cb4 into GoogleContainerTools:main Oct 22, 2025
6 checks passed
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.

client.lifecycle.config.k8s.io/mutation: ignore seems broken with 1.21

4 participants