diff --git a/cmd/machine-config-operator/bootstrap.go b/cmd/machine-config-operator/bootstrap.go index 72fd3e755e..cf6f0fae5f 100644 --- a/cmd/machine-config-operator/bootstrap.go +++ b/cmd/machine-config-operator/bootstrap.go @@ -29,6 +29,7 @@ var ( rootCAFile string pullSecretFile string configFile string + oscontentImage string imagesConfigMapFile string mccImage string mcsImage string @@ -49,6 +50,7 @@ func init() { bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.mccImage, "machine-config-controller-image", "", "Image for Machine Config Controller. (this overrides the image from --images-json-configmap)") bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.mcsImage, "machine-config-server-image", "", "Image for Machine Config Server. (this overrides the image from --images-json-configmap)") bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.mcdImage, "machine-config-daemon-image", "", "Image for Machine Config Daemon. (this overrides the image from --images-json-configmap)") + bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.oscontentImage, "machine-config-oscontent-image", "", "Image for osImageURL") bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.etcdImage, "etcd-image", "", "Image for Etcd. (this overrides the image from --images-json-configmap)") bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.setupEtcdEnvImage, "setup-etcd-env-image", "", "Image for Setup Etcd Environment. (this overrides the image from --images-json-configmap)") bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.configFile, "config-file", "", "ClusterConfig ConfigMap file.") @@ -94,6 +96,10 @@ func runBootstrapCmd(cmd *cobra.Command, args []string) { if bootstrapOpts.setupEtcdEnvImage != "" { imgs.SetupEtcdEnv = bootstrapOpts.setupEtcdEnvImage } + if bootstrapOpts.oscontentImage != "" { + imgs.MachineOSContent = bootstrapOpts.oscontentImage + } + if err := operator.RenderBootstrap( bootstrapOpts.configFile, bootstrapOpts.etcdCAFile, bootstrapOpts.rootCAFile, bootstrapOpts.pullSecretFile, diff --git a/pkg/operator/bootstrap.go b/pkg/operator/bootstrap.go index 87645e20e4..3007240996 100644 --- a/pkg/operator/bootstrap.go +++ b/pkg/operator/bootstrap.go @@ -42,7 +42,7 @@ func RenderBootstrap( return fmt.Errorf("error discovering MCOConfig from %q: %v", clusterConfigConfigMapFile, err) } - config := getRenderConfig(mcoconfig, filesData[etcdCAFile], filesData[rootCAFile], nil, imgs, "") + config := getRenderConfig(mcoconfig, filesData[etcdCAFile], filesData[rootCAFile], nil, imgs) manifests := []struct { name string diff --git a/pkg/operator/images.go b/pkg/operator/images.go index 8ce07c6742..73b4650f88 100644 --- a/pkg/operator/images.go +++ b/pkg/operator/images.go @@ -5,6 +5,7 @@ type Images struct { MachineConfigController string `json:"machineConfigController"` MachineConfigDaemon string `json:"machineConfigDaemon"` MachineConfigServer string `json:"machineConfigServer"` + MachineOSContent string `json:"machineOSContent"` Etcd string `json:"etcd"` SetupEtcdEnv string `json:"setupEtcdEnv"` } @@ -15,6 +16,7 @@ func DefaultImages() Images { MachineConfigController: "docker.io/openshift/origin-machine-config-controller:v4.0.0", MachineConfigDaemon: "docker.io/openshift/origin-machine-config-daemon:v4.0.0", MachineConfigServer: "docker.io/openshift/origin-machine-config-server:v4.0.0", + MachineOSContent: "", Etcd: "quay.io/coreos/etcd:v3.3.10", SetupEtcdEnv: "registry.svc.ci.openshift.org/openshift/origin-v4.0:setup-etcd-environment", } diff --git a/pkg/operator/operator.go b/pkg/operator/operator.go index 8a788ba1c5..f2b654f082 100644 --- a/pkg/operator/operator.go +++ b/pkg/operator/operator.go @@ -274,8 +274,9 @@ func (optr *Operator) sync(key string) error { if err != nil { return err } + imgs.MachineOSContent = osimageurl - rc := getRenderConfig(mcoconfig, etcdCA, rootCA, &v1.ObjectReference{Namespace: "kube-system", Name: "coreos-pull-secret"}, imgs, osimageurl) + rc := getRenderConfig(mcoconfig, etcdCA, rootCA, &v1.ObjectReference{Namespace: "kube-system", Name: "coreos-pull-secret"}, imgs) return optr.syncAll(rc) } @@ -335,7 +336,7 @@ func icFromClusterConfig(cm *v1.ConfigMap) (installertypes.InstallConfig, error) return ic, nil } -func getRenderConfig(mc *mcfgv1.MCOConfig, etcdCAData, rootCAData []byte, ps *v1.ObjectReference, imgs Images, osimageurl string) renderConfig { +func getRenderConfig(mc *mcfgv1.MCOConfig, etcdCAData, rootCAData []byte, ps *v1.ObjectReference, imgs Images) renderConfig { controllerconfig := mcfgv1.ControllerConfigSpec{ ClusterDNSIP: mc.Spec.ClusterDNSIP, CloudProviderConfig: mc.Spec.CloudProviderConfig, @@ -346,7 +347,7 @@ func getRenderConfig(mc *mcfgv1.MCOConfig, etcdCAData, rootCAData []byte, ps *v1 RootCAData: rootCAData, PullSecret: ps, SSHKey: mc.Spec.SSHKey, - OSImageURL: osimageurl, + OSImageURL: imgs.MachineOSContent, Images: map[string]string{ templatectrl.EtcdImageKey: imgs.Etcd, templatectrl.SetupEtcdEnvKey: imgs.SetupEtcdEnv,