Skip to content

Unable to Configure Multiple Backends on the Same Port in TCP CRD #666

@Raj-prateek

Description

@Raj-prateek

We are experiencing an issue with the TCP Custom Resource Definition (CRD) in HAProxy. Specifically, we are unable to configure multiple backends on the same port. This functionality is crucial for our use case where we need to route traffic to different backends based on specific criteria (e.g., SNI).

What we want?

global
    log stdout format raw local0
    maxconn 2000

defaults
    log global
    mode tcp
    option tcplog
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend ft_tcp
    bind *:8000
    mode tcp
    tcp-request inspect-delay 5s
    tcp-request content accept if { req_ssl_hello_type 1 }

    acl host_backend1 req_ssl_sni -i backend1.example.com
    acl host_backend2 req_ssl_sni -i backend2.example.com

    use_backend bk_tcp_backend1 if host_backend1
    use_backend bk_tcp_backend2 if host_backend2

backend bk_tcp_backend1
    mode tcp
    option independent_streams
    timeout tunnel 1h
    server srv1 10.0.0.1:443 check
    server srv2 10.0.0.2:443 check

backend bk_tcp_backend2
    mode tcp
    option independent_streams
    timeout tunnel 30m
    server srv1 10.0.0.3:443 check
    server srv2 10.0.0.4:443 check

But current tcp crd configuration are stricly binded to 1 service which is making it impossible to do the change.

apiVersion: ingress.v1.haproxy.org/v1
kind: TCP
metadata:
  name: example-service1-tcp
spec:
  - name: example-tcp
    frontend:
      name: example-frontend
      binds:
        - name: bind1
          port: 8000
    service:
      name: example-service1
      port: 3000

Can you please suggest any example?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions