Skip to content

Commit

Permalink
AGENT-337: Support both VIP and VIPs in AgentClusterInstall
Browse files Browse the repository at this point in the history
The assisted-service is deprecating support for the singular APIVIP/IngressVIP
in openshift/assisted-service#5501. When that merges
it will break the agent-installer since currently APIVIP is set when only
one VIP is configured. This change sets both API/Ingress VIP and VIPs and
will work before and after the assisted-service change merges.
Note that as a follow-on, openshift#7574
will remove the multiple settings from install-config override which are
not needed after the assisted-service change.
  • Loading branch information
bfournie authored and jhixson74 committed Nov 30, 2023
1 parent d5e2150 commit d5c8cad
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
Expand Up @@ -53,11 +53,15 @@ metadata:
namespace: cluster0
spec:
apiVIP: 192.168.111.5
apiVIPs:
- 192.168.111.5
clusterDeploymentRef:
name: ostest
imageSetRef:
name: openshift-was not built correctly
ingressVIP: 192.168.111.4
ingressVIPs:
- 192.168.111.4
networking:
clusterNetwork:
- cidr: 10.128.0.0/14
Expand All @@ -76,4 +80,4 @@ status:
eventsURL: ""
logsURL: ""
progress:
totalPercentage: 0
totalPercentage: 0
Expand Up @@ -73,11 +73,15 @@ metadata:
namespace: cluster0
spec:
apiVIP: 192.168.111.5
apiVIPs:
- 192.168.111.5
clusterDeploymentRef:
name: ostest
imageSetRef:
name: openshift-was not built correctly
ingressVIP: 192.168.111.4
ingressVIPs:
- 192.168.111.4
networking:
clusterNetwork:
- cidr: 10.128.0.0/14
Expand All @@ -96,4 +100,4 @@ status:
eventsURL: ""
logsURL: ""
progress:
totalPercentage: 0
totalPercentage: 0
4 changes: 4 additions & 0 deletions pkg/asset/agent/manifests/agentclusterinstall.go
Expand Up @@ -201,6 +201,8 @@ func (a *AgentClusterInstall) Generate(dependencies asset.Parents) error {
}
agentClusterInstall.Spec.APIVIP = installConfig.Config.Platform.BareMetal.APIVIPs[0]
agentClusterInstall.Spec.IngressVIP = installConfig.Config.Platform.BareMetal.IngressVIPs[0]
agentClusterInstall.Spec.APIVIPs = installConfig.Config.Platform.BareMetal.APIVIPs
agentClusterInstall.Spec.IngressVIPs = installConfig.Config.Platform.BareMetal.IngressVIPs
} else if installConfig.Config.Platform.VSphere != nil {
vspherePlatform := vsphere.Platform{}
if len(installConfig.Config.Platform.VSphere.APIVIPs) > 1 {
Expand Down Expand Up @@ -229,6 +231,8 @@ func (a *AgentClusterInstall) Generate(dependencies asset.Parents) error {
}
agentClusterInstall.Spec.APIVIP = installConfig.Config.Platform.VSphere.APIVIPs[0]
agentClusterInstall.Spec.IngressVIP = installConfig.Config.Platform.VSphere.IngressVIPs[0]
agentClusterInstall.Spec.APIVIPs = installConfig.Config.Platform.VSphere.APIVIPs
agentClusterInstall.Spec.IngressVIPs = installConfig.Config.Platform.VSphere.IngressVIPs
} else if installConfig.Config.Platform.External != nil {
icOverridden = true
icOverrides.Platform = &agentClusterInstallPlatform{
Expand Down
6 changes: 6 additions & 0 deletions pkg/asset/agent/manifests/agentclusterinstall_test.go
Expand Up @@ -46,6 +46,8 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
goodACIDualStackVIPs.SetAnnotations(map[string]string{
installConfigOverrides: `{"platform":{"baremetal":{"apiVIPs":["192.168.122.10","2001:db8:1111:2222:ffff:ffff:ffff:cafe"],"ingressVIPs":["192.168.122.11","2001:db8:1111:2222:ffff:ffff:ffff:dead"]}}}`,
})
goodACIDualStackVIPs.Spec.APIVIPs = []string{"192.168.122.10", "2001:db8:1111:2222:ffff:ffff:ffff:cafe"}
goodACIDualStackVIPs.Spec.IngressVIPs = []string{"192.168.122.11", "2001:db8:1111:2222:ffff:ffff:ffff:dead"}

installConfigWithCapabilities := getValidOptionalInstallConfig()
installConfigWithCapabilities.Config.Capabilities = &types.Capabilities{
Expand Down Expand Up @@ -87,6 +89,8 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
goodExternalPlatformACI := getGoodACI()
goodExternalPlatformACI.Spec.APIVIP = ""
goodExternalPlatformACI.Spec.IngressVIP = ""
goodExternalPlatformACI.Spec.APIVIPs = nil
goodExternalPlatformACI.Spec.IngressVIPs = nil
val := true
goodExternalPlatformACI.Spec.Networking.UserManagedNetworking = &val
goodExternalPlatformACI.Spec.PlatformType = hiveext.ExternalPlatformType
Expand All @@ -108,6 +112,8 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
goodExternalOCIPlatformACI := getGoodACI()
goodExternalOCIPlatformACI.Spec.APIVIP = ""
goodExternalOCIPlatformACI.Spec.IngressVIP = ""
goodExternalOCIPlatformACI.Spec.APIVIPs = nil
goodExternalOCIPlatformACI.Spec.IngressVIPs = nil
val = true
goodExternalOCIPlatformACI.Spec.Networking.UserManagedNetworking = &val
goodExternalOCIPlatformACI.Spec.PlatformType = hiveext.ExternalPlatformType
Expand Down
2 changes: 2 additions & 0 deletions pkg/asset/agent/manifests/util_test.go
Expand Up @@ -417,6 +417,8 @@ func getGoodACI() *hiveext.AgentClusterInstall {
},
APIVIP: "192.168.122.10",
IngressVIP: "192.168.122.11",
APIVIPs: []string{"192.168.122.10"},
IngressVIPs: []string{"192.168.122.11"},
PlatformType: hiveext.BareMetalPlatformType,
},
}
Expand Down

0 comments on commit d5c8cad

Please sign in to comment.