diff --git a/pkg/asset/ignition/bootstrap.go b/pkg/asset/ignition/bootstrap.go index 5911facf0bf..71965f7fcd6 100644 --- a/pkg/asset/ignition/bootstrap.go +++ b/pkg/asset/ignition/bootstrap.go @@ -26,17 +26,17 @@ const ( // bootstrapTemplateData is the data to use to replace values in bootstrap // template files. type bootstrapTemplateData struct { - ClusterDNSIP string - CloudProvider string - CloudProviderConfig string - DebugConfig string - KubeCoreRenderImage string - MachineConfigOperatorImage string - EtcdCertSignerImage string - EtcdctlImage string - BootkubeImage string - HyperkubeImage string - EtcdCluster string + BootkubeImage string + CloudProvider string + CloudProviderConfig string + ClusterDNSIP string + DebugConfig string + EtcdCertSignerImage string + EtcdCluster string + EtcdctlImage string + HyperkubeImage string + KubeCoreRenderImage string + ReleaseImage string } // bootstrap is an asset that generates the ignition config for bootstrap nodes. @@ -189,17 +189,17 @@ func (a *bootstrap) getTemplateData(installConfig *types.InstallConfig) (*bootst etcdEndpoints[i] = fmt.Sprintf("https://%s-etcd-%d.%s:2379", installConfig.Name, i, installConfig.BaseDomain) } return &bootstrapTemplateData{ - ClusterDNSIP: clusterDNSIP, - CloudProvider: getCloudProvider(installConfig), - CloudProviderConfig: getCloudProviderConfig(installConfig), - DebugConfig: "", - KubeCoreRenderImage: "quay.io/coreos/kube-core-renderer-dev:3b6952f5a1ba89bb32dd0630faddeaf2779c9a85", - MachineConfigOperatorImage: "docker.io/openshift/origin-machine-config-operator:v4.0.0", - EtcdCertSignerImage: "quay.io/coreos/kube-etcd-signer-server:678cc8e6841e2121ebfdb6e2db568fce290b67d6", - EtcdctlImage: "quay.io/coreos/etcd:v3.2.14", - BootkubeImage: "quay.io/coreos/bootkube:v0.10.0", - HyperkubeImage: "openshift/origin-node:latest", - EtcdCluster: strings.Join(etcdEndpoints, ","), + ClusterDNSIP: clusterDNSIP, + CloudProvider: getCloudProvider(installConfig), + CloudProviderConfig: getCloudProviderConfig(installConfig), + DebugConfig: "", + KubeCoreRenderImage: "quay.io/coreos/kube-core-renderer-dev:3b6952f5a1ba89bb32dd0630faddeaf2779c9a85", + EtcdCertSignerImage: "quay.io/coreos/kube-etcd-signer-server:678cc8e6841e2121ebfdb6e2db568fce290b67d6", + EtcdctlImage: "quay.io/coreos/etcd:v3.2.14", + BootkubeImage: "quay.io/coreos/bootkube:v0.10.0", + ReleaseImage: "registry.svc.ci.openshift.org/openshift/origin-release:v4.0", + HyperkubeImage: "openshift/origin-node:latest", + EtcdCluster: strings.Join(etcdEndpoints, ","), }, nil } @@ -233,7 +233,7 @@ func (a *bootstrap) addBootkubeFiles(config *ignition.Config, dependencies map[a func (a *bootstrap) addTectonicFiles(config *ignition.Config, dependencies map[asset.Asset]*asset.State, templateData *bootstrapTemplateData) { config.Storage.Files = append( config.Storage.Files, - fileFromString("/opt/tectonic/tectonic.sh", 0555, content.TectonicShFileContents), + fileFromString("/opt/tectonic/tectonic.sh", 0555, applyTemplateData(content.TectonicShFileTemplate, templateData)), ) config.Storage.Files = append( config.Storage.Files, diff --git a/pkg/asset/ignition/content/bootkube.go b/pkg/asset/ignition/content/bootkube.go index e38b1b2b2ae..34febb2b76e 100644 --- a/pkg/asset/ignition/content/bootkube.go +++ b/pkg/asset/ignition/content/bootkube.go @@ -29,6 +29,9 @@ set -e mkdir --parents /etc/kubernetes/manifests/ +MACHINE_CONFIG_OPERATOR_IMAGE=$(podman run --rm {{.ReleaseImage}} image machine-config-operator) +echo "Found Machine Config Operator's image: $MACHINE_CONFIG_OPERATOR_IMAGE" + if [ ! -d kco-bootstrap ] then echo "Rendering Kubernetes core manifests..." @@ -54,7 +57,7 @@ then podman run \ --user 0 \ --volume "$PWD:/assets:z" \ - "{{.MachineConfigOperatorImage}}" \ + "${MACHINE_CONFIG_OPERATOR_IMAGE}" \ bootstrap \ --etcd-ca=/assets/tls/etcd-client-ca.crt \ --root-ca=/assets/tls/root-ca.crt \ diff --git a/pkg/asset/ignition/content/tectonic.go b/pkg/asset/ignition/content/tectonic.go index 635d2bc35cd..019dafe400d 100644 --- a/pkg/asset/ignition/content/tectonic.go +++ b/pkg/asset/ignition/content/tectonic.go @@ -1,5 +1,9 @@ package content +import ( + "text/template" +) + const ( // TectonicSystemdContents is a service that runs tectonic on the masters. TectonicSystemdContents = `[Unit] @@ -17,10 +21,12 @@ RestartSec=5s [Install] WantedBy=multi-user.target` +) - // TectonicShFileContents is a script file for running tectonic on bootstrap +var ( + // TectonicShFileTemplate is a script file for running tectonic on bootstrap // nodes. - TectonicShFileContents = `#!/usr/bin/env bash + TectonicShFileTemplate = template.Must(template.New("tectonic.sh").Parse(`#!/usr/bin/env bash set -e KUBECONFIG="$1" @@ -77,6 +83,14 @@ wait_for_pods() { set -e } +echo "Rendering release-payload manifests..." +# shellcheck disable=SC2154 +podman run \ + --volume "$PWD:/assets:z" \ + "{{.ReleaseImage}}" \ + --output-dir=/assets \ + --release-image="{{.ReleaseImage}}" + # Wait for Kubernetes pods wait_for_pods kube-system @@ -90,5 +104,5 @@ done # Wait for Tectonic pods wait_for_pods tectonic-system -echo "Tectonic installation is done"` +echo "Tectonic installation is done"`)) )