zalando-incubator / kube-ingress-aws-controller

Configures AWS Load Balancers according to Kubernetes Ingress resources
MIT License
375 stars 84 forks source link

Sticky Session #267

Open lambertpan opened 5 years ago

lambertpan commented 5 years ago

I have enabled the SessionAffinity on the service, and from kube-ingress-controller I expect something similar to nginx-cookie - Do we have anything like this? Or, how to handle session affinity with kube-ingress-aws-controller?

szuecs commented 5 years ago

@lambertpan Can you check if the Amazon ALB supports sticky sessions?

drmudgett commented 2 months ago

To revisit this @szuecs - yes ALB supports sticky sessions. I believe the fix to enable this would just be to update the Listener like so:

                                template.AddResource("HTTPListener", &cloudformation.ElasticLoadBalancingV2Listener{
                                        DefaultActions: &cloudformation.ElasticLoadBalancingV2ListenerActionList{
                                                {
                                                        Type:           cloudformation.String("forward"),
                                                        TargetGroupArn: cloudformation.Ref(httpTargetGroupName).String(),
                                                        TargetGroupStickinessConfig: &cloudformation.ElasticLoadBalancingV2ListenerTargetGroupStickinessConfig{
                                                                Enabled: cloudformation.string("true"),
                                                                DurationSeconds: cloudformation.Integer(3600)
                                                        },
                                                },
                                        },

If that sounds right, I can throw together a PR for it.

szuecs commented 1 month ago

Hi, took a while to read the backlog from vacation!

Yeah from my side looks good. What we need to define is an annotation and add it to the list https://github.com/zalando-incubator/kube-ingress-aws-controller/tree/master?tab=readme-ov-file#annotations , and use it to enable sticky session by ingress/routegroup annotation. Default could be non-sticky. Feel free to propose a PR and we can review it!

Every feature PR comes with test and docs :)