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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡Add condition indicating deletion timestamp is set #1284

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

Conversation

yrs147
Copy link
Contributor

@yrs147 yrs147 commented Apr 30, 2024

What this PR does / why we need it:
Add condition indicating deletion timestamp is set
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1229
Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squash commits
  • include documentation
  • add unit tests

@yrs147 yrs147 requested a review from janiskemper April 30, 2024 07:23
@yrs147 yrs147 requested a review from janiskemper May 14, 2024 06:29
controllers/hetznerbaremetalhost_controller.go Outdated Show resolved Hide resolved
controllers/hetznerbaremetalhost_controller.go Outdated Show resolved Hide resolved
Copy link
Contributor

@janiskemper janiskemper left a comment

Choose a reason for hiding this comment

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

now you have a problem with "needsUpdate". You currently don't check that for the condition. I would just say remove the "needsUpdate code and just always update it. If you want to make it 100% efficient in terms of API calls, you need to check whether the condition is set before.

You can do that with some utility function of the conditions package (something like HasReason)

@yrs147 yrs147 requested a review from janiskemper May 17, 2024 11:56
Copy link
Contributor

@janiskemper janiskemper left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you! Please squash your commits now

@yrs147 yrs147 marked this pull request as ready for review May 20, 2024 08:12
@syself-bot syself-bot bot added area/code Changes made in the code directory area/api Changes made in the api directory labels May 20, 2024
@yrs147 yrs147 requested a review from janiskemper May 20, 2024 11:34
Copy link
Contributor

@janiskemper janiskemper left a comment

Choose a reason for hiding this comment

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

sorry I just realized something.. You don't want to check this only for hosts that are in state none - but for all that are getting deleted! You actually have to move this outside of this. Maybe even outside of the reconcileSelectedStates one. Because it is not related to a certain provisioning state

@syself-bot syself-bot bot added the size/S Denotes a PR that changes 20-50 lines, ignoring generated files. label May 20, 2024
pkg/services/baremetal/host/host.go Outdated Show resolved Hide resolved
pkg/services/baremetal/host/host.go Outdated Show resolved Hide resolved
pkg/services/baremetal/host/host.go Outdated Show resolved Hide resolved
Copy link
Contributor

@janiskemper janiskemper left a comment

Choose a reason for hiding this comment

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

can you revert all changes to hetznerbaremetalhost_controller? I think those changes are not relevant anymore

@syself-bot syself-bot bot added the size/XS Denotes a PR that changes 0-20 lines, ignoring generated files. label May 22, 2024
@yrs147 yrs147 requested a review from janiskemper May 22, 2024 07:37
@syself-bot syself-bot bot removed the size/S Denotes a PR that changes 20-50 lines, ignoring generated files. label May 22, 2024
Copy link
Contributor

@janiskemper janiskemper left a comment

Choose a reason for hiding this comment

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

thanks! This looks good now. You can squash all commits and do one small change:
use the severity "warning" instead of "info". I'm a bit afraid that it wouldn't be shown to users otherwise

馃尡Fix lint errors

馃尡Fix gofmt lint error

馃悰Fix condition

馃尡Remove Deletion condition

馃悰Fix condition errors

馃尡Remove condition and split if statements

馃悰Fix lint error and remove needsUpdate

馃尡Remove if statement

馃尡Move set condition outside the switch

Add being deleted condition in host

馃尡Remove deleting condition from reconcileSelectedStates method

馃尡Minor change

馃尡Revert changes made to hbmh controller

馃尡Change severity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Changes made in the api directory area/code Changes made in the code directory size/XS Denotes a PR that changes 0-20 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Condition indicating that HetznerBareMetalHost is deleting
3 participants