Support switching "target_backend" on HAProxy#814
Merged
Conversation
alexarefev
reviewed
Jun 1, 2026
Collaborator
alexarefev
left a comment
There was a problem hiding this comment.
Do we need to check if the ingress and envoy target ports are intersecting?
Collaborator
Author
If both nginx and envoy are installed, then specifying same ports for both of them definitely would be strange and could lead to issues. I will add some check which verifies that if both are installed, then target ports should be different UPD: added check |
alexarefev
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently KubeMarine supports switching between "nginx" and "envoy" on "services.loadbalancer.target_backend" cluster.yaml property, however, actual change happens not in HAProxy configuration, but in nginx/envoy configuration - they move hostPorts 20080/20443 between each other to determine who will be the target backend. This causes problems, since we want to be able to switch between nginx/envoy quickly and with minimal impact (and probably do it multiple times in both direction). Redeploying plugins is too impacting in this case. Thus, we need to implement this switching through HAProxy re-configuration, swapping between ports 20080/20443 (nginx) and 21080/21443 (envoy).
Solution
Describe solution. List all changes that you made during implementation.
envoy_httpandenvoy_httpsto cluster.yaml sectionservices.loadbalancer.target_portswith default values 21080 and 21443. These are used by envoy plugin as hostPorts, similar to nginx 20080/20443 ports.target_backendis now used by HAProxy configuration to determine which pair of ports (nginx 20080/20443 or envoy 21080/21443) to use as backendHow to apply
deploy.pluginsTest Cases
services.loadbalancertarget_backendandtarget_ports, with both ingress-nginx and envoy-gateway plugins enabled (do not provide custom ports configuration in cluster.yaml)curl -kv https://$LB_IPservices.loadbalancer.target_backendtoenvoyand run install taskdeploy.loadbalancer.haproxy.configureto reconfigure HAProxy specificallycurl -kv https://$LB_IPChecklist