-
Notifications
You must be signed in to change notification settings - Fork 64
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
Use nocloud when specified #224
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: hh 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 |
Pull Request Test Coverage Report for Build 4169745530
💛 - Coveralls |
Ensuring we loop in @davidvossel
|
/ok-to-test |
this comment [1] from the previous pr was the primary remaining thing. We don't have to remove mergo from go.mod since i know it's an indirect dependency somewhere in the dependency chain. I'd just like to see that we dont' introduce that dependency directly in the capk code for this PR simply because it isn't needed. |
@@ -61,7 +62,6 @@ require ( | |||
github.com/googleapis/gnostic v0.5.5 // indirect | |||
github.com/gorilla/websocket v1.5.0 // indirect | |||
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect | |||
github.com/imdario/mergo v0.3.12 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing mergo as requested
if index >= 0 { | ||
template.Spec.Volumes[index] = cloudInitVolume | ||
} else { | ||
template.Spec.Domain.Devices.Disks = append(template.Spec.Domain.Devices.Disks, cloudInitDisk) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what you are looking for @davidvossel ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not exactly.
The disk and volume logic needs to be independent. Here's what we need.
If the volume already exists, override it template.Spec.Volumes[index] = cloudInitVolume
else append the volume to the template.Spec.Volumes slice.
If the disk matching the volume name already exists, then leave it alone. If the disk doesn't exist, append it.
The idea here is that someone can create their own disk mapping to the cloud init volume, using whatever parameters they want and we'll use that... but if no disk is provided that matches the cloud-init volume name, we'll automatically create one using the virtio bus.
And for the volumes, some one can create a volume with a specific cloud init type, and we'll inject the user data into that, or if no volume exists already for cloud init, we'll create one for the user defaulting to cloud init config drive.
func detectCloudInitDisk(vmi *kubevirtv1.VirtualMachineInstanceTemplateSpec) (foundCloudInitDisk bool) { | ||
for _, v := range vmi.Spec.Domain.Devices.Disks { | ||
if v.Disk != nil && v.Name == cloudInitVolumeName { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it makes sense to detect if it's a CloudInitDisk or not anymore?
switch cloudInitType { | ||
case cloudInitNoCloud: | ||
err := mergo.Merge(&template.Spec.Volumes[index], cloudInitVolume) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return template, nil | ||
case cloudInitConfigDrive: | ||
template.Spec.Volumes = append(template.Spec.Volumes, cloudInitVolume) | ||
} | ||
if !detectCloudInitDisk(template) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making sure it makes sense to remove this switch & merge logic with the simplified version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i left a comment inline, before this merges we'll need to squash the commits down
if index >= 0 { | ||
template.Spec.Volumes[index] = cloudInitVolume | ||
} else { | ||
template.Spec.Domain.Devices.Disks = append(template.Spec.Domain.Devices.Disks, cloudInitDisk) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not exactly.
The disk and volume logic needs to be independent. Here's what we need.
If the volume already exists, override it template.Spec.Volumes[index] = cloudInitVolume
else append the volume to the template.Spec.Volumes slice.
If the disk matching the volume name already exists, then leave it alone. If the disk doesn't exist, append it.
The idea here is that someone can create their own disk mapping to the cloud init volume, using whatever parameters they want and we'll use that... but if no disk is provided that matches the cloud-init volume name, we'll automatically create one using the virtio bus.
And for the volumes, some one can create a volume with a specific cloud init type, and we'll inject the user data into that, or if no volume exists already for cloud init, we'll create one for the user defaulting to cloud init config drive.
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
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. |
We are picking this up from @BobyMCbobs (thanks for the work on this)
Context: #212