From 85c1e17f77bba3b02fc2e8f601064505510a887e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 19 Jan 2019 20:12:15 +0000 Subject: [PATCH] hack: Render config without osimageurl first too This is an ugly hack, better to do the config first with osimageurl, but I don't quite understand the bootstrap code yet. --- pkg/controller/template/render.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/controller/template/render.go b/pkg/controller/template/render.go index e7f3c5dabf..9882bd1211 100644 --- a/pkg/controller/template/render.go +++ b/pkg/controller/template/render.go @@ -142,6 +142,9 @@ func machineConfigForOSImageURL(role string, url string) *mcfgv1.MachineConfig { } } +// Temporary hack +var doneInitialRender map[string]bool + // generateDerivedMachineConfigs is part of generateMachineConfigsForRole. It // takes care of generating MachineConfig objects which are derived from other // components of the cluster configuration. Currently, that's: @@ -159,9 +162,17 @@ func generateDerivedMachineConfigs(config *RenderConfig, role string) ([]*mcfgv1 sshConfigName := "00-" + role + "-ssh" cfgs = append(cfgs, MachineConfigFromIgnConfig(role, sshConfigName, &tempIgnConfig)) - if config.OSImageURL != "" { + if doneInitialRender == nil { + doneInitialRender = make(map[string]bool) + } + + isFirstRun := !doneInitialRender[role] + if config.OSImageURL != "" && !isFirstRun { cfgs = append(cfgs, machineConfigForOSImageURL(role, config.OSImageURL)) } + if isFirstRun { + doneInitialRender[role] = true + } return cfgs, nil }