Ingress-nginx: Add more annotations to sticky session attributes

Created on 21 Jun 2018  路  5Comments  路  Source: kubernetes/ingress-nginx

Is this a request for help? : No

What keywords did you search in NGINX Ingress controller issues before filing this one?: sticky, affinity, annotations, domain, secure


Is this a BUG REPORT or FEATURE REQUEST?: Feature

NGINX Ingress controller version: 0.14.0

Kubernetes version (use kubectl version): 1.8.7

Environment:

  • Cloud provider or hardware configuration: AWS
  • OS (e.g. from /etc/os-release): Debian GNU/Linux 8 (jessie)
  • Kernel (e.g. uname -a): 4.4.102-k8s
  • Install tools:
  • Others:

What happened:

Would be nice if we could implement by annotations all the other attributes that the nginx-sticky-module-ng module supports:

sticky [name=route] [domain=.foo.bar] [path=/] [expires=1h] 
     [hash=index|md5|sha1] [no_fallback] [secure] [httponly];

Today I can only implement by default the name, hash and path attributes.

nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "route"
nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"

If I want all the others, I can tricky the nginx.tmpl specifying all the others in a single annotation. This is ugly, not the right way but works.

My configuration ends up like this:

nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "route domain=foo.bar secure"
nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"

What you expected to happen:

Would be nice if I could add those by annotation as well, maybe like this:

nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "route"
nginx.ingress.kubernetes.io/session-cookie-domain: ".foo.bar"
nginx.ingress.kubernetes.io/session-cookie-expires: "1h"
nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"
nginx.ingress.kubernetes.io/session-cookie-no_fallback: true
nginx.ingress.kubernetes.io/session-cookie-secure: true
nginx.ingress.kubernetes.io/session-cookie-httponly: true
lifecyclrotten

Most helpful comment

@amalucelli
when enable-dynamic-configuration was false, we can first add the annotation like "ingress.kubernetes.io/session-cookie-name": "route domain=a.b.c expires=1h" to work round like what you said.

when enable-dynamic-configuration was true, above method seems not work, may need to update the sticky.lua to support this https://github.com/kubernetes/ingress-nginx/blob/master/rootfs/etc/nginx/lua/balancer/sticky.lua#L41-L47.

All 5 comments

@amalucelli
when enable-dynamic-configuration was false, we can first add the annotation like "ingress.kubernetes.io/session-cookie-name": "route domain=a.b.c expires=1h" to work round like what you said.

when enable-dynamic-configuration was true, above method seems not work, may need to update the sticky.lua to support this https://github.com/kubernetes/ingress-nginx/blob/master/rootfs/etc/nginx/lua/balancer/sticky.lua#L41-L47.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Was this page helpful?
0 / 5 - 0 ratings