Skip to content

Commit 77ed063

Browse files
committed
operator: Add bootstrap arg --machine-config-oscontent-image
This will allow the installer to render the payload's osImageURL ConfigMap in the initial MachineConfig as well. Closes: #334
1 parent 71ace53 commit 77ed063

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

cmd/machine-config-operator/bootstrap.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var (
2929
rootCAFile string
3030
pullSecretFile string
3131
configFile string
32+
oscontentImage string
3233
imagesConfigMapFile string
3334
mccImage string
3435
mcsImage string
@@ -49,6 +50,7 @@ func init() {
4950
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.mccImage, "machine-config-controller-image", "", "Image for Machine Config Controller. (this overrides the image from --images-json-configmap)")
5051
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.mcsImage, "machine-config-server-image", "", "Image for Machine Config Server. (this overrides the image from --images-json-configmap)")
5152
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.mcdImage, "machine-config-daemon-image", "", "Image for Machine Config Daemon. (this overrides the image from --images-json-configmap)")
53+
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.oscontentImage, "machine-config-oscontent-image", "", "Image for osImageURL")
5254
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.etcdImage, "etcd-image", "", "Image for Etcd. (this overrides the image from --images-json-configmap)")
5355
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.setupEtcdEnvImage, "setup-etcd-env-image", "", "Image for Setup Etcd Environment. (this overrides the image from --images-json-configmap)")
5456
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.configFile, "config-file", "", "ClusterConfig ConfigMap file.")
@@ -94,6 +96,10 @@ func runBootstrapCmd(cmd *cobra.Command, args []string) {
9496
if bootstrapOpts.setupEtcdEnvImage != "" {
9597
imgs.SetupEtcdEnv = bootstrapOpts.setupEtcdEnvImage
9698
}
99+
if bootstrapOpts.oscontentImage != "" {
100+
imgs.MachineOSContent = bootstrapOpts.oscontentImage
101+
}
102+
97103
if err := operator.RenderBootstrap(
98104
bootstrapOpts.configFile,
99105
bootstrapOpts.etcdCAFile, bootstrapOpts.rootCAFile, bootstrapOpts.pullSecretFile,

pkg/operator/bootstrap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func RenderBootstrap(
4242
return fmt.Errorf("error discovering MCOConfig from %q: %v", clusterConfigConfigMapFile, err)
4343
}
4444

45-
config := getRenderConfig(mcoconfig, filesData[etcdCAFile], filesData[rootCAFile], nil, imgs, "")
45+
config := getRenderConfig(mcoconfig, filesData[etcdCAFile], filesData[rootCAFile], nil, imgs)
4646

4747
manifests := []struct {
4848
name string

pkg/operator/images.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ type Images struct {
55
MachineConfigController string `json:"machineConfigController"`
66
MachineConfigDaemon string `json:"machineConfigDaemon"`
77
MachineConfigServer string `json:"machineConfigServer"`
8+
MachineOSContent string `json:"machineOSContent"`
89
Etcd string `json:"etcd"`
910
SetupEtcdEnv string `json:"setupEtcdEnv"`
1011
}
@@ -15,6 +16,7 @@ func DefaultImages() Images {
1516
MachineConfigController: "docker.io/openshift/origin-machine-config-controller:v4.0.0",
1617
MachineConfigDaemon: "docker.io/openshift/origin-machine-config-daemon:v4.0.0",
1718
MachineConfigServer: "docker.io/openshift/origin-machine-config-server:v4.0.0",
19+
MachineOSContent: "",
1820
Etcd: "quay.io/coreos/etcd:v3.3.10",
1921
SetupEtcdEnv: "registry.svc.ci.openshift.org/openshift/origin-v4.0:setup-etcd-environment",
2022
}

pkg/operator/operator.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,9 @@ func (optr *Operator) sync(key string) error {
274274
if err != nil {
275275
return err
276276
}
277+
imgs.MachineOSContent = osimageurl
277278

278-
rc := getRenderConfig(mcoconfig, etcdCA, rootCA, &v1.ObjectReference{Namespace: "kube-system", Name: "coreos-pull-secret"}, imgs, osimageurl)
279+
rc := getRenderConfig(mcoconfig, etcdCA, rootCA, &v1.ObjectReference{Namespace: "kube-system", Name: "coreos-pull-secret"}, imgs)
279280
return optr.syncAll(rc)
280281
}
281282

@@ -335,7 +336,7 @@ func icFromClusterConfig(cm *v1.ConfigMap) (installertypes.InstallConfig, error)
335336
return ic, nil
336337
}
337338

338-
func getRenderConfig(mc *mcfgv1.MCOConfig, etcdCAData, rootCAData []byte, ps *v1.ObjectReference, imgs Images, osimageurl string) renderConfig {
339+
func getRenderConfig(mc *mcfgv1.MCOConfig, etcdCAData, rootCAData []byte, ps *v1.ObjectReference, imgs Images) renderConfig {
339340
controllerconfig := mcfgv1.ControllerConfigSpec{
340341
ClusterDNSIP: mc.Spec.ClusterDNSIP,
341342
CloudProviderConfig: mc.Spec.CloudProviderConfig,
@@ -346,7 +347,7 @@ func getRenderConfig(mc *mcfgv1.MCOConfig, etcdCAData, rootCAData []byte, ps *v1
346347
RootCAData: rootCAData,
347348
PullSecret: ps,
348349
SSHKey: mc.Spec.SSHKey,
349-
OSImageURL: osimageurl,
350+
OSImageURL: imgs.MachineOSContent,
350351
Images: map[string]string{
351352
templatectrl.EtcdImageKey: imgs.Etcd,
352353
templatectrl.SetupEtcdEnvKey: imgs.SetupEtcdEnv,

0 commit comments

Comments
 (0)