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: dynamic clusters sometimes encounter a finalizer mismatch #2145

Merged
merged 14 commits into from
May 13, 2024

Conversation

jlowe64
Copy link
Contributor

@jlowe64 jlowe64 commented Mar 4, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR attempts to fix an issue with dynamically scaling clusters, such as ones using Karpenter, where the number of nodes can remain the same while the contents of the profile's finalizers may differ. This will result in not being able to manage the profile without interacting with the finalizers directly.

Which issue(s) this PR fixes:

None

Does this PR have test?

N/A

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

fix: dynamic clusters encounter finalizer mismatch when nodes are added and removed too quickly

@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. kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 4, 2024
Copy link

linux-foundation-easycla bot commented Mar 4, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

Welcome @jlowe64!

It looks like this is your first PR to kubernetes-sigs/security-profiles-operator 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/security-profiles-operator has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 4, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @jlowe64. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 4, 2024
@saschagrunert
Copy link
Member

Thank you for the PR @jlowe64! Do you mind signing the CLA?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 5, 2024
@jlowe64
Copy link
Contributor Author

jlowe64 commented Mar 5, 2024

Thank you for the PR @jlowe64! Do you mind signing the CLA?

I did this earlier, I was just waiting on someone from my team to tell me how our company handles open source contributions! Thank you.

Also, could you please hold off on approving the automated tests (I believe you have to approve them), I need to push to my fork cause I'm doing testing on a linux workstation and need to commit in order to run tests. I'll poke you on here when I want the tests to be run. I don't want to waste your resources when I am fixing issues from the tests!

@saschagrunert
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 6, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 54 lines in your changes are missing coverage. Please review.

Project coverage is 40.99%. Comparing base (11d77f4) to head (9ee8539).
Report is 182 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2145      +/-   ##
==========================================
- Coverage   45.50%   40.99%   -4.51%     
==========================================
  Files          79      108      +29     
  Lines        7782    15583    +7801     
==========================================
+ Hits         3541     6389    +2848     
- Misses       4099     8724    +4625     
- Partials      142      470     +328     

@jlowe64 jlowe64 changed the title [WIP] fix: dynamic clusters sometimes encounter a finalizer mismatch fix: dynamic clusters sometimes encounter a finalizer mismatch Mar 7, 2024
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 7, 2024
@jlowe64
Copy link
Contributor Author

jlowe64 commented Mar 10, 2024

I'm not ready to merge this, I need to look at it some more.

@jlowe64 jlowe64 changed the title fix: dynamic clusters sometimes encounter a finalizer mismatch [WIP] fix: dynamic clusters sometimes encounter a finalizer mismatch Mar 10, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 10, 2024
internal/pkg/util/nodeutils.go Outdated Show resolved Hide resolved
return true, nil
}

func StringInSlice(list []string, str string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is an util.Contains function already for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ccojocar I am doing something slightly different in that I'm not looking for an equality of strings, but rather if a substring is contained within a string. I looked at your function and I've matched the naming convention of what you have for util.Contains, by calling it util.ContainsSubstring.

internal/pkg/util/nodeutils.go Show resolved Hide resolved
@@ -0,0 +1,106 @@
/*
Copyright 2020 The Kubernetes Authors.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Copyright 2020 The Kubernetes Authors.
Copyright 2024 The Kubernetes Authors.

@k8s-ci-robot
Copy link
Contributor

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

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-sigs/prow repository.

Copy link
Contributor

@ccojocar ccojocar left a comment

Choose a reason for hiding this comment

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

Thanks, it looks good!

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 11, 2024
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Is this still WIP @jlowe64 ?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ccojocar, jlowe64, saschagrunert

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 [ccojocar,saschagrunert]

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

@jlowe64 jlowe64 changed the title [WIP] fix: dynamic clusters sometimes encounter a finalizer mismatch fix: dynamic clusters sometimes encounter a finalizer mismatch May 13, 2024
@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 May 13, 2024
@jlowe64
Copy link
Contributor Author

jlowe64 commented May 13, 2024

Is this still WIP @jlowe64 ?

I have just removed the WIP tag.

@saschagrunert saschagrunert merged commit d1352be into kubernetes-sigs:main May 13, 2024
25 of 27 checks passed
@saschagrunert saschagrunert mentioned this pull request Jun 4, 2024
2 tasks
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jun 4, 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. do-not-merge/contains-merge-commits kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

5 participants