Skip to content

Commit 777f75a

Browse files
Merge pull request #9249 from elfosardo/OCPBUGS-45175
OCPBUGS-45175: Ironic external url port should change based on protocol
2 parents 0d294cf + 31f8ed8 commit 777f75a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/asset/ignition/bootstrap/baremetal/template.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ func externalURLs(apiVIPs []string, protocol string) (externalURLv4 string, exte
9595
if len(apiVIPs) > 1 {
9696
// IPv6 BMCs may not be able to reach IPv4 servers, use the right callback URL for them.
9797
// Warning: when backporting to 4.12 or earlier, change the port to 80!
98-
externalURL := fmt.Sprintf("%s://%s/", protocol, net.JoinHostPort(apiVIPs[1], "6180"))
98+
port := "6180"
99+
if protocol == "https" {
100+
port = "6183"
101+
}
102+
externalURL := fmt.Sprintf("%s://%s/", protocol, net.JoinHostPort(apiVIPs[1], port))
99103
if utilsnet.IsIPv6String(apiVIPs[1]) {
100104
externalURLv6 = externalURL
101105
}

pkg/asset/ignition/bootstrap/baremetal/template_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func TestTemplatingManagedIPv6(t *testing.T) {
5959
ProvisioningDHCPRange: "fd2e:6f44:5dd8:b856::1,fd2e:6f44:5dd8::ff",
6060
BootstrapProvisioningIP: "fd2e:6f44:5dd8:b856::2",
6161
ProvisioningNetwork: baremetal.ManagedProvisioningNetwork,
62+
APIVIPs: []string{"53.78.144.26", "d601:602e:6397:a048:f516:dc63:1e83:fcaa"},
6263
}
6364
openshiftDependency := []asset.Asset{
6465
&manifests.Openshift{},
@@ -74,6 +75,7 @@ func TestTemplatingManagedIPv6(t *testing.T) {
7475
assert.Equal(t, result.ProvisioningIP, "fd2e:6f44:5dd8:b856::2")
7576
assert.Equal(t, result.IronicUsername, "bootstrap-ironic-user")
7677
assert.Equal(t, result.IronicPassword, "passw0rd")
78+
assert.Equal(t, result.ExternalURLv6, "https://[d601:602e:6397:a048:f516:dc63:1e83:fcaa]:6183/")
7779
}
7880

7981
func TestTemplatingUnmanagedIPv6(t *testing.T) {
@@ -97,4 +99,5 @@ func TestTemplatingUnmanagedIPv6(t *testing.T) {
9799
assert.Equal(t, result.ProvisioningDHCPAllowList, "")
98100
assert.Equal(t, result.IronicUsername, "bootstrap-ironic-user")
99101
assert.Equal(t, result.IronicPassword, "passw0rd")
102+
assert.Equal(t, result.ExternalURLv6, "")
100103
}

0 commit comments

Comments
 (0)