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 bug when removing finalizer #22

Merged
merged 3 commits into from
Dec 5, 2023
Merged

Fix bug when removing finalizer #22

merged 3 commits into from
Dec 5, 2023

Conversation

HonakerM
Copy link
Collaborator

@HonakerM HonakerM commented Dec 5, 2023

Related Issue

Supports #?

Related PRs

This PR is not dependent on any other PR

What this PR does / why we need it

This PR updates the remove_finalizer utility to only apply the necessary parameters instead of applying the whole resource.

Special notes for your reviewer

If applicable**

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

What gif most accurately describes how I feel towards this PR?

Example of a gif

@HonakerM HonakerM requested a review from gabe-l-hart as a code owner December 5, 2023 14:42
Signed-off-by: Michael Honaker <[email protected]>
@HonakerM HonakerM force-pushed the fix_status_finalizer branch from 99ef2e5 to 0ae6282 Compare December 5, 2023 14:42
@HonakerM HonakerM force-pushed the fix_status_finalizer branch from 4d5b0ec to 9cf38f8 Compare December 5, 2023 16:30
Copy link
Collaborator

@gabe-l-hart gabe-l-hart left a comment

Choose a reason for hiding this comment

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

These look like good fixes. They should take care of the resource validation issues when adjusting the finalizers

if not self._cluster_content[namespace][kind][api_version][name][
"metadata"
].get("finalizers"):
callback(self._cluster_content[namespace][kind][api_version][name])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to be behind the DRY_RUN_CLUSTER_LOCK (or alternately, have the value pulled above and then used here)?

@@ -243,7 +247,14 @@ def remove_finalizer(session: SESSION_TYPE, finalizer: str):

log.debug("Removing finalizer: %s", finalizer)

manifest = copy.deepcopy(session.cr_manifest)
# Create manifest with only required fields
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, perfect. This will be much simpler

@@ -105,8 +105,10 @@ def run_reconcile(self, is_finalizer: bool, resource: dict):
if (
self._resource.get("kind") == resource.get("kind")
and self._resource.get("apiVersion") == resource.get("apiVersion")
and resource_metadata.get("name") == resource_metadata.get("name")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yikes! Those were certainly buggy

@gabe-l-hart gabe-l-hart merged commit dc4d622 into main Dec 5, 2023
@gabe-l-hart gabe-l-hart deleted the fix_status_finalizer branch December 5, 2023 17:05
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.

2 participants