Skip to content

Commit

Permalink
ignition/bootstrap: add CVO render
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavdahiya committed Sep 26, 2018
1 parent 0c7c772 commit 4c573dd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 27 deletions.
46 changes: 23 additions & 23 deletions pkg/asset/ignition/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion pkg/asset/ignition/content/bootkube.go
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand All @@ -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 \
Expand Down
20 changes: 17 additions & 3 deletions pkg/asset/ignition/content/tectonic.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package content

import (
"text/template"
)

const (
// TectonicSystemdContents is a service that runs tectonic on the masters.
TectonicSystemdContents = `[Unit]
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -90,5 +104,5 @@ done
# Wait for Tectonic pods
wait_for_pods tectonic-system
echo "Tectonic installation is done"`
echo "Tectonic installation is done"`))
)

0 comments on commit 4c573dd

Please sign in to comment.