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

🌱Add checks in ValidCreate and ValidUpdate in hbmmt webhook #1319

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

yrs147
Copy link
Contributor

@yrs147 yrs147 commented May 22, 2024

What this PR does / why we need it:

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 #1165

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 changed the title 🌱(WIP)Add checks in ValidCreate and ValidUpdate in hbmmt webhook 🌱Add checks in ValidCreate and ValidUpdate in hbmmt webhook 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.

looks good so far. You can see in the examples I mentioned in the issue how they did it. You can maybe find an approach with a utility function that allows you to not copy paste the code in the two places

@yrs147 yrs147 requested a review from janiskemper May 22, 2024 12:00
api/v1beta1/hcloudmachine_validation.go Outdated Show resolved Hide resolved
api/v1beta1/hcloudmachinetemplate_webhook.go Outdated Show resolved Hide resolved
@yrs147 yrs147 requested a review from janiskemper May 23, 2024 07:28
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.

cool! Small thing about consistency: Can you name everything you added with "HCloud"? Capital "C"? We usually do that

@yrs147 yrs147 requested a review from janiskemper May 23, 2024 09:26
api/v1beta1/hcloudmachine_webhook.go Outdated Show resolved Hide resolved
@yrs147
Copy link
Contributor Author

yrs147 commented May 23, 2024

removed it

@yrs147 yrs147 requested a review from janiskemper May 23, 2024 10:43
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.

looks good from my side! Have you already tested the new webhooks for template objects?

You can also write unit tests similar to

var _ = Describe("HCloudMachine validation", func() {
and the respective tests in hetznerbaremetalmachine controller

@yrs147 yrs147 force-pushed the yrs/webook-provider-machine-template branch from 241c620 to 1e32559 Compare May 27, 2024 09:50
@yrs147 yrs147 requested a review from janiskemper June 4, 2024 12:48
@yrs147 yrs147 marked this pull request as ready for review June 6, 2024 15:07
@syself-bot syself-bot bot added area/code Changes made in the code directory area/api Changes made in the api directory labels Jun 6, 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.

lgtm. Looks nice. Thanks! You can squash! make sure to choose a good commit title AND message where you describe what you do

@yrs147 yrs147 force-pushed the yrs/webook-provider-machine-template branch from 25ccb55 to 180a275 Compare June 7, 2024 06:13
@syself-bot syself-bot bot added the size/XL Denotes a PR that changes 800-2000 lines, ignoring generated files. label Jun 7, 2024
@yrs147 yrs147 requested a review from janiskemper June 17, 2024 09:38
@yrs147 yrs147 requested a review from janiskemper June 24, 2024 07:58
api/v1beta1/hcloudmachine_validation_test.go Outdated Show resolved Hide resolved
api/v1beta1/hcloudmachine_validation_test.go Outdated Show resolved Hide resolved
api/v1beta1/hetznerbaremetalmachine_validation_test.go Outdated Show resolved Hide resolved
api/v1beta1/hcloudmachinetemplate_webhook.go Outdated Show resolved Hide resolved
controllers/hetznerbaremetalmachine_controller_test.go Outdated Show resolved Hide resolved
controllers/hetznerbaremetalmachine_controller_test.go Outdated Show resolved Hide resolved
@syself-bot syself-bot bot added the area/test Changes made in the test directory label Jul 3, 2024
@yrs147 yrs147 force-pushed the yrs/webook-provider-machine-template branch from 5d50650 to 97690fa Compare July 8, 2024 11:12
@yrs147 yrs147 requested a review from janiskemper July 10, 2024 12:09
@yrs147 yrs147 force-pushed the yrs/webook-provider-machine-template branch from ba2443b to bb83b4a Compare July 15, 2024 11:23
@Dhairya-Arora01
Copy link
Contributor

@janiskemper lgtm

@janiskemper
Copy link
Contributor

@yrs147 then plz squash :)

@yrs147 yrs147 force-pushed the yrs/webook-provider-machine-template branch from bb83b4a to a8b58e1 Compare July 16, 2024 08:25
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.

put a lot of empty lines after the code blocks, so that we can distinguish what belongs together and what does not

controllers/hcloudmachine_controller_test.go Outdated Show resolved Hide resolved
controllers/hcloudmachine_controller_test.go Outdated Show resolved Hide resolved
@yrs147 yrs147 requested a review from janiskemper July 17, 2024 06:48
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.

small thing. You can squash again afterwards immediately. Thanks!

controllers/controllers_suite_test.go Outdated Show resolved Hide resolved
Added validation checks for hbmm , hbmmt , hcloudmachine and hcloud
machinetemplate webhooks . Also added the unit tests for the same
@yrs147 yrs147 force-pushed the yrs/webook-provider-machine-template branch from 87d996d to a674271 Compare July 17, 2024 09:40
@yrs147 yrs147 requested a review from janiskemper July 17, 2024 10:18
@yrs147 yrs147 merged commit 99ac110 into main Jul 17, 2024
9 checks passed
@yrs147 yrs147 deleted the yrs/webook-provider-machine-template branch July 17, 2024 10:44
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 area/test Changes made in the test directory size/XL Denotes a PR that changes 800-2000 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add webhooks for ProviderMachineTemplate objects
3 participants