forked from openshift/installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stream metadata for RHCOS (bump x86_64 to 48.83.202102230316-0)
This implements part of the plan from: openshift/os#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 <[email protected]>
- Loading branch information
Showing
21 changed files
with
788 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/openshift/installer/pkg/coreoscli" | ||
) | ||
|
||
func newCoreOSCmd() *cobra.Command { | ||
return coreoscli.NewCmd() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package manifests | ||
|
||
import ( | ||
"context" | ||
"path/filepath" | ||
|
||
"github.com/ghodss/yaml" | ||
"github.com/pkg/errors" | ||
|
||
"github.com/openshift/installer/pkg/asset" | ||
"github.com/openshift/installer/pkg/asset/installconfig" | ||
"github.com/openshift/installer/pkg/rhcos" | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
const ( | ||
// mcoNamespace is where we target the configmap. | ||
mcoNamespace = "openshift-machine-config-operator" | ||
// configmapName is the name of the config map | ||
configmapName = "coreos-bootimages" | ||
// streamKey is the key that contains the stream metadata | ||
streamKey = "stream" | ||
) | ||
|
||
var ( | ||
coreOSBootimagesCfgFilename = filepath.Join(manifestDir, "machine-config-operator-bootimages-config.yml") | ||
) | ||
|
||
// CoreOSBootimages generates the manifest with CoreOS stream metadata for the bootimages | ||
type CoreOSBootimages struct { | ||
ConfigMap *corev1.ConfigMap | ||
File *asset.File | ||
} | ||
|
||
var _ asset.WritableAsset = (*CoreOSBootimages)(nil) | ||
|
||
// Name returns a human friendly name for the asset. | ||
func (*CoreOSBootimages) Name() string { | ||
return "CoreOSBootimages Config" | ||
} | ||
|
||
// Dependencies returns all of the dependencies directly needed to generate | ||
// the asset. | ||
func (*CoreOSBootimages) Dependencies() []asset.Asset { | ||
return []asset.Asset{ | ||
&installconfig.InstallConfig{}, | ||
} | ||
} | ||
|
||
// Generate generates the CoreOSBootimages config and its CRD. | ||
func (s *CoreOSBootimages) Generate(dependencies asset.Parents) error { | ||
installConfig := &installconfig.InstallConfig{} | ||
dependencies.Get(installConfig) | ||
|
||
streamData, err := rhcos.FetchRawCoreOSStream(context.Background()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
data := make(map[string]string) | ||
data[streamKey] = string(streamData) | ||
|
||
cm := &corev1.ConfigMap{ | ||
TypeMeta: metav1.TypeMeta{ | ||
APIVersion: corev1.SchemeGroupVersion.String(), | ||
Kind: "ConfigMap", | ||
}, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Namespace: mcoNamespace, | ||
Name: configmapName, | ||
}, | ||
Data: data, | ||
} | ||
|
||
cmData, err := yaml.Marshal(cm) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to create %s manifest", s.Name()) | ||
} | ||
s.ConfigMap = cm | ||
s.File = &asset.File{ | ||
Filename: coreOSBootimagesCfgFilename, | ||
Data: cmData, | ||
} | ||
return nil | ||
} | ||
|
||
// Files returns the files generated by the asset. | ||
func (s *CoreOSBootimages) Files() []*asset.File { | ||
if s.File != nil { | ||
return []*asset.File{s.File} | ||
} | ||
return []*asset.File{} | ||
} | ||
|
||
// Load returns false since this asset is not written to disk by the installer. | ||
func (s *CoreOSBootimages) Load(f asset.FileFetcher) (bool, error) { | ||
return false, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.