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

haproxy: T6179: fix rule generation #3382

Merged
merged 1 commit into from
May 1, 2024
Merged

haproxy: T6179: fix rule generation #3382

merged 1 commit into from
May 1, 2024

Conversation

nvollmar
Copy link
Contributor

Change Summary

Fix config generation for different combinations of set-backend/redirect-location

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

https://vyos.dev/T6179

Related PR(s)

None

Component(s) name

load-balancing

Proposed changes

path acl rules (and domain_name for that matter) can be used with both set-backend or redirect-location
(https://www.haproxy.com/blog/path-based-routing-with-haproxy has an example with set-backend)

How to test

set load-balancing reverse-proxy service foo port '4443'
set load-balancing reverse-proxy service foo rule 10 set backend 'bk01'
set load-balancing reverse-proxy service foo rule 10 url-path end '/local'
set load-balancing reverse-proxy backend bk01 server s1 address '192.0.2.1'
set load-balancing reverse-proxy backend bk01 server s1 port '4443'

should yield the frontend config config:

# Frontend
frontend foo
    bind :::4443 v4v6  
    # rule 10
    acl 10 path -i -m end /local
    use_backend bk01 if 10

Smoketest result

$ /usr/libexec/vyos/tests/smoke/cli/test_load-balancing_reverse-proxy.py
test_01_lb_reverse_proxy_domain (__main__.TestLoadBalancingReverseProxy.test_01_lb_reverse_proxy_domain) ... ok
test_02_lb_reverse_proxy_cert_not_exists (__main__.TestLoadBalancingReverseProxy.test_02_lb_reverse_proxy_cert_not_exists) ... 
PKI does not contain any certificates!


Certificate "cert" not found in configuration!

ok
test_03_lb_reverse_proxy_ca_not_exists (__main__.TestLoadBalancingReverseProxy.test_03_lb_reverse_proxy_ca_not_exists) ... ok
test_04_lb_reverse_proxy_backend_ssl_no_verify (__main__.TestLoadBalancingReverseProxy.test_04_lb_reverse_proxy_backend_ssl_no_verify) ... 
backend bk-01 cannot have both ssl options no-verify and ca-certificate
set!

ok
test_05_lb_reverse_proxy_backend_http_check (__main__.TestLoadBalancingReverseProxy.test_05_lb_reverse_proxy_backend_http_check) ... ok
test_06_lb_reverse_proxy_tcp_mode (__main__.TestLoadBalancingReverseProxy.test_06_lb_reverse_proxy_tcp_mode) ... ok

----------------------------------------------------------------------
Ran 6 tests in 86.712s

OK

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro, sever-sever and c-po and removed request for a team April 30, 2024 20:40
Copy link
Member

@sever-sever sever-sever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fix

@c-po c-po merged commit 3580bbb into vyos:current May 1, 2024
9 checks passed
@c-po
Copy link
Member

c-po commented May 1, 2024

@Mergifyio backport sagitta

Copy link
Contributor

mergify bot commented May 1, 2024

backport Sagitta

❌ No backport have been created

  • Backport to branch Sagitta failed

GitHub error: Branch not found

Copy link
Contributor

mergify bot commented May 1, 2024

backport sagitta

✅ Backports have been created

@nvollmar nvollmar deleted the T6179 branch May 1, 2024 06:40
c-po added a commit that referenced this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants