-
Notifications
You must be signed in to change notification settings - Fork 1.5k
vshpere: download ova into cache #2922
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| package vsphere | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/openshift/installer/pkg/asset/installconfig" | ||
| "github.com/openshift/installer/pkg/types" | ||
| "github.com/openshift/installer/pkg/types/vsphere" | ||
| ) | ||
|
|
@@ -13,3 +16,10 @@ func Metadata(config *types.InstallConfig) *vsphere.Metadata { | |
| Password: config.VSphere.Password, | ||
| } | ||
| } | ||
|
|
||
| // PreTerraform performs any infrastructure initialization which must | ||
| // happen before Terraform creates the remaining infrastructure. | ||
| func PreTerraform(ctx context.Context, infraID string, installConfig *installconfig.InstallConfig) error { | ||
| // TODO: create VM Template using cachedImage | ||
| return nil | ||
| } | ||
|
Comment on lines
+20
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the goal for pre terraform was to put in code that was not easily done by terraform itself, like tagging subnets for AWS. my preference would be keep any cloud creation into terraform, we can easily keep local terraform providers for the custom objects/operations like the uploading ova. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package rhcos | ||
|
|
||
| import ( | ||
| "context" | ||
| "net/url" | ||
|
|
||
| "github.com/pkg/errors" | ||
|
|
||
| "github.com/openshift/installer/pkg/types" | ||
| ) | ||
|
|
||
| // VMware fetches the URL of the Red Hat Enterprise Linux CoreOS release. | ||
| func VMware(ctx context.Context, arch types.Architecture) (string, error) { | ||
| meta, err := fetchRHCOSBuild(ctx, arch) | ||
| if err != nil { | ||
| return "", errors.Wrap(err, "failed to fetch RHCOS metadata") | ||
| } | ||
|
|
||
| base, err := url.Parse(meta.BaseURI) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
|
|
||
| image, err := url.Parse(meta.Images.VMware.Path) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
|
|
||
| baseURL := base.ResolveReference(image).String() | ||
|
|
||
| // TODO: Get Uncompressed SHA256 into rhcos.json | ||
| // Attach sha256 checksum to the URL. Always provide the | ||
| // uncompressed SHA256; the cache will take care of | ||
| // uncompressing before checksumming. | ||
| //baseURL += "?sha256=" + meta.Images.VMware.UncompressedSHA256 | ||
|
|
||
| // Check that we have generated a valid URL | ||
| _, err = url.ParseRequestURI(baseURL) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
|
|
||
| return baseURL, nil | ||
| } |
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.
What is the effect of doing this? Is this value saved or used later?
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.
The goal here is to stuff the cached location back into the installConfig so we can pass it to the preterraform func. https://github.com/openshift/installer/pull/2922/files#diff-661643e1b9745123649391076bfa5a01R22. I don't believe it's ever written out to disk, though.
Uh oh!
There was an error while loading. Please reload this page.
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 don't think you can assume writeback to your dependency assets, the asset store could easily be providing you the ready only copies.
dependency loops are not great.