-
Notifications
You must be signed in to change notification settings - Fork 168
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
gcp: support additionalDisks
for GCP instance
#3477
Conversation
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm --gcp-localssd=NVME` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm --gcp-localssd=NVME` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
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.
This looks sane, but OTOH I was hoping in the future we'd generalize the --add-disk
stuff to not apply only to QEMU. It's also already exposed in kola tests as additionalDisks
, so for testing we just need to wire that through to the GCP backend. (The big advantage here is the same as the confidential case; it lets the test declare its requirements rather than require running multiple separate invocations of kola run
with different switches.) WDYT?
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.
Mostly LGTM.
mantle/cmd/kola/options.go
Outdated
@@ -124,6 +124,7 @@ func init() { | |||
bv(&kola.GCPOptions.ServiceAuth, "gcp-service-auth", false, "for non-interactive auth when running within GCP") | |||
sv(&kola.GCPOptions.JSONKeyFile, "gcp-json-key", "", "use a service account's JSON key for authentication (default \"~/"+auth.GCPConfigPath+"\")") | |||
bv(&kola.GCPOptions.Confidential, "gcp-confidential-vm", false, "create confidential instances") | |||
sv(&kola.GCPOptions.LocalSSD, "gcp-localssd", "", "attach local ssd disk, should be NVME or SCSI") |
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.
Should we "validate" the values here before launching the instance or is this done by the GCP library?
50e7ff7
to
1c3e344
Compare
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm --gcp-localssd=NVME` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
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.
Some comments, but the general idea looks great to me!
@@ -33,8 +34,56 @@ func (a *API) vmname() string { | |||
return fmt.Sprintf("%s-%x", a.options.BaseName, b) | |||
} | |||
|
|||
// ["local-ssd:interface=NVME,size=375"] | |||
func ParseDiskSpec(spec string, zone string) (*compute.AttachedDisk, error) { |
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 think it's fine for now to have this here, but we should ideally dedupe this with the one in qemu.go
. We can have a generic parser that returns the size in gigabytes as a uint
and any options in a map[string]string
.
But again, I'm OK to duplicate for now! Maybe let's add a comment in that case?
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.
Can I understand that it should return like map[string]string{"size": "5G", "interface": "NVME"}
after parsing ? Might do this in the later patch.
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 was thinking more something like:
package util
func ParseDiskSpec(spec string) (uint, map[string]string, error) {
...
}
?
Where the uint
is the disk size in gigabytes. Since it's a required argument, we can enforce proper typing for it. Also, some cloud API bindings may take it directly as an integer (like GCP here) too which is nice. Others might require a string but suffixed differently (e.g. "GB" vs "G"), which would have to live in the cloud-specific code.
@@ -33,8 +34,56 @@ func (a *API) vmname() string { | |||
return fmt.Sprintf("%s-%x", a.options.BaseName, b) | |||
} | |||
|
|||
// ["local-ssd:interface=NVME,size=375"] | |||
func ParseDiskSpec(spec string, zone string) (*compute.AttachedDisk, error) { |
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.
Optional, but I think it'd be pretty easy to have a unit test or two for this function.
One tension I see here is that dealing with "cloud configuration" in the general case, particularly abstracting across clouds gets really complicated. This is where it may make sense longer term for us to leverage more mature tools in this space...e.g. terraform. |
Related to the "cloud configuration" problem above, to expand on this bit, I think probably our approach should be something where we have sane defaults, so that generic specs like But if you're testing the intricacies of a cloud (e.g. whether the GCP udev rules for persistent NVMe disks show up correctly), then it's fine to have more cloud-specific options since your test will be targeting GCP only anyway. So we don't have to build a very abstract spec that works cross-platform. I think just the basics would cover a lot. |
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
--gcp-localssd
to support local ssd for instancesadditionalDisks
for GCP instance
e26365a
to
c22463d
Compare
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Thanks @jlebon, @cgwalters and @travier for the suggestions. Build cosa with this patch locally, and run test based on coreos/fedora-coreos-config#2425, get 2 nvme disks for the new instance.
|
if len(opts.AdditionalDisks) > 0 { | ||
for _, spec := range opts.AdditionalDisks { |
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.
Completely minor nit, but is the len
check here needed? Won't the loop be a no-op if the length is zero anyways?
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.
(With stuff like this, feel free to merge as is. Minor fixups like this can be done as a followup alongside other cleanups)
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Refer to @jlebon's suggestion, see coreos#3477 (comment)
Refer to @jlebon's suggestion, see coreos#3477 (comment)
Refer to @jlebon's suggestion, see #3477 (comment)
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. Based on coreos/coreos-assembler#3474 and coreos/coreos-assembler#3477. Fix coreos/fedora-coreos-tracker#1457
See coreos/fedora-coreos-tracker#1457