Skip to content

Commit

Permalink
hack: Render config without osimageurl first too
Browse files Browse the repository at this point in the history
This is an ugly hack, better to do the config first with
osimageurl, but I don't quite understand the bootstrap code yet.
  • Loading branch information
cgwalters committed Jan 21, 2019
1 parent c8a7ce4 commit 85c1e17
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
}
Expand Down

0 comments on commit 85c1e17

Please sign in to comment.