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

feat(percentage): use actual percentage for cookie value #6

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ jobs:
id: test-percentage-sticky-old-domain
continue-on-error: true
run: |
curl -Is localhost:80 --cookie "my_app=old_domain" | grep -i -e "server: Apache"
curl -Is localhost:80 --cookie "my_app=old_domain_50" | grep -i -e "server: Apache"

- name: Test Docker Image with Percentage Strategy with sticky cookie on new domain
id: test-percentage-sticky-new-domain
continue-on-error: true
run: |
curl -Is localhost:80 --cookie "my_app=new_domain" | grep -i -e "x-served-by: cache-"
curl -Is localhost:80 --cookie "my_app=new_domain_50" | grep -i -e "x-served-by: cache-"

- name: Test Docker Image with Percentage Strategy with round robin
id: test-percentage-round-robin
Expand Down
4 changes: 2 additions & 2 deletions haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ backend percentage_strategy
cookie "$COOKIE_PERCENTAGE_NAME" insert indirect

# old domain
server-template old_domain_percentage "$SERVER_COUNT" "$OLD_DOMAIN" cookie old_domain weight "$PERCENTAGE_OLD"
server-template old_domain_percentage "$SERVER_COUNT" "$OLD_DOMAIN" cookie "old_domain_$PERCENTAGE_OLD" weight "$PERCENTAGE_OLD"

# new domain
server-template new_domain_percentage "$SERVER_COUNT" "$NEW_DOMAIN" cookie new_domain weight "$PERCENTAGE_NEW"
server-template new_domain_percentage "$SERVER_COUNT" "$NEW_DOMAIN" cookie "new_domain_$PERCENTAGE_NEW" weight "$PERCENTAGE_NEW"

backend cookie_strategy
balance leastconn
Expand Down