Why not support nginx session sticky/affinity?
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
Seems to be added support for canary and session affinity by this PR: https://github.com/kubernetes/ingress-nginx/pull/7371
Would be awesome to have support for this with nginx!
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.
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