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(taint deletion): allow taint changes and prevent panic by handling nil values #5022

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nueavv
Copy link

@nueavv nueavv commented Jun 13, 2024

This commit addresses a panic error that occurs when attempting to delete a taint in AWSManagedMachinePool. The issue was caused by a nil pointer dereference when the taint's value was nil. By handling nil values for taint fields, this fix ensures that taints with nil values are correctly processed, preventing runtime errors.

Fixes #5021

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR resolves a panic error that occurs when attempting to delete a taint in AWSManagedMachinePool. The error was due to a nil pointer dereference when the taint's value was nil. By handling nil values for taint fields, this fix ensures that taints with nil values are correctly processed, preventing runtime errors.

Which issue(s) this PR fixes:
Fixes #5021

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation
  • includes emojis
  • adds unit tests
  • adds or updates e2e tests

Release note:

Fixed a panic error during taint deletion in AWSManagedMachinePool by handling nil values for taint fields.

@k8s-ci-robot k8s-ci-robot added 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Jun 13, 2024
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 13, 2024
@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 13, 2024
@nueavv nueavv changed the title 🐛 fix(taint deletion): handle nil values to prevent panic 🐛 fix(taint deletion): allow taint changes and prevent panic by handling nil values Jun 14, 2024
@richardcase
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 Jul 1, 2024
@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 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 Jul 17, 2024
@richardcase
Copy link
Member

Thanks for the this @nueavv . When you have time could you respond to @fiunchinho suggestion? Then i think we can look to get this merged.

@nueavv
Copy link
Author

nueavv commented Jul 18, 2024

Okay. @richardcase

@richardcase
Copy link
Member

@nueavv - there's a couple of failures with the checks. If you run the following locally (which is what he checks are running):

  • make lint
  • make test

Ping me on slack if i can help with anything.

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 18, 2024
@nueavv
Copy link
Author

nueavv commented Jul 18, 2024

@richardcase I have fixed the issue. Can you please check if the commit message is appropriate?

@richardcase
Copy link
Member

/test ?

@k8s-ci-robot
Copy link
Contributor

@richardcase: The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-aws-build
  • /test pull-cluster-api-provider-aws-build-docker
  • /test pull-cluster-api-provider-aws-test
  • /test pull-cluster-api-provider-aws-verify

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-aws-apidiff-main
  • /test pull-cluster-api-provider-aws-e2e
  • /test pull-cluster-api-provider-aws-e2e-blocking
  • /test pull-cluster-api-provider-aws-e2e-clusterclass
  • /test pull-cluster-api-provider-aws-e2e-conformance
  • /test pull-cluster-api-provider-aws-e2e-conformance-with-ci-artifacts
  • /test pull-cluster-api-provider-aws-e2e-eks
  • /test pull-cluster-api-provider-aws-e2e-eks-gc
  • /test pull-cluster-api-provider-aws-e2e-eks-testing

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-aws-apidiff-main
  • pull-cluster-api-provider-aws-build
  • pull-cluster-api-provider-aws-build-docker
  • pull-cluster-api-provider-aws-test
  • pull-cluster-api-provider-aws-verify

In response to this:

/test ?

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.

@richardcase
Copy link
Member

/test pull-cluster-api-provider-aws-e2e-eks

Copy link
Contributor

@AndiDog AndiDog left a comment

Choose a reason for hiding this comment

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

Regarding the issue and according release note: I don't quite get whether the issue is about deletion (the taint shouldn't even exist in the slice?!) or an empty value string – let's please clarify. The GitHub issue says it's about an empty string, and it looks like this is not a deletion issue?!

@nueavv
Copy link
Author

nueavv commented Jul 29, 2024

Hi @AndiDog,

I was trying to delete the taint, but it failed because of the empty string. What made you confused? The issue is about taint deletion.

@nueavv
Copy link
Author

nueavv commented Jul 29, 2024

You can reproduce it by first creating a taint without a value and then trying to delete it.

@nueavv
Copy link
Author

nueavv commented Aug 10, 2024

@dlipovetsky Hi! can you review this?

@AndiDog
Copy link
Contributor

AndiDog commented Aug 29, 2024

The change now looks straightforward. Can you please make this a single commit? I'll take a look very soon – it's on my list 😉.

@AndiDog
Copy link
Contributor

AndiDog commented Aug 29, 2024

/test pull-cluster-api-provider-aws-e2e-eks

@AndiDog
Copy link
Contributor

AndiDog commented Aug 29, 2024

/approve
/hold

@fiunchinho @dlipovetsky @richardcase does someone have time to review and LGTM? Please /unhold once all is okay.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 29, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AndiDog

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 Aug 29, 2024
@nueavv
Copy link
Author

nueavv commented Sep 16, 2024

Hi, @dlipovetsky Could you please review this PR when you have time?

@dlipovetsky
Copy link
Contributor

Thanks for this. The change looks good.

I noticed this file has no unit tests. In my experience, unit tests are especially helpful for functions that transform data. Would you please consider writing a unit test; it should fail without your fix, and pass with it.

@dlipovetsky
Copy link
Contributor

dlipovetsky commented Sep 16, 2024

On second thought, this PR has been open for a while, and I don't want to add a new requirement this late. But a unit test would help future maintenance. If it can be done before the /hold is removed, great; otherwise, a follow-up PR would be fine.

/lgtm

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

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 29, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 30, 2024
@k8s-ci-robot k8s-ci-robot added do-not-merge/contains-merge-commits and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 30, 2024
@nueavv
Copy link
Author

nueavv commented Sep 30, 2024

/retest

@nueavv
Copy link
Author

nueavv commented Sep 30, 2024

/retest-required

@nueavv
Copy link
Author

nueavv commented Sep 30, 2024

@dlipovetsky I've added test codes. Can you review them again?

Signed-off-by: nueavv <nuguni@kakao.com>
@nueavv
Copy link
Author

nueavv commented Oct 11, 2024

@dlipovetsky Hi.. Can you take a look at it?

@nueavv nueavv closed this Oct 11, 2024
@nueavv nueavv reopened this Oct 11, 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/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/bug Categorizes issue or PR as related to a bug. needs-priority 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.

Panic Error: Invalid Memory Address or Nil Pointer Dereference during Taint Deletion in AWSManagedMachinePool
6 participants