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

fix(virtctl,create): Validate names of disks #13547

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

0xFelix
Copy link
Member

@0xFelix 0xFelix commented Dec 17, 2024

What this PR does

Validate the names of disks that are derived from the VM's name or specified by the user against RFC 1123 DNS label rules to avoid generating VMs with disk names that will lead to the VM being rejected upon creation.

Before this PR:

virtctl create vm allows to generate VMs with disk names that will lead to rejection of the VM upon creation.

After this PR:

virtctl create vm validates disk names and prevents disk names that will lead to rejection of a VM upon creation.

Fixes #13340

Why we need it and why it was done in this way

The following tradeoffs were made:

The following alternatives were considered:

Links to places where the discussion took place:

Special notes for your reviewer

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

virtctl create vm validates disk names and prevents disk names that will lead to rejection of a VM upon creation.

Validate the names of disks that are derived from the VM's name or
specified by the user against RFC 1123 DNS label rules to avoid
generating VMs with disk names that will lead to the VM being
rejected upon creation.

Signed-off-by: Felix Matouschek <[email protected]>
@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. area/virtctl size/M labels Dec 17, 2024
Copy link
Member

@lyarwood lyarwood left a comment

Choose a reason for hiding this comment

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

/lgtm

Excellent, thanks @0xFelix !

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2024
Copy link
Member

@xpivarc xpivarc left a comment

Choose a reason for hiding this comment

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

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xpivarc

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 18, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-1.30-vgpu
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.30-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.30-sig-network
/test pull-kubevirt-e2e-k8s-1.30-sig-storage
/test pull-kubevirt-e2e-k8s-1.30-sig-compute
/test pull-kubevirt-e2e-k8s-1.30-sig-operator

@0xFelix
Copy link
Member Author

0xFelix commented Dec 18, 2024

/cherry-pick release-1.4
/cherry-pick release-1.3
/cherry-pick release-1.2

@kubevirt-bot
Copy link
Contributor

@0xFelix: once the present PR merges, I will cherry-pick it on top of release-1.2, release-1.3, release-1.4 in new PRs and assign them to you.

In response to this:

/cherry-pick release-1.4
/cherry-pick release-1.3
/cherry-pick release-1.2

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.

@kubevirt-bot kubevirt-bot merged commit 7915db1 into kubevirt:main Dec 18, 2024
37 of 38 checks passed
@kubevirt-bot
Copy link
Contributor

@0xFelix: #13547 failed to apply on top of branch "release-1.4":

Applying: fix(virtctl,create): Validate names of disks
Using index info to reconstruct a base tree...
M	pkg/virtctl/create/vm/BUILD.bazel
M	pkg/virtctl/create/vm/vm.go
M	pkg/virtctl/create/vm/vm_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/virtctl/create/vm/vm_test.go
CONFLICT (content): Merge conflict in pkg/virtctl/create/vm/vm_test.go
Auto-merging pkg/virtctl/create/vm/vm.go
CONFLICT (content): Merge conflict in pkg/virtctl/create/vm/vm.go
Auto-merging pkg/virtctl/create/vm/BUILD.bazel
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 fix(virtctl,create): Validate names of disks

In response to this:

/cherry-pick release-1.4
/cherry-pick release-1.3
/cherry-pick release-1.2

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.

@kubevirt-bot
Copy link
Contributor

@0xFelix: #13547 failed to apply on top of branch "release-1.3":

Applying: fix(virtctl,create): Validate names of disks
Using index info to reconstruct a base tree...
M	pkg/virtctl/create/vm/BUILD.bazel
M	pkg/virtctl/create/vm/vm.go
M	pkg/virtctl/create/vm/vm_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/virtctl/create/vm/vm_test.go
CONFLICT (content): Merge conflict in pkg/virtctl/create/vm/vm_test.go
Auto-merging pkg/virtctl/create/vm/vm.go
CONFLICT (content): Merge conflict in pkg/virtctl/create/vm/vm.go
Auto-merging pkg/virtctl/create/vm/BUILD.bazel
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 fix(virtctl,create): Validate names of disks

In response to this:

/cherry-pick release-1.4
/cherry-pick release-1.3
/cherry-pick release-1.2

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.

@kubevirt-bot
Copy link
Contributor

@0xFelix: #13547 failed to apply on top of branch "release-1.2":

Applying: fix(virtctl,create): Validate names of disks
Using index info to reconstruct a base tree...
M	pkg/virtctl/create/vm/BUILD.bazel
M	pkg/virtctl/create/vm/vm.go
M	pkg/virtctl/create/vm/vm_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/virtctl/create/vm/vm_test.go
CONFLICT (content): Merge conflict in pkg/virtctl/create/vm/vm_test.go
Auto-merging pkg/virtctl/create/vm/vm.go
CONFLICT (content): Merge conflict in pkg/virtctl/create/vm/vm.go
Auto-merging pkg/virtctl/create/vm/BUILD.bazel
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 fix(virtctl,create): Validate names of disks

In response to this:

/cherry-pick release-1.4
/cherry-pick release-1.3
/cherry-pick release-1.2

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.

@kubevirt-bot
Copy link
Contributor

@0xFelix: The following test 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-kubevirt-e2e-kind-1.30-vgpu e81e0e3 link unknown /test pull-kubevirt-e2e-kind-1.30-vgpu

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.

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. area/virtctl dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/compute size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

virtctl create vm doesn't validate that name can be used as part of disk name
5 participants