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

✨ New CRD + controller for OpenStackServer (v1alpha1) #2067

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

EmilienM
Copy link
Contributor

@EmilienM EmilienM commented May 7, 2024

What this PR does / why we need it:

A new CRD and controller which will manage the OpenStack servers in the cluster.

#2020
#2021

TODOs:

  • OpenStackServer API && make generate
  • openstackserver webook (MVP)
  • openstackserver_controller: create/delete/adopt instances & ports (MVP)
  • Migrating Bastion to use the new controller (MVP)
  • Migrating OpenStackMachine to the new controller (MVP)
  • adds unit tests
  • includes documentation
  • squashed commits

Future work that can happen outside this PR:

  • Stop storing the bastion spec hash into the OpenStackCluster annotations and watch for changes in Bastion spec, where any change would trigger a bastionDelete.
  • Switch UserData as a ref
  • Stop populating server related status fields for both OpenStackCluster and OpenStackMachine objects, since they now live in OpenStackServer. The fields will be removed for a potential v1.

@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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 7, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign justinsb for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 7, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 7, 2024
Copy link

netlify bot commented May 7, 2024

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

Name Link
🔨 Latest commit b4f53ec
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/665fe132e26f1c00084a44b0
😎 Deploy Preview https://deploy-preview-2067--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.

@EmilienM EmilienM force-pushed the OpenStackServer branch 2 times, most recently from 721f487 to 8c090fe Compare May 8, 2024 12:27
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 8, 2024
@EmilienM EmilienM force-pushed the OpenStackServer branch 2 times, most recently from ccbf0b6 to f081701 Compare May 8, 2024 20:44
@EmilienM
Copy link
Contributor Author

EmilienM commented May 8, 2024

/uncc dulek
/cc mdbooth

@k8s-ci-robot k8s-ci-robot requested review from mdbooth and removed request for dulek May 8, 2024 20:44
@EmilienM EmilienM force-pushed the OpenStackServer branch 3 times, most recently from 96a46fa to 075ef3d Compare May 8, 2024 21:17
@EmilienM
Copy link
Contributor Author

EmilienM commented May 9, 2024

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

@EmilienM EmilienM force-pushed the OpenStackServer branch 2 times, most recently from b80f256 to c608240 Compare May 9, 2024 20:11
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 9, 2024
@EmilienM EmilienM force-pushed the OpenStackServer branch 3 times, most recently from b5c3f50 to cd77e8a Compare May 15, 2024 17:01
@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 May 15, 2024
@EmilienM
Copy link
Contributor Author

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

Comment on lines +108 to +105
// UserData is the user data to be injected into the server instance.
// +optional
UserData optional.String `json:"userData"`
Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed leaving this as a reference as it can be pretty big.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you want to put the clusterv1.Bootstrap from the Machine directly, as a type? Or do like the floating IP ref using *corev1.TypedLocalObjectReference ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

offline, we agreed that we would create a new struct in OpenStackServer.Spec for UserData with just a name as reference for now; so later we can decide what to do with it but for now it'll reference to the bootstrap secret handled by CAPI.

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically just a fork of the machine controller with some bits removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but smarter 🧠 .

pkg/cloud/services/compute/instance.go Outdated Show resolved Hide resolved
pkg/cloud/services/networking/port.go Outdated Show resolved Hide resolved
// AdoptPorts looks for ports in desiredPorts which were previously created, and adds them to resources.Ports.
// AdoptPortsMachine looks for ports in desiredPorts which were previously created, and adds them to resources.Ports.
// A port matches if it has the same name and network ID as the desired port.
func (s *Service) AdoptPortsMachine(scope *scope.WithLogger, desiredPorts []infrav1.ResolvedPortSpec, resources *infrav1.MachineResources) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Worth having just one of these? Or perhaps we delete one later in the series and it doesn't matter...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we'll stop populating the OpenStackMachine status at some point, we won't need these things.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any validation we can't do with CEL? If not, lets delete this.

Copy link
Contributor Author

@EmilienM EmilienM Jun 3, 2024

Choose a reason for hiding this comment

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

the only validation we make here is to ensure immutability. I don't know enough CEL to know if it can check that. However I'll investigate. However I'm not sure if CEL recognize TopologyDryRunAnnotation (link).
I checked other providers and they do that via the webhook.

Copy link
Contributor

Choose a reason for hiding this comment

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

Lets put all of these in the apivalidations suite instead. That way they will still work when we implement them with CEL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll put that into a separate commit for now as I'm not sure whether we want to keep the same validations in OpenStackMachine (?).

@EmilienM EmilienM force-pushed the OpenStackServer branch 4 times, most recently from 43305cc to c559561 Compare June 3, 2024 18:33
@EmilienM EmilienM force-pushed the OpenStackServer branch 3 times, most recently from 6bda600 to bdd57f2 Compare June 3, 2024 20:25
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 4, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 4, 2024
@EmilienM
Copy link
Contributor Author

EmilienM commented Jun 4, 2024

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

@k8s-ci-robot
Copy link
Contributor

@EmilienM: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-openstack-e2e-full-test 0632db3 link false /test pull-cluster-api-provider-openstack-e2e-full-test
pull-cluster-api-provider-openstack-e2e-test a0169bb link true /test pull-cluster-api-provider-openstack-e2e-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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-sigs/prow repository. I understand the commands that are listed here.

When creating a server, Nova can return an error immediately after the
call was made to create it or later.

If it's returned immediately, we would like to restore the error event
that we used to have and that we actually test in our e2e when providing
a wrong availability zone.

(cherry picked from commit e8a0e06)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Status: Inbox
Development

Successfully merging this pull request may close these issues.

None yet

5 participants