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

🐛 Don't require cinder when not using volumes #1353

Merged
merged 2 commits into from
Oct 11, 2022

Conversation

mdbooth
Copy link
Contributor

@mdbooth mdbooth commented Oct 4, 2022

What this PR does / why we need it:

The addition of multi-AZ volume support inadvertently added a hard requirement for Cinder. This change removes that requirement by:

  • Splitting ComputeClient into separate Compute, Image, and Volume clients
  • Making initialisation of each client lazy on first use

If a machine definition does not use volumes the VolumeClient will not be initialised, meaning Cinder is no longer a requirement.

Which issue(s) this PR fixes:
Fixes #1345

Special notes for your reviewer:

It might be simpler to review these 2 commits separately. I pulled the first one out of one of my other outstanding PRs #1236. The separation of clients which I did in that PR for other reasons works very nicely for this, too.

The first commit is mostly code motion. The second commit implements the change.

/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 Oct 4, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 Oct 4, 2022
@netlify
Copy link

netlify bot commented Oct 4, 2022

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

Name Link
🔨 Latest commit 68474a1
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/634499572ccace0008e47bce
😎 Deploy Preview https://deploy-preview-1353--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 settings.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 4, 2022

type volumeErrorClient struct{ error }

// NewVolumeErrorClient returns a VolumeClient in which every method returns the given error.
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea , create such error client should help abstract the error case

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 wanted to create a proper monad, but that's not ergonomic in Go. This seemed like a fairly neat alternative.

@jichenjc
Copy link
Contributor

jichenjc commented Oct 9, 2022

/lgtm

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

mdbooth commented Oct 10, 2022

/hold cancel

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Oct 10, 2022
@mdbooth mdbooth force-pushed the 1345-volume-support branch from 088b615 to 8974455 Compare October 10, 2022 09:39
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 10, 2022
@mdbooth mdbooth force-pushed the 1345-volume-support branch from 8974455 to 68474a1 Compare October 10, 2022 22:14
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 10, 2022
@mdbooth
Copy link
Contributor Author

mdbooth commented Oct 10, 2022

@jichenjc Had to fix a couple of merge conflicts, but nothing consequential. Appreciate it if you could have a look and restore your lgtm.

@jichenjc
Copy link
Contributor

/lgtm
/hold

lgtm, hold this wait for CI and please unhold when you think it's ok after CI pass @mdbooth

@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. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Oct 10, 2022
@mdbooth
Copy link
Contributor Author

mdbooth commented Oct 11, 2022

/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 Oct 11, 2022
@tobiasgiese
Copy link
Member

lgtm, hold this wait for CI and please unhold when you think it's ok after CI pass @mdbooth

@jichenjc Prow will not merge until the required tests are green 🙂 thus, there is no need to add the hold to wait for CI to pass. Just FYI

@jichenjc
Copy link
Contributor

@tobiasgiese thanks :)

@k8s-ci-robot k8s-ci-robot merged commit 02a3173 into kubernetes-sigs:main Oct 11, 2022
@stephenfin stephenfin deleted the 1345-volume-support branch October 26, 2022 10:35
jichenjc pushed a commit to jichenjc/cluster-api-provider-openstack that referenced this pull request Nov 23, 2022
…upport

🐛 Don't require cinder when not using volumes
@jichenjc
Copy link
Contributor

/cherry-pick release-0.6

@k8s-infra-cherrypick-robot

@jichenjc: #1353 failed to apply on top of branch "release-0.6":

Applying: Move clients into a separate package
Using index info to reconstruct a base tree...
M	pkg/cloud/services/compute/client.go
M	pkg/cloud/services/compute/client_mock.go
M	pkg/cloud/services/compute/instance.go
M	pkg/cloud/services/compute/instance_test.go
M	pkg/cloud/services/compute/instance_types.go
M	pkg/cloud/services/compute/instance_types_test.go
M	pkg/cloud/services/compute/service.go
M	pkg/cloud/services/loadbalancer/client.go
M	pkg/cloud/services/loadbalancer/loadbalancer_test.go
A	pkg/cloud/services/loadbalancer/mock_loadbalancer/doc.go
M	pkg/cloud/services/loadbalancer/mock_loadbalancer/loadbalancer_service_mock.go
M	pkg/cloud/services/loadbalancer/service.go
M	pkg/cloud/services/networking/client.go
M	pkg/cloud/services/networking/floatingip_test.go
M	pkg/cloud/services/networking/mock_networking/client_mock.go
M	pkg/cloud/services/networking/mock_networking/doc.go
M	pkg/cloud/services/networking/port_test.go
M	pkg/cloud/services/networking/service.go
M	pkg/cloud/services/networking/trunk_test.go
M	test/e2e/shared/openstack.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/shared/openstack.go
CONFLICT (content): Merge conflict in test/e2e/shared/openstack.go
Auto-merging pkg/cloud/services/networking/trunk_test.go
CONFLICT (content): Merge conflict in pkg/cloud/services/networking/trunk_test.go
Auto-merging pkg/cloud/services/networking/service.go
Auto-merging pkg/cloud/services/networking/port_test.go
CONFLICT (content): Merge conflict in pkg/cloud/services/networking/port_test.go
CONFLICT (modify/delete): pkg/cloud/services/networking/mock_networking/doc.go deleted in Move clients into a separate package and modified in HEAD. Version HEAD of pkg/cloud/services/networking/mock_networking/doc.go left in tree.
Auto-merging pkg/cloud/services/networking/floatingip_test.go
CONFLICT (content): Merge conflict in pkg/cloud/services/networking/floatingip_test.go
Auto-merging pkg/cloud/services/loadbalancer/service.go
Auto-merging pkg/cloud/services/loadbalancer/loadbalancer_test.go
CONFLICT (content): Merge conflict in pkg/cloud/services/loadbalancer/loadbalancer_test.go
Auto-merging pkg/cloud/services/compute/service.go
Auto-merging pkg/cloud/services/compute/instance_types_test.go
Auto-merging pkg/cloud/services/compute/instance_types.go
CONFLICT (content): Merge conflict in pkg/cloud/services/compute/instance_types.go
Auto-merging pkg/cloud/services/compute/instance_test.go
CONFLICT (content): Merge conflict in pkg/cloud/services/compute/instance_test.go
Auto-merging pkg/cloud/services/compute/instance.go
CONFLICT (content): Merge conflict in pkg/cloud/services/compute/instance.go
Auto-merging pkg/clients/networking.go
Auto-merging pkg/clients/mock/network.go
Auto-merging pkg/clients/mock/loadbalancer.go
Auto-merging pkg/clients/mock/compute.go
Auto-merging pkg/clients/loadbalancer.go
CONFLICT (content): Merge conflict in pkg/clients/loadbalancer.go
Auto-merging pkg/clients/compute.go
CONFLICT (rename/delete): pkg/cloud/services/loadbalancer/mock_loadbalancer/doc.go deleted in Move clients into a separate package and renamed to hack/boilerplate/boilerplate.generatego.txt in HEAD. Version HEAD of hack/boilerplate/boilerplate.generatego.txt left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Move clients into a separate package
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-0.6

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.

@jichenjc
Copy link
Contributor

plan to cherry pick this for 0.6 but encounter many conflict ...

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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster creation fails when OpenStack does not have volume support
5 participants