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

patch to overload LB port on reconciliation loop #584

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
patch to overload LB port on reconciliation loop
Maelle Cabot committed Jan 17, 2024
commit 004d832f8a13603be4503b7252d182f59a6bd9e1
15 changes: 11 additions & 4 deletions controllers/vcdcluster_controller.go
Original file line number Diff line number Diff line change
@@ -9,14 +9,15 @@ import (
"context"
_ "embed"
"fmt"
"github.com/google/uuid"
rdeType "github.com/vmware/cluster-api-provider-cloud-director/pkg/vcdtypes/rde_type_1_1_0"
"net/http"
"os"
"reflect"
"strings"
"time"

"github.com/google/uuid"
rdeType "github.com/vmware/cluster-api-provider-cloud-director/pkg/vcdtypes/rde_type_1_1_0"

"github.com/antihax/optional"
"github.com/blang/semver"
"github.com/pkg/errors"
@@ -958,7 +959,13 @@ func (r *VCDClusterReconciler) reconcileLoadBalancer(ctx context.Context, vcdClu
fmt.Sprintf("%s-tcp", virtualServiceNamePrefix), fmt.Sprintf("%s-tcp", lbPoolNamePrefix), oneArm)

// TODO: ideally we should get this port from the GetLoadBalancer function
controlPlanePort := TcpPort
// Patch to overload port on reconciliation loop
var controlPlanePort int
if vcdCluster.Spec.ControlPlaneEndpoint.Port != 0 {
controlPlanePort = vcdCluster.Spec.ControlPlaneEndpoint.Port
} else {
controlPlanePort = TcpPort
}

//TODO: Sahithi: Check if error is really because of missing virtual service.
// In any other error cases, force create the new load balancer with the original control plane endpoint
@@ -972,7 +979,7 @@ func (r *VCDClusterReconciler) reconcileLoadBalancer(ctx context.Context, vcdClu
}

if vcdCluster.Spec.ControlPlaneEndpoint.Host != "" {
controlPlanePort := vcdCluster.Spec.ControlPlaneEndpoint.Port
controlPlanePort = vcdCluster.Spec.ControlPlaneEndpoint.Port
log.Info("Creating load balancer for the cluster at user-specified endpoint",
"host", vcdCluster.Spec.ControlPlaneEndpoint.Host, "port", controlPlanePort)
} else {