Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "" for "unspecified OS", tweak comments #196

Merged
merged 1 commit into from
Dec 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,6 @@ func generateMachineConfigForRole(config *renderConfig, roleName string, roleDir
const (
machineConfigNameTmpl = "00-%s"
machineConfigRoleLabelKey = "machineconfiguration.openshift.io/role"

// DefaultOSImageURL is the value used for OSImageURL field.
// TODO: this might have to be configured using ControllerConfig.
DefaultOSImageURL = "://dummy"
)

func machineConfigFromIgnConfig(role string, ignCfg *ignv2_2types.Config) *mcfgv1.MachineConfig {
Expand All @@ -220,7 +216,7 @@ func machineConfigFromIgnConfig(role string, ignCfg *ignv2_2types.Config) *mcfgv
Name: name,
},
Spec: mcfgv1.MachineConfigSpec{
OSImageURL: DefaultOSImageURL,
OSImageURL: "",
Config: *ignCfg,
},
}
Expand Down
15 changes: 11 additions & 4 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,19 @@ func (dn *Daemon) isDesiredMachineState() (bool, string, error) {
return false, "", nil
}

// isUnspecifiedOS says whether an osImageURL is "unspecified",
// i.e. we should not try to change the current state.
func (dn *Daemon) isUnspecifiedOS(osImageURL string) bool {
// The ://dummy syntax is legacy
return osImageURL == "" || osImageURL == "://dummy";
}

// checkOS validates the OS image URL and returns true if they match.
func (dn *Daemon) checkOS(osImageURL string) (bool, error) {
// XXX: The installer doesn't pivot yet so for now, just make "://dummy"
// match anything. See also: https://github.com/openshift/installer/issues/281
if osImageURL == "://dummy" {
glog.Warningf(`Working around "://dummy" OS image URL until installer ➰ pivots`)
// XXX: The installer doesn't pivot yet so for now, just make ""
// mean "unset, don't pivot". See also: https://github.com/openshift/installer/issues/281
if dn.isUnspecifiedOS(osImageURL) {
glog.Infof(`No target osImageURL provided`)
return true, nil
}
return dn.bootedOSImageURL == osImageURL, nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ func (dn *Daemon) updateOS(oldConfig, newConfig *mcfgv1.MachineConfig) error {
return nil
}
// see similar logic in checkOS()
if newConfig.Spec.OSImageURL == "://dummy" {
glog.Warningf(`Working around "://dummy" OS image URL until installer ➰ pivots`)
if dn.isUnspecifiedOS(newConfig.Spec.OSImageURL) {
glog.Infof(`No target osImageURL provided`)
return nil
}

Expand Down