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

quarkus-kubernetes generated Ingress broken in 2.0.0.CR3 #18007

Closed
edeandrea opened this issue Jun 18, 2021 · 11 comments · Fixed by #18170
Closed

quarkus-kubernetes generated Ingress broken in 2.0.0.CR3 #18007

edeandrea opened this issue Jun 18, 2021 · 11 comments · Fixed by #18170
Assignees
Labels
area/kubernetes kind/bug Something isn't working
Milestone

Comments

@edeandrea
Copy link
Contributor

edeandrea commented Jun 18, 2021

Describe the bug

When using the quarkus-kubernetes extension, the generation of the Ingress when quarkus.kubernetes.ingress.expose=true is broken in 2.0.0.CR3. It works fine in 1.13.7.Final.

To Reproduce

I'm attaching a reproducer project which was created using the Quarkus Kubernetes Guide. When running ./mvnw clean package with the reproducer project, the Ingress that gets generated inside target/kubernetes/kubernetes.yml looks like

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    app.quarkus.io/build-timestamp: 2021-06-18 - 12:51:06 +0000
  labels:
    app.kubernetes.io/name: kubernetes-quickstart
    app.kubernetes.io/version: 1.0.0-SNAPSHOT
  name: kubernetes-quickstart
spec:
  rules:
    - http:
        paths:
          - backend:
              service:
                name: kubernetes-quickstart
                port:
                  name: http
            pathType: Prefix
    - http:
        paths:
          - backend:
              service:
                name: kubernetes-quickstart
                port:
                  name: http
            pathType: Prefix

When trying to deploy this to OpenShift/Kubernetes (via kubectl apply -f target/kubernetes/kubernetes.yml), this error is encountered:

$ kubectl apply -f target/kubernetes/kubernetes.yml
service/kubernetes-quickstart created
deployment.apps/kubernetes-quickstart created
The Ingress "kubernetes-quickstart" is invalid: 
* spec.rules[0].http.paths[0].path: Invalid value: "": must be an absolute path
* spec.rules[1].http.paths[0].path: Invalid value: "": must be an absolute path

When switching the project back to Quarkus version 1.13.7.Final and re-running ./mvnw clean package, the generated Ingress looks like

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    app.quarkus.io/build-timestamp: 2021-06-18 - 13:00:47 +0000
  labels:
    app.kubernetes.io/name: kubernetes-quickstart
    app.kubernetes.io/version: 1.0.0-SNAPSHOT
  name: kubernetes-quickstart
spec:
  rules:
  - host: ""
    http:
      paths:
      - backend:
          serviceName: kubernetes-quickstart
          servicePort: 8080
        path: /

It applies fine.

If I then add a value in the quarkus.kubernetes.ingress.host property, in 2.0.0.CR3 the Ingress looks like

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    app.quarkus.io/build-timestamp: 2021-06-18 - 13:08:27 +0000
  labels:
    app.kubernetes.io/name: kubernetes-quickstart
    app.kubernetes.io/version: 1.0.0-SNAPSHOT
  name: kubernetes-quickstart
spec:
  rules:
    - host: kubernetes-quickstart
      http:
        paths:
          - backend:
              service:
                name: kubernetes-quickstart
                port:
                  name: http
            pathType: Prefix
          - backend:
              service:
                name: kubernetes-quickstart
                port:
                  name: http

which is still invalid when trying to apply it:

$ kubectl apply -f target/kubernetes/kubernetes.yml 
service/kubernetes-quickstart created
deployment.apps/kubernetes-quickstart created
The Ingress "kubernetes-quickstart" is invalid: 
* spec.rules[0].http.paths[0].path: Invalid value: "": must be an absolute path
* spec.rules[0].http.paths[1].pathType: Required value: pathType must be specified

Reproducer project:
kubernetes-quickstart.zip

Configuration

# Add your application.properties here, if applicable.
quarkus.kubernetes.ingress.expose=true
quarkus.container-image.registry=quay.io
quarkus.container-image.group=edeandrea
quarkus.container-image.build=true

Environment (please complete the following information):

Output of uname -a or ver

Darwin edeandre-mac 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

Quarkus version or git rev

1.13.7.Final vs 2.0.0.CR3

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /Users/edeandre/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Users/edeandre/.sdkman/candidates/java/11.0.2-open
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
@edeandrea edeandrea added the kind/bug Something isn't working label Jun 18, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 18, 2021

/cc @geoand

@geoand
Copy link
Contributor

geoand commented Jun 18, 2021

@iocanel sounds like a dekorate issue, right?

@iocanel
Copy link
Contributor

iocanel commented Jun 19, 2021

Seems so

@iocanel
Copy link
Contributor

iocanel commented Jun 24, 2021

I fixed that on decorate side and will proceed with a release ASAP

@geoand
Copy link
Contributor

geoand commented Jun 24, 2021

Thanks!

@cmoulliard
Copy link

Will it be needed to wait the release 2.0.1 of quarkus ? @iocanel @geoand

@geoand
Copy link
Contributor

geoand commented Jun 25, 2021

Yes

@cmoulliard
Copy link

cmoulliard commented Jun 25, 2021

There is something that nevertheless we must think about as currently, ingress proposes 2 API top of kubernetes

So, how will it be possible for a user to specify which API version they will be interested to use like the pathType ? Ideally the proper object/resource should be generated no matter if the user is connected to a k8s cluster v1.x, v1.y, etc and without the need to say quarkus.kubernetes.ingress.new-api=true/false ;-)

@edeandrea
Copy link
Contributor Author

Hi @iocanel what Quarkus version should we see this fix in? 2.0.1?

@gastaldi
Copy link
Contributor

@edeandrea yes, it is marked for backport, so it should be in the next 2.0.x release

@edeandrea
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants