Skip to content

fix: use strconv.ParseBool for force-deletion label #999

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Kumm-Kai
Copy link

What this PR does / why we need it:
Uses strconv.ParseBool instead of "True" to check the force-deletion Machine label.

@Kumm-Kai Kumm-Kai requested a review from a team as a code owner May 29, 2025 16:02
@gardener-robot
Copy link

@Kumm-Kai Thank you for your contribution.

@gardener-robot gardener-robot added needs/review Needs review size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py) labels May 29, 2025
@gardener-robot-ci-1
Copy link
Contributor

Thank you @Kumm-Kai for your contribution. Before I can start building your PR, a member of the organization must set the required label(s) {'reviewed/ok-to-test'}. Once started, you can check the build status in the PR checks section below.

Copy link
Contributor

@aaronfern aaronfern left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @Kumm-Kai!
I have one comment, please address it
Thanks

)

forceDeleteLabelPresent, _ = strconv.ParseBool(machine.Labels["force-deletion"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to check for an error and log a warning? sort of like a heads up about a misconfigured label

Copy link
Author

Choose a reason for hiding this comment

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

I don't really think that would be beneficial. It's also not done in other parts of gardener where a label or annotation is used to trigger something.

Copy link
Contributor

@unmarshall unmarshall Jun 4, 2025

Choose a reason for hiding this comment

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

Yes i would tend to agree that error in parsing an invalid bool value should not cause a re-queue, thus the error should be ignored. However you should at least log that the label has an invalid value and thus no action has been taken. If the intent was to force delete a machine then that would not be achieved with the current value. This will be good for diagnostic as well especially when the developers get involved late and the machines are no longer available. So RCAs become a bit easier as we will have a log to refer to.

Copy link
Author

Choose a reason for hiding this comment

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

good points 🙂
I've pushed a new commit.

@aaronfern aaronfern added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label May 30, 2025
@gardener-robot-ci-1 gardener-robot-ci-1 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/review Needs review size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants