Skip to content

Commit

Permalink
fixup! use better code from suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoshkin committed Dec 5, 2024
1 parent 09e5e62 commit 47f91f4
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,14 @@ func templateValues(

// If specified, use the virtual IP address and/or port,
// otherwise fall back to the control plane endpoint host and port.
address := controlPlaneEndpoint.Host
port := controlPlaneEndpoint.Port
var virtualIPConfig v1alpha1.ControlPlaneVirtualIPConfiguration
if controlPlaneEndpoint.VirtualIPSpec != nil &&
controlPlaneEndpoint.VirtualIPSpec.Configuration != nil {
address = cmp.Or(
controlPlaneEndpoint.VirtualIPSpec.Configuration.Address,
controlPlaneEndpoint.Host,
)
port = cmp.Or(
controlPlaneEndpoint.VirtualIPSpec.Configuration.Port,
controlPlaneEndpoint.Port,
)
virtualIPConfig = *controlPlaneEndpoint.VirtualIPSpec.Configuration
}
templateInput := input{
Address: address,
Port: port,
Address: cmp.Or(virtualIPConfig.Address, controlPlaneEndpoint.Host),
Port: cmp.Or(virtualIPConfig.Port, controlPlaneEndpoint.Port),
}

var b bytes.Buffer
Expand Down

0 comments on commit 47f91f4

Please sign in to comment.