Code Monkey home page Code Monkey logo

Comments (6)

mstahv avatar mstahv commented on September 24, 2024 1

My K8s skills are not at top level, I'll ask if some of our experts could some time to build a working setup for Okteto.

from base-starter-flow-quarkus.

mstahv avatar mstahv commented on September 24, 2024

My quick guess is that the ingress/loadbalancer in your K8s clusters needs to be configured for session affinity aka sticky sessions. This is what start.vaadin.com generates for Spring Boot apps, something similar might work in your setup (I have never used Okteto).

apiVersion: v1
kind: Service
metadata:
  name: myapp-balancer
spec:
  selector:
    app: myapp
  ports:
    - protocol: TCP
      port: 8000 # The port to expose to the outside
      targetPort: 8080 # The port the application is running on in the pods
  type: LoadBalancer
  sessionAffinity: ClientIP

from base-starter-flow-quarkus.

cernier avatar cernier commented on September 24, 2024

Unfortunately, the change you suggested seems to not fix the issue.

I initially didn't think, indeed, of the Docker/Kubernetes files provided by SpringBoot-based skeletons created on start.vaadin.com.
As they are generated from vaadin/skeleton-starter-flow-spring template, I forked it and just adapted the Docker/Kubernetes files for a deployment to Okteto (like I did here for the Vaadin-Quarkus)

So that, at the end, the issue root cause seems more general and not only related to Quarkus or Spring Boot support.
By the way, do you think I should then open issue on the main Vaadin Flow repository?

Here below are URLs serving UIs showing this wrong behaviour, and whether it's within:

Okteto is just a platform allowing to deploy easily to a Kubernetes cluster in the cloud, especially for basic testing purpose with a free pricing.
If you prefer a reproducer on another platform(s), feel free to tell me, I will adapt also to it (them).

from base-starter-flow-quarkus.

mstahv avatar mstahv commented on September 24, 2024

No need to create a separate issue, the team can move the issue to Flow repository if they find some issue to work with from here.

I still believe this is an issue in cluster configuration. I quickly used browser inspector and curl against your deployments and it looks like the session cookie changes on every request, even if you provided the session cookie that the server provides in previous request. So either the request goes to a different node on each request (round robin instead of session affinity) or the cookie is dropped by the front proxy.

from base-starter-flow-quarkus.

mstahv avatar mstahv commented on September 24, 2024

Here is the output with curl. With properly working setup, the second request shouldn't set the cookie anymore:

mstahv@MatinPikkuRakkine ~ % curl --head https://vaadin-quarkus-cernier.cloud.okteto.net
HTTP/2 200 
date: Fri, 18 Feb 2022 08:49:31 GMT
content-type: text/html;charset=utf-8
content-length: 821
set-cookie: JSESSIONID=ngNZQD8kQeravD89N05muhOn0YweOEbROj5dvDPB; path=/
set-cookie: csrfToken=ce5a9570-742e-4679-b285-aa31d292197e; path=/
strict-transport-security: max-age=15724800; includeSubDomains

mstahv@MatinPikkuRakkine ~ % curl --cookie "JSESSIONID=ngNZQD8kQeravD89N05muhOn0YweOEbROj5dvDPB; path=/" --head https://vaadin-quarkus-cernier.cloud.okteto.net
HTTP/2 200 
date: Fri, 18 Feb 2022 08:50:02 GMT
content-type: text/html;charset=utf-8
content-length: 821
set-cookie: JSESSIONID=RRUsHVyMzKk2g-sVmbtGpdJRWaizTxYR4nAPUJlA; path=/
set-cookie: csrfToken=36aaa8fd-ad07-458a-ae38-d436373da211; path=/
strict-transport-security: max-age=15724800; includeSubDomains


from base-starter-flow-quarkus.

mstahv avatar mstahv commented on September 24, 2024

Yeah, it is round robin. If you make a third request with the initially returned cookie, then it works, but naturally browser then thinks that the session is expired and reloads.

from base-starter-flow-quarkus.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.