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

🐛 StoragePolicy should select datastore based on connected hosts and set on VM spec #2134

Merged

Conversation

rikatz
Copy link
Contributor

@rikatz rikatz commented Aug 1, 2023

What this PR does / why we need it:
This PR fixes some workflows on CAPV + Storage policy:

  • When using a storage policy, we need to make sure that the only selected datastores are the DS connected to the cluster/host. Today we don't validate it, which means that we may end up with an invalid datastore on a multi-cluster environment with a storage policy that selects datastores on different clusters, we can select a datastore not connected to our cluster - The new workflow will first get all the datastores connected to the cluster, and then pass this list of datastores to Storage Policy validation
  • When passing both storage policy and datastore, this datastore should be validated on the storage policy and fail if it cannot be used
  • Finally, on cloning we MUST pass spec.Location.Datastore = datastoreRef otherwise the cloning process will not understand when this is a cross datastore/cluster cloning and will fail, as it will try to use the template datastore.

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 #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 1, 2023
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 1, 2023
@randomvariable
Copy link
Member

/hold

@rikatz is testing on linked clone workflow, but otherwise ready for review.

@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 Aug 3, 2023
@rikatz
Copy link
Contributor Author

rikatz commented Aug 3, 2023

@randomvariable @sbueringer just confirming that the linked clone still works with this change. I will unhold, but feel free to merge it after the next minor release, as a patch if the time line needs to! :)

/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 Aug 3, 2023
@chrischdi
Copy link
Member

/test help

@k8s-ci-robot
Copy link
Contributor

@chrischdi: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-vsphere-conformance-main
  • /test pull-cluster-api-provider-vsphere-e2e-full-main
  • /test pull-cluster-api-provider-vsphere-e2e-main
  • /test pull-cluster-api-provider-vsphere-test-integration-main
  • /test pull-cluster-api-provider-vsphere-test-main
  • /test pull-cluster-api-provider-vsphere-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-vsphere-apidiff-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-vsphere-apidiff-main
  • pull-cluster-api-provider-vsphere-e2e-main
  • pull-cluster-api-provider-vsphere-test-integration-main
  • pull-cluster-api-provider-vsphere-test-main
  • pull-cluster-api-provider-vsphere-verify-main

In response to this:

/test help

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.

@chrischdi
Copy link
Member

/test pull-cluster-api-provider-vsphere-e2e-full-main

@sbueringer sbueringer modified the milestone: v1.8 Aug 4, 2023
Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

/lgtm

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

LGTM label has been added.

Git tree hash: f0fa4d8606ab15ac9c20e42107a8a93a94228115

@sbueringer sbueringer added this to the v1.8 milestone Aug 8, 2023
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Overall makes sense to me.

Some suggestions for godoc.

I would like a review from either @srm09 or @yastij to ensure we're not missing anything

/assign @srm09 @yastij

pkg/services/govmomi/vcenter/clone.go Outdated Show resolved Hide resolved
pkg/services/govmomi/vcenter/clone.go Outdated Show resolved Hide resolved
pkg/services/govmomi/vcenter/clone.go Outdated Show resolved Hide resolved
pkg/services/govmomi/vcenter/clone.go Show resolved Hide resolved
pkg/services/govmomi/vcenter/clone.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2023
@rikatz rikatz force-pushed the improve-storage-policy-workflow branch from b06efe2 to a7d4c0a Compare August 15, 2023 17:29
@sbueringer
Copy link
Member

sbueringer commented Aug 15, 2023

@randomvariable If you have some time, would be good if you can take a look

@rikatz
Copy link
Contributor Author

rikatz commented Aug 15, 2023

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 24, 2023
@sbueringer
Copy link
Member

Perfect. Thank you very much!

/lgtm
/approve

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

LGTM label has been added.

Git tree hash: a04ef759d82e5f997cda590c0e17c4e297ff5685

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Aug 24, 2023
@sbueringer
Copy link
Member

/cherry-pick release-1.8

@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.8 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.8

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.

@sbueringer
Copy link
Member

/cherry-pick release-1.7

@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.7 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.7

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.

@sbueringer
Copy link
Member

/cherry-pick release-1.6

@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.6 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.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.

@sbueringer
Copy link
Member

/cherry-pick release-1.5

@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.5 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.5

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.

@k8s-ci-robot k8s-ci-robot merged commit ea5331d into kubernetes-sigs:main Aug 24, 2023
14 checks passed
@k8s-ci-robot k8s-ci-robot modified the milestones: v1.8, v1.9 Aug 24, 2023
@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #2275

In response to this:

/cherry-pick release-1.8

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.

@k8s-infra-cherrypick-robot

@sbueringer: #2134 failed to apply on top of branch "release-1.7":

Applying: Storagepolicy should select ds based on connected cluster
Using index info to reconstruct a base tree...
M	pkg/services/govmomi/vcenter/clone.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/services/govmomi/vcenter/clone.go
CONFLICT (content): Merge conflict in pkg/services/govmomi/vcenter/clone.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Storagepolicy should select ds based on connected cluster
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-1.7

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.

@k8s-infra-cherrypick-robot

@sbueringer: #2134 failed to apply on top of branch "release-1.6":

Applying: Storagepolicy should select ds based on connected cluster
Using index info to reconstruct a base tree...
M	pkg/services/govmomi/vcenter/clone.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/services/govmomi/vcenter/clone.go
CONFLICT (content): Merge conflict in pkg/services/govmomi/vcenter/clone.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Storagepolicy should select ds based on connected cluster
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-1.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.

@k8s-infra-cherrypick-robot

@sbueringer: #2134 failed to apply on top of branch "release-1.5":

Applying: Storagepolicy should select ds based on connected cluster
Using index info to reconstruct a base tree...
M	pkg/services/govmomi/vcenter/clone.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/services/govmomi/vcenter/clone.go
CONFLICT (content): Merge conflict in pkg/services/govmomi/vcenter/clone.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Storagepolicy should select ds based on connected cluster
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-1.5

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.

@sbueringer
Copy link
Member

sbueringer commented Aug 24, 2023

@rikatz Do you have some time to open cherry-picks for the other branches? I diffed the branches and thought they are all pretty similar :/

@rikatz
Copy link
Contributor Author

rikatz commented Aug 24, 2023

done for the 3 failed cherry picks

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

Successfully merging this pull request may close these issues.

9 participants