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

sessionAffinity stickiness communication #1532

Open
takezyou opened this issue Oct 6, 2023 · 2 comments
Open

sessionAffinity stickiness communication #1532

takezyou opened this issue Oct 6, 2023 · 2 comments

Comments

@takezyou
Copy link

takezyou commented Oct 6, 2023

Describe the feature

I would like to solve one problem with sessionAffinity functionality.

Canary status:

  • Stop canary releases at a certain percentage for a certain period of time.
  • primary weighs 50% and canary weighs 50%.

If sessionAffinity is enabled in this state, a cookie will be given when traffic flows to canary, and canary traffic will increase. Therefore, the traffic will gradually stop flowing to the primary.

I would like to achieve stickiness communication: once traffic flows to primary, it will continue to flow to primary for a certain period of time, and once traffic flows to canary, it will continue to flow to canary for a certain period of time.

This idea is based on the Akamai ALB and AWS ALB sticky setup.

ref.

Proposed solution

I am wondering if it is possible to achieve stickiness communication by giving a cookie to the primary as well, using the following method.

sessionAffinity:
  primary:    
    cookieName: flagger-primary
    maxAge: 86400
  canary:
    cookieName: flagger-canary
    maxAge: 86400
spec:
  hosts: []
  http:
  - match:
    - headers:
        Cookie:
          regex: .*flagger-canary.*kkuchhkCku.*
    name: sticky-route-canary
    route:
    - destination:
        host: primary
      weight: 0
    - destination:
        host: canary
      weight: 100
    timeout: 3.5s
  - match:
    - headers:
        Cookie:
          regex: .*flagger-primary.*fdakljdfa.*
    name: sticky-route-primary
    route:
    - destination:
        host: primary
      weight: 100
    - destination:
        host: canary
      weight: 0
    timeout: 3.5s
  - route:
    - destination:
        host: primary
      headers:
        response:
          add:
            Set-Cookie: flagger-primary=fdakljdfa; Max-Age=86400
      weight: 50
    - destination:
        host: canary
      headers:
        response:
          add:
            Set-Cookie: flagger-canary=kkuchhkCku; Max-Age=86400
      weight: 50

I would like to know if you have any other good solutions.

@aryan9600
Copy link
Member

This is not a problem with the session affinity functionality, it was designed this way on purpose. The idea is to prevent users from switching back to the primary after they have been directed to the canary. We don't want to keep users stuck to the primary.

@takezyou
Copy link
Author

@aryan9600
Thanks for your reply.
I understood that it is an intentional design of session affinity.
I would like to keep them in primary as well for the use case I have, would you consider such a feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants