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

⚠️ Bastion cleanup #1959

Merged
merged 2 commits into from
Mar 20, 2024
Merged

Conversation

dulek
Copy link
Contributor

@dulek dulek commented Mar 19, 2024

What this PR does / why we need it:
This commit works with .spec.bastion:

  • makes availablityZone, floatingIP and instance pointers
  • adds floatingIP IPv4 validation
  • adds validation that if Bastion is enabled, instance cannot be null
  • rename instance->spec

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 #

Special notes for your reviewer:

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

TODOs:

  • if necessary:
    • includes documentation
    • adds unit tests

/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 19, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 19, 2024
Copy link

netlify bot commented Mar 19, 2024

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit c321574
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/65fb0d1192c64000088aca95
😎 Deploy Preview https://deploy-preview-1959--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@huxcrux
Copy link
Contributor

huxcrux commented Mar 20, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2024
type Bastion struct {
// Enabled means that bastion is enabled. Defaults to false.
//+optional
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this required with an explicit default of false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this, I wasn't sure how to approach this.

controllers/openstackcluster_controller.go Outdated Show resolved Hide resolved
controllers/openstackcluster_controller_test.go Outdated Show resolved Hide resolved
controllers/openstackcluster_controller_test.go Outdated Show resolved Hide resolved
Comment on lines 483 to 486
Bastion: &infrav1.Bastion{
Enabled: true,
Spec: &instance,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this test is equivalent. The previous test had: Bastion: &infrav1.Bastion{}, which implied Enabled: false, and we apparently still expect a bastion to be cleaned up in this case. Is that what we were actually testing before? Does it still work that way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I needed to actually fix this with a hack on bastionToInstanceSpec(), where nil .spec will be translated to &OpenStackMachineSpec{}.

controllers/openstackmachine_controller.go Outdated Show resolved Hide resolved
pkg/cloud/services/compute/instance_types.go Outdated Show resolved Hide resolved
api/v1alpha6/types_conversion.go Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice tests!

This commit works with .spec.bastion:
* makes availablityZone, floatingIP and instance pointers
* adds floatingIP IPv4 validation
* adds validation that if Bastion is enabled, instance cannot be null
Bastion.Spec is way more descriptive and it suggests it's an
OpenStackMachineSpec.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2024
@mdbooth
Copy link
Contributor

mdbooth commented Mar 20, 2024

/approve
/hold cancel

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dulek, mdbooth

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 Mar 20, 2024
@mdbooth
Copy link
Contributor

mdbooth commented Mar 20, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2024
@k8s-ci-robot k8s-ci-robot merged commit c6efdea into kubernetes-sigs:main Mar 20, 2024
9 checks passed
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants