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

Generated Ingress resource has duplicate paths elements #28812

Closed
Sgitario opened this issue Oct 25, 2022 · 2 comments · Fixed by #28813
Closed

Generated Ingress resource has duplicate paths elements #28812

Sgitario opened this issue Oct 25, 2022 · 2 comments · Fixed by #28813
Assignees
Labels
area/kubernetes kind/bug Something isn't working
Milestone

Comments

@Sgitario
Copy link
Contributor

Describe the bug

The generated Ingress resource has duplicate paths elements. This can be reproducible using the Quarkus Kubernetes extension and enabling the ingress exposition (quarkus.kubernetes.ingress.expose=true).
The generated Ingress resource looks like:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    app.quarkus.io/commit-id: 64db796fa05191004c9a6f5f907f04ef11ae9e49
    app.quarkus.io/build-timestamp: 2022-10-25 - 09:34:28 +0000
  labels:
    app.kubernetes.io/name: kubernetes-with-ingress-rules
    app.kubernetes.io/version: 0.1-SNAPSHOT
  name: kubernetes-with-ingress-rules
spec:
  rules:
    - http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress-rules
                port:
                  name: http
            path: /
            pathType: Prefix
          - backend:
              service:
                name: kubernetes-with-ingress-rules
                port:
                  name: http
            path: /
            pathType: Prefix

The expected behavior is that only one path is created.

This issue is caused by this change in Dekorate upstream: dekorateio/dekorate#1085

This is only happening using Quarkus main 999-SNAPSHOT.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

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

No response

Additional information

No response

@Sgitario Sgitario added the kind/bug Something isn't working label Oct 25, 2022
@Sgitario Sgitario self-assigned this Oct 25, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 25, 2022

/cc @geoand, @iocanel

@Sgitario
Copy link
Contributor Author

Sgitario commented Oct 25, 2022

fyi @gsmet this is a regression issue that only affects 2.14 (unreleased yet)

Sgitario added a commit to Sgitario/dekorate that referenced this issue Oct 25, 2022
Sgitario added a commit to Sgitario/dekorate that referenced this issue Oct 25, 2022
Sgitario added a commit to Sgitario/quarkus that referenced this issue Oct 25, 2022
These changes also ensures that not duplicated ingress rules are generated.

#### Adding Ingress rules

To customize the default `host` and `path` properties of the generated Ingress resources, you need to apply the following configuration:

```
quarkus.kubernetes.ingress.expose=true
# To change the Ingress host. By default, it's empty.
quarkus.kubernetes.ingress.host=prod.svc.url
# To change the Ingress path of the generated Ingress rule. By default, it's "/".
quarkus.kubernetes.ports.http.path=/prod
```

This would generate the following Ingress resource:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  labels:
    app.kubernetes.io/name: kubernetes-with-ingress
    app.kubernetes.io/version: 0.1-SNAPSHOT
  name: kubernetes-with-ingress
spec:
  rules:
    - host: prod.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /prod
            pathType: Prefix
```

Additionally, you can also add new Ingress rules by adding the following configuration:

```
# Example to add a new rule
quarkus.kubernetes.ingress.rules.1.host=dev.svc.url
quarkus.kubernetes.ingress.rules.1.path=/dev
quarkus.kubernetes.ingress.rules.1.path-type=ImplementationSpecific
# by default, path type is Prefix

# Exmple to add a new rule that use another service binding
quarkus.kubernetes.ingress.rules.2.host=alt.svc.url
quarkus.kubernetes.ingress.rules.2.path=/ea
quarkus.kubernetes.ingress.rules.2.service-name=updated-service
quarkus.kubernetes.ingress.rules.2.service-port-name=tcpurl
```

This would generate the following Ingress resource:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  labels:
    app.kubernetes.io/name: kubernetes-with-ingress
    app.kubernetes.io/version: 0.1-SNAPSHOT
  name: kubernetes-with-ingress
spec:
  rules:
    - host: prod.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /prod
            pathType: Prefix
    - host: dev.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /dev
            pathType: ImplementationSpecific
    - host: alt.svc.url
      http:
        paths:
          - backend:
              service:
                name: updated-service
                port:
                  name: tcpurl
            path: /ea
            pathType: Prefix
```

Fix quarkusio#28812
Fix quarkusio#26747
@quarkus-bot quarkus-bot bot added this to the 2.15 - main milestone Oct 26, 2022
tmihalac pushed a commit to tmihalac/quarkus that referenced this issue Oct 27, 2022
These changes also ensures that not duplicated ingress rules are generated.

#### Adding Ingress rules

To customize the default `host` and `path` properties of the generated Ingress resources, you need to apply the following configuration:

```
quarkus.kubernetes.ingress.expose=true
# To change the Ingress host. By default, it's empty.
quarkus.kubernetes.ingress.host=prod.svc.url
# To change the Ingress path of the generated Ingress rule. By default, it's "/".
quarkus.kubernetes.ports.http.path=/prod
```

This would generate the following Ingress resource:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  labels:
    app.kubernetes.io/name: kubernetes-with-ingress
    app.kubernetes.io/version: 0.1-SNAPSHOT
  name: kubernetes-with-ingress
spec:
  rules:
    - host: prod.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /prod
            pathType: Prefix
```

Additionally, you can also add new Ingress rules by adding the following configuration:

```
# Example to add a new rule
quarkus.kubernetes.ingress.rules.1.host=dev.svc.url
quarkus.kubernetes.ingress.rules.1.path=/dev
quarkus.kubernetes.ingress.rules.1.path-type=ImplementationSpecific
# by default, path type is Prefix

# Exmple to add a new rule that use another service binding
quarkus.kubernetes.ingress.rules.2.host=alt.svc.url
quarkus.kubernetes.ingress.rules.2.path=/ea
quarkus.kubernetes.ingress.rules.2.service-name=updated-service
quarkus.kubernetes.ingress.rules.2.service-port-name=tcpurl
```

This would generate the following Ingress resource:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  labels:
    app.kubernetes.io/name: kubernetes-with-ingress
    app.kubernetes.io/version: 0.1-SNAPSHOT
  name: kubernetes-with-ingress
spec:
  rules:
    - host: prod.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /prod
            pathType: Prefix
    - host: dev.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /dev
            pathType: ImplementationSpecific
    - host: alt.svc.url
      http:
        paths:
          - backend:
              service:
                name: updated-service
                port:
                  name: tcpurl
            path: /ea
            pathType: Prefix
```

Fix quarkusio#28812
Fix quarkusio#26747
@gsmet gsmet modified the milestones: 2.15 - main, 2.14.0.Final Oct 28, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 28, 2022
These changes also ensures that not duplicated ingress rules are generated.

#### Adding Ingress rules

To customize the default `host` and `path` properties of the generated Ingress resources, you need to apply the following configuration:

```
quarkus.kubernetes.ingress.expose=true
# To change the Ingress host. By default, it's empty.
quarkus.kubernetes.ingress.host=prod.svc.url
# To change the Ingress path of the generated Ingress rule. By default, it's "/".
quarkus.kubernetes.ports.http.path=/prod
```

This would generate the following Ingress resource:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  labels:
    app.kubernetes.io/name: kubernetes-with-ingress
    app.kubernetes.io/version: 0.1-SNAPSHOT
  name: kubernetes-with-ingress
spec:
  rules:
    - host: prod.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /prod
            pathType: Prefix
```

Additionally, you can also add new Ingress rules by adding the following configuration:

```
# Example to add a new rule
quarkus.kubernetes.ingress.rules.1.host=dev.svc.url
quarkus.kubernetes.ingress.rules.1.path=/dev
quarkus.kubernetes.ingress.rules.1.path-type=ImplementationSpecific
# by default, path type is Prefix

# Exmple to add a new rule that use another service binding
quarkus.kubernetes.ingress.rules.2.host=alt.svc.url
quarkus.kubernetes.ingress.rules.2.path=/ea
quarkus.kubernetes.ingress.rules.2.service-name=updated-service
quarkus.kubernetes.ingress.rules.2.service-port-name=tcpurl
```

This would generate the following Ingress resource:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  labels:
    app.kubernetes.io/name: kubernetes-with-ingress
    app.kubernetes.io/version: 0.1-SNAPSHOT
  name: kubernetes-with-ingress
spec:
  rules:
    - host: prod.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /prod
            pathType: Prefix
    - host: dev.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-with-ingress
                port:
                  name: http
            path: /dev
            pathType: ImplementationSpecific
    - host: alt.svc.url
      http:
        paths:
          - backend:
              service:
                name: updated-service
                port:
                  name: tcpurl
            path: /ea
            pathType: Prefix
```

Fix quarkusio#28812
Fix quarkusio#26747

(cherry picked from commit 8cce3d5)
@gsmet gsmet modified the milestones: 2.14.0.Final, 2.13.4.Final, 2.10.5.Final Oct 31, 2022
Sgitario added a commit to dekorateio/dekorate that referenced this issue Nov 2, 2022
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.

2 participants