Skip to content

Conversation

EmilienM
Copy link
Contributor

@EmilienM EmilienM commented Dec 15, 2023

What this PR does / why we need it:

This PR converts OpenStackCluster.Spec.ExternalNetworkID to OpenStackCluster.Spec.ExternalNetwork.

The field externalNetworkID has been renamed to externalNetwork and isn't a string anymore but a reference to a NetworkFilter object.

externalNetworkID: "e60f19e7-cb37-49f9-a2ee-0a1281f6e03e"

becomes

externalNetwork:
  id: "e60f19e7-cb37-49f9-a2ee-0a1281f6e03e"

It is now possible to specify a NetworkFilter object to select the external network to use for the cluster. The NetworkFilter object allows to select the network by name, by ID or by tags.

externalNetwork:
  name: "public"

If a network is provided, it'll be added to OpenStackCluster.Status.ExternalNetwork. If the network can't be found, an error will be returned.
If no network is provided, CAPO will try to find network marked "External" and add it to OpenStackCluster.Status.ExternalNetwork. If it can't find a network marked "External",
OpenStackCluster.Status.ExternalNetwork will be set to nil.
If more than one network is found, an error will be returned.

It is now possible for a user to specify that no external network should be used by setting DisableExternalNetwork to true:

disableExternalNetwork: true
  • squashed commits
  • API conversion
  • includes documentation
  • adds unit tests

@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 Dec 15, 2023
Copy link

netlify bot commented Dec 15, 2023

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

Name Link
🔨 Latest commit 87cb356
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/659d94639afe8c0008a99fc6
😎 Deploy Preview https://deploy-preview-1790--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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 15, 2023
@EmilienM
Copy link
Contributor Author

/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 Dec 15, 2023
@EmilienM
Copy link
Contributor Author

/cc dulek stephenfin

@EmilienM
Copy link
Contributor Author

/cc MaysaMacedo

@k8s-ci-robot
Copy link
Contributor

@EmilienM: GitHub didn't allow me to request PR reviews from the following users: MaysaMacedo.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc MaysaMacedo

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/test-infra repository.

@EmilienM
Copy link
Contributor Author

/test pull-cluster-api-provider-openstack-e2e-full-test

@EmilienM EmilienM force-pushed the external-network branch 2 times, most recently from 3ee79a5 to 50a169a Compare December 15, 2023 20:03
@EmilienM
Copy link
Contributor Author

/test pull-cluster-api-provider-openstack-e2e-full-test

@EmilienM
Copy link
Contributor Author

Ready for review, CI all green.

@EmilienM
Copy link
Contributor Author

/uncc seanschneeweiss

@k8s-ci-robot k8s-ci-robot removed the request for review from seanschneeweiss December 18, 2023 14:07
@EmilienM
Copy link
Contributor Author

/test pull-cluster-api-provider-openstack-e2e-full-test

@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 Jan 5, 2024
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 5, 2024
@EmilienM
Copy link
Contributor Author

EmilienM commented Jan 8, 2024

/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 Jan 8, 2024
@EmilienM
Copy link
Contributor Author

EmilienM commented Jan 8, 2024

/test pull-cluster-api-provider-openstack-e2e-full-test

Copy link
Contributor

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

/lgtm
Leaving the approval to someone else. More coverage for those conversions could be nice as @mdbooth mentioned but I don't see it as critical right now

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

@dulek dulek left a comment

Choose a reason for hiding this comment

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

/lgtm from my side too.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 9, 2024
Comment on lines 54 to 63
"externalNetwork": conversion.UnconditionalFieldRestorer(
func(c *infrav1.OpenStackCluster) *infrav1.NetworkFilter {
return &c.Spec.ExternalNetwork
},
),
"disableExternalNetwork": conversion.UnconditionalFieldRestorer(
func(c *infrav1.OpenStackCluster) *bool {
return &c.Spec.DisableExternalNetwork
},
),
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 we need these as they're already covered by spec above. In any case we would not want separate field restorers for individual fields like this. We want a single field restorer to cover a complete 'scope', e.g. the spec.

We only treat bastion separate because it's expected to be modified frequently, which makes it different to the rest of the spec. We don't want to exclude a spec from restore just because the bastion was modified, as it's reasonable that these fields might be managed differently.

I wonder if we should be excluding the bastion from the spec restorer, though 🤔 Yes, I'm pretty sure we should. I'll have to think about that.

@mdbooth
Copy link
Contributor

mdbooth commented Jan 9, 2024

I just pushed an update which fixes conversion of the new fields. The changes are:

  • For OpenStackCluster we use the existing spec restorer, and add restoration of the lost fields in restorev1alpha8ClusterSpec
  • We add a filter to the cluster spec restorer to fix the overlap with the bastion restorer.
  • We change OpenStackCluster template to just have a single big restorer for the spec, as we don't need to worry about frequent updates to a template

@mdbooth
Copy link
Contributor

mdbooth commented Jan 9, 2024

/approve

I'm happy for this to merge once somebody else has looked it over.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dulek, EmilienM, 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 Jan 9, 2024
@EmilienM
Copy link
Contributor Author

EmilienM commented Jan 9, 2024

/test pull-cluster-api-provider-openstack-e2e-full-test

// The external network can be specified in the cluster spec or will be searched for if not specified.
// OpenStackCluster.Status.ExternalNetwork will be set to nil if one of these conditions are met:
// - no external network was given in the cluster spec and no external network was found
// - the user has set OpenStackCluster.Spec.ExternalNetworkType to 'none'.
Copy link
Contributor

Choose a reason for hiding this comment

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

this doc looks outdated

@EmilienM
Copy link
Contributor Author

EmilienM commented Jan 9, 2024

/test pull-cluster-api-provider-openstack-e2e-full-test

@MaysaMacedo
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 9, 2024
@k8s-ci-robot k8s-ci-robot merged commit 0a4899a into kubernetes-sigs:main Jan 9, 2024
@EmilienM EmilienM deleted the external-network branch January 9, 2024 20:57
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants