mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
This implements part of the plan from: https://github.com/openshift/os/issues/477 When we originally added the pinned RHCOS metadata `rhcos.json` to the installer, we also changed the coreos-assembler `meta.json` format into an arbitrary new format in the name of some cleanups. In retrospect, this was a big mistake because we now have two formats. Then Fedora CoreOS appeared and added streams JSON as a public API. We decided to unify on streams metadata; there's now a published Go library for it: https://github.com/coreos/stream-metadata-go Among other benefits, it is a single file that supports multiple architectures. UPI installs should now use stream metadata, particularly to find public cloud images. This is exposed via a new `openshift-install coreos print-stream-json` command. This is an important preparatory step for exposing this via `oc` as well as having something in the cluster update to it. HOWEVER as a (really hopefully temporary) hack, we *duplicate* the metadata so that IPI installs use the new stream format, and UPI CI jobs can still use the old format (with different RHCOS versions). We will port the UPI docs and CI jobs after this merges. Co-authored-by: Matthew Staebler <staebler@redhat.com>
20 lines
660 B
Go
20 lines
660 B
Go
package rhcos
|
|
|
|
import (
|
|
"net/url"
|
|
)
|
|
|
|
// GenerateOpenStackImageName returns Glance image name for instances.
|
|
func GenerateOpenStackImageName(rhcosImage, infraID string) (imageName string, isURL bool) {
|
|
// Here we check whether rhcosImage is a URL or not. If this is the first case, it means that Glance image
|
|
// should be created by the installer with the universal name "<infraID>-rhcos". Otherwise, it means
|
|
// that we are given the name of the pre-created Glance image, which the installer should use for node
|
|
// provisioning.
|
|
_, err := url.ParseRequestURI(rhcosImage)
|
|
if err != nil {
|
|
return rhcosImage, false
|
|
}
|
|
|
|
return infraID + "-rhcos", true
|
|
}
|