Skip to content

Commit

Permalink
set loadBalancerPolicy per route
Browse files Browse the repository at this point in the history
  • Loading branch information
therealak12 committed Jun 22, 2023
1 parent 5e6a422 commit a482d04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
envFrom:
- configMapRef:
name: route-to-httpproxy-config
image: ghcr.io/snapp-incubator/route-to-contour-httpproxy:1.2.4
image: ghcr.io/snapp-incubator/route-to-contour-httpproxy:1.2.5
name: manager
livenessProbe:
httpGet:
Expand Down
10 changes: 5 additions & 5 deletions internal/controller/route/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,6 @@ func (r *RouteReconciler) assembleHttpproxy(ctx context.Context, owner *routev1.
}
}

loadBalancerPolicy, err := utils.GetLoadBalancerPolicy(owner)
if err != nil {
return nil, fmt.Errorf("failed to get loadbalancer policy: %w", err)
}

// use `tcpproxy` for passthrough mode and `routes` for other termination modes
if owner.Spec.TLS != nil && owner.Spec.TLS.Termination == "passthrough" {
httpproxy.Spec.TCPProxy = &contourv1.TCPProxy{}
Expand All @@ -332,6 +327,11 @@ func (r *RouteReconciler) assembleHttpproxy(ctx context.Context, owner *routev1.
}
} else {
for _, sameRoute := range sameHostRoutes {
loadBalancerPolicy, err := utils.GetLoadBalancerPolicy(&sameRoute)
if err != nil {
return nil, fmt.Errorf("failed to get loadbalancer policy: %w", err)
}

ports, err := r.getTargetPorts(ctx, &sameRoute)
if err != nil {
return nil, fmt.Errorf("failed to get route target port, %v", err)
Expand Down

0 comments on commit a482d04

Please sign in to comment.