Skip to content
Merged
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
12 changes: 6 additions & 6 deletions pkg/asset/ignition/machine/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import (
// served by the machine config server.
func pointerIgnitionConfig(installConfig *types.InstallConfig, rootCA []byte, role string) *ignition.Config {
var ignitionHost string
// Default platform independent ignitionHost
ignitionHost = fmt.Sprintf("api-int.%s:22623", installConfig.ClusterDomain())
// Update ignitionHost as necessary for platform
switch installConfig.Platform.Name() {
case baremetaltypes.Name:
// Baremetal needs to point directly at the VIP because we don't have a
Expand All @@ -29,17 +32,14 @@ func pointerIgnitionConfig(installConfig *types.InstallConfig, rootCA []byte, ro
apiVIP, err := openstackdefaults.APIVIP(installConfig.Networking)
if err == nil {
ignitionHost = net.JoinHostPort(apiVIP.String(), "22623")
} else {
ignitionHost = fmt.Sprintf("api-int.%s:22623", installConfig.ClusterDomain())
}
case ovirttypes.Name:
ignitionHost = net.JoinHostPort(installConfig.Ovirt.APIVIP, "22623")
case vspheretypes.Name:
ignitionHost = net.JoinHostPort(installConfig.VSphere.APIVIP, "22623")
default:
ignitionHost = fmt.Sprintf("api-int.%s:22623", installConfig.ClusterDomain())
if installConfig.VSphere.APIVIP != "" {
ignitionHost = net.JoinHostPort(installConfig.VSphere.APIVIP, "22623")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else {
ignitionHost = fmt.Sprintf("api-int.%s:22623", installConfig.ClusterDomain())
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about fallthrough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opted against fallthrough and set default to reduce duplicating code with more else.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If VIP is an IP, need to future-proof for IPV6? net.JoinHostPort() per #2916

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased and updated.

}

return &ignition.Config{
Ignition: ignition.Ignition{
Version: ignition.MaxVersion.String(),
Expand Down