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

Why not support nginx session sticky/affinity? #1487

Open
mumubin opened this issue Aug 24, 2023 · 3 comments
Open

Why not support nginx session sticky/affinity? #1487

mumubin opened this issue Aug 24, 2023 · 3 comments

Comments

@mumubin
Copy link

mumubin commented Aug 24, 2023

Describe the feature

As far as I know, nginx itself also supports session sticky/affinity, but in flagger's documentation, session affinity only applies to istio situations .
Is it assessed that the technology is not feasible, or is there not enough development resources to realize it?

Proposed solution

If it's technically possible, I can try to offer PR

@akselleirv
Copy link

Seems to be added support for canary and session affinity by this PR: kubernetes/ingress-nginx#7371

Would be awesome to have support for this with nginx!

@aryan9600
Copy link
Member

aryan9600 commented Sep 8, 2023

now that Gateway API has ResponseHeaderModifier as a part of its standard installation, we are adding session affinity for Gateway API.
whenever ingress-nginx starts supporting Gateway API, Flagger will automatically support session affinity for Nginx.

@mumubin
Copy link
Author

mumubin commented Sep 18, 2023

Thanks @akselleirv 's doc.
Base on this doc, I add some annotations on the ingress.
Then the podinfo can support session affinity for both podinfo-canary and podinfo-primary service.
Maybe this is a workaround, you can have a try,

Example: add session-affinity annotations in ingress yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: podinfo
  namespace: flagger
  labels:
    app: podinfo
  annotations:
    nginx.ingress.kubernetes.io/affinity: cookie
    nginx.ingress.kubernetes.io/affinity-mode: balanced
    nginx.ingress.kubernetes.io/affinity-canary-behavior: sticky
    nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
    nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
    ingressClassName: ingress-internal
spec:
  rules:
    - host: "podinfo.flagger.lab.xxx.int.xxxxx.com"
      http:
        paths:
          - pathType: Prefix
            path: "/"
            backend:
              service:
                name: podinfo
                port:
                  number: 80

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

3 participants