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

0.21.0 breaks stickiness for default host #3959

Closed
unicast opened this issue Apr 2, 2019 · 17 comments · Fixed by #4867
Closed

0.21.0 breaks stickiness for default host #3959

unicast opened this issue Apr 2, 2019 · 17 comments · Fixed by #4867

Comments

@unicast
Copy link

unicast commented Apr 2, 2019

What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.): I was searching for stickiness and cookies and it seems these two PRs are relevant to this bug: #3534 #3383

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
It's a BUG REPORT

NGINX Ingress controller version:
0.21.0

Kubernetes version (use kubectl version):
v1.12.5

Environment:

  • Cloud provider or hardware configuration:
    GCP
  • OS (e.g. from /etc/os-release):
    CoreOS
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

What happened:
We are running the same set of microservices across ~100 different domains and always using default host (spec.rules.host undefined).
After we upgraded to 0.21.0 we don't see a cookie being issued for the following configuration:

kind: Ingress
metadata:
  name: test-path-sticky
  namespace: {{ .Values.namespace }}
  annotations:
    nginx.ingress.kubernetes.io/affinity: cookie
spec:
  rules:
  - http:
      paths:
      - path: /test-path-sticky/
        backend:
          serviceName: test-app
          servicePort: 80

What you expected to happen:
I would expect to have a cookie issued in this case because host is an optional directive https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-rules

Anything else we need to know:
It's working with 0.20.0 and probably was introduced by this change: #3383

@unicast unicast changed the title 0.21 breaks cookies for for default host 0.21.0 breaks cookies for for default host Apr 2, 2019
@unicast unicast changed the title 0.21.0 breaks cookies for for default host 0.21.0 breaks stickiness for for default host Apr 2, 2019
@unicast unicast changed the title 0.21.0 breaks stickiness for for default host 0.21.0 breaks stickiness for default host Apr 3, 2019
@alexkursell
Copy link
Contributor

nginx.ingress.kubernetes.io/affinity: cookie requires the use of nginx.ingress.kubernetes.io/session-cookie-path. Have you tried adding nginx.ingress.kubernetes.io/session-cookie-path: /test-path-sticky/ to your ingress definition?

@lfundaro
Copy link

lfundaro commented May 17, 2019

hello @alexkursell ,

we tested with nginx.ingress.kubernetes.io/session-cookie-path: /test-path-sticky/ and it doesn't issue the cookie.
We can only get the cookie when setting host.

here's an updated version of the ingress resource we're using:

Doesn't work

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-path-sticky
  namespace: {{ .Values.namespace }}
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/rewrite-target: "/"
    ingress.kubernetes.io/affinity: "cookie"
    ingress.kubernetes.io/session-cookie-name: "{{ .Values.namespace }}-backend"
    ingress.kubernetes.io/session-cookie-hash: "sha1"
    ingress.kubernetes.io/session-cookie-path: "/test-path-sticky/"
spec:
  rules:
    - http:
        paths:
        - path: /test-path-sticky/
          backend:
            serviceName: test-app
            servicePort: 80
        - path: /test-path-sticky/hello/
          backend:
            serviceName: test-app
            servicePort: 80

Works

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-path-sticky
  namespace: {{ .Values.namespace }}
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/rewrite-target: "/"
    ingress.kubernetes.io/affinity: "cookie"
    ingress.kubernetes.io/session-cookie-name: "{{ .Values.namespace }}-backend"
    ingress.kubernetes.io/session-cookie-hash: "sha1"
spec:
  rules:
    - host: "dockerhost"
       http:
        paths:
        - path: /test-path-sticky/
          backend:
            serviceName: test-app
            servicePort: 80
        - path: /test-path-sticky/hello/
          backend:
            serviceName: test-app
            servicePort: 80

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 15, 2019
@unicast
Copy link
Author

unicast commented Aug 15, 2019

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 15, 2019
@unicast
Copy link
Author

unicast commented Aug 15, 2019

It's still relevant

@ElvinEfendi
Copy link
Member

It's still relevant

@unicast do you meant the issue still exist with latest ingress-nginx version 0.25.1?

@unicast
Copy link
Author

unicast commented Aug 15, 2019

@ElvinEfendi I didn't get a chance to test it against the latest version 0.25.1 but it was there in 0.23.0 and I don't see any changes related to the stickiness between the two.

@unicast
Copy link
Author

unicast commented Aug 16, 2019

@ElvinEfendi I ran the test against 0.25.1, issue is still there.

@billjh
Copy link

billjh commented Sep 17, 2019

There is a similar issue in #3989, where we found session affinity cookie only set on domains that exist in spec.rules.[*].host

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 16, 2019
@unicast
Copy link
Author

unicast commented Dec 16, 2019

I believe it's still relevant

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 16, 2019
@davidfowl
Copy link

Any reason this hasn't been fixed yet? There's another issue here #4786 and there was a PR open here #4817

@aledbf
Copy link
Member

aledbf commented Dec 28, 2019

@davidfowl the author of #4817 didn't sign the CLA and never answered.

@davidfowl
Copy link

@aledbf was the PR good besides not signing the CLA? I burnt like an hour looking up a bunch of yaml files from various examples and blog posts and none of them worked. That lead me to the issue tracker here to figure out if there were any bugs.

I'm surprised this hasn't been fixed as yet.

@aledbf
Copy link
Member

aledbf commented Dec 28, 2019

was the PR good besides not signing the CLA?

The PR looks fine but it needs lua and e2e tests (to verify the fix and avoid regressions)

@joylili
Copy link

joylili commented Dec 30, 2019

sorry,I have an error connecting to the cla url.I'll try again later。

@aledbf
Copy link
Member

aledbf commented Dec 30, 2019

@joylili please check #4867

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

Successfully merging a pull request may close this issue.

10 participants