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: Ensure all patch calls can conflict when resource version doesn't match #1658

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

jonathan-innis
Copy link
Member

@jonathan-innis jonathan-innis commented Sep 12, 2024

Fixes #1578

Description

This change ensures that calls to Patch that would fully replace portions of the spec like lists continue to conflict if the resource has changed since the controller first retrieved the resource.

This fixes the issue in #1578 where resource quantities are converted to different strings during deserialization and then re-serialization back by ensuring that the request that we send to the apiserver only represents the parts of the resource that we intend to change.

This allows us to keep the NodeClaim immutability checks that we have.

How was this change tested?

make presubmit

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 12, 2024
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 12, 2024
@jonathan-innis jonathan-innis force-pushed the patch-with-conflict branch 12 times, most recently from a630780 to 3c02c33 Compare September 12, 2024 08:49
@coveralls
Copy link

coveralls commented Sep 12, 2024

Pull Request Test Coverage Report for Build 10908544791

Details

  • 58 of 78 (74.36%) changed or added relevant lines in 17 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.05%) to 80.798%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controllers/nodeclaim/termination/controller.go 4 5 80.0%
pkg/controllers/nodeclaim/lifecycle/controller.go 4 7 57.14%
pkg/controllers/node/termination/controller.go 8 13 61.54%
pkg/controllers/disruption/controller.go 1 12 8.33%
Files with Coverage Reduction New Missed Lines %
pkg/controllers/nodeclaim/termination/controller.go 1 69.03%
pkg/controllers/node/termination/controller.go 1 67.57%
Totals Coverage Status
Change from base Build 10907749057: 0.05%
Covered Lines: 8424
Relevant Lines: 10426

💛 - Coveralls

@jonathan-innis jonathan-innis marked this pull request as ready for review September 16, 2024 19:52
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2024
pkg/utils/pretty/pretty.go Show resolved Hide resolved
pkg/scheduling/taints.go Outdated Show resolved Hide resolved
Copy link
Contributor

@njtran njtran left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 17, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jonathan-innis, njtran

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:
  • OWNERS [jonathan-innis,njtran]

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure to delete NodeClaim (Reconciler error)
4 participants