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: dedupe expiration reconciliations #1794

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

jmdeal
Copy link
Member

@jmdeal jmdeal commented Oct 31, 2024

Fixes #N/A

Description
Currently, the expiration controller reconciles against all NodeClaim updates, and doesn't have a check to ensure that the NodeClaim hasn't already been terminated. This can result in duplicate expiration attempts against the same NodeClaim. The main problem with this (other than unnecessary deletes) is that we increment the expiration metric each time.

This change ensures we don't double count expirations through two mechanisms:
a. Check that the NodeClaim's deletion timestamp is zero before proceeding with expiration.
b. Only enqueue requests for NodeClaims when they are first added to the informer cache.

How was this change tested?
make test

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 31, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 31, 2024
@jmdeal jmdeal force-pushed the fix/duplicate-expirations branch from 2181b20 to 65bd97d Compare October 31, 2024 16:46
@jmdeal jmdeal force-pushed the fix/duplicate-expirations branch from 65bd97d to 01726b8 Compare October 31, 2024 17:00
@jmdeal jmdeal force-pushed the fix/duplicate-expirations branch from 01726b8 to 5985623 Compare October 31, 2024 17:27
@coveralls
Copy link

coveralls commented Oct 31, 2024

Pull Request Test Coverage Report for Build 11619365060

Details

  • 7 of 9 (77.78%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 80.944%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controllers/nodeclaim/expiration/controller.go 7 9 77.78%
Totals Coverage Status
Change from base Build 11603073442: 0.08%
Covered Lines: 8508
Relevant Lines: 10511

💛 - Coveralls

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 Oct 31, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jmdeal, 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:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 31, 2024
@k8s-ci-robot k8s-ci-robot merged commit e438062 into kubernetes-sigs:main Oct 31, 2024
11 of 12 checks passed
engedaam pushed a commit to engedaam/karpenter-core that referenced this pull request Nov 10, 2024
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants