quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.77k stars 2.68k forks source link

When adding a target Deployment resource (like Deployment or DeploymentConfig or Knative Service), it gets duplicated #32345

Open Sgitario opened 1 year ago

Sgitario commented 1 year ago

Describe the bug

Given a project called "example", when adding a custom Knative Service in src/main/kubernetes/common.yml:

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: example
spec:
  template:
    spec:
      containers:
        - livenessProbe:
            httpGet:
              port: 8888

The generated knative.yaml contains now two Knative service with the same "example" name:

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  annotations:
    app.quarkus.io/build-timestamp: 2023-04-03 - 06:09:21 +0000
    app.quarkus.io/commit-id: 9a4b067181a8abec86343eaa8fc9613463f0e4e4
  labels:
    app.kubernetes.io/name: quarkus-helm-integration-tests-knative-minimal
    app.kubernetes.io/version: 1.0.2-SNAPSHOT
  name: example
spec:
  template:
    spec:
      containers:
        - image: ...
          imagePullPolicy: Always
          name: quarkus-helm-integration-tests-knative-minimal
          ports:
            - containerPort: 8080
              name: http1
              protocol: TCP
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  annotations:
    app.quarkus.io/build-timestamp: 2023-04-03 - 06:09:21 +0000
    app.quarkus.io/commit-id: 9a4b067181a8abec86343eaa8fc9613463f0e4e4
  labels:
    app.kubernetes.io/name: quarkus-helm-integration-tests-knative-minimal
    app.kubernetes.io/version: 1.0.2-SNAPSHOT
  name: example
spec:
  template:
    spec:
      containers:
        - livenessProbe:
            httpGet:
              port: null
              scheme: HTTP

Expected behavior

The provided Knative Service "example" should be merged into the generated Knative Service.

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

quarkus-bot[bot] commented 1 year ago

/cc @geoand (knative,kubernetes), @iocanel (knative,kubernetes)

Sgitario commented 1 year ago

This needs to be fixed in Dekorate. The only workaround is to use src/main/kubernetes/knative.yml instead of src/main/kubernetes/common.yml.

Sgitario commented 1 year ago

Update: This seems to be a more general issue that affects also to OpenShift and Kubernetes deployments.

shawkins commented 1 year ago

Do you view this as a missing validation, doc issue, or both? The expectation seems to be that the common.yml will not contain resources that could otherwise be in the kubernetes.yml or similar.

Sgitario commented 1 year ago

Do you view this as a missing validation, doc issue, or both? The expectation seems to be that the common.yml will not contain resources that could otherwise be in the kubernetes.yml or similar.

I think both, tho validating that the common.yml file does not contain the deployment resources is not straight-forward, so perhaps updating the doc is the way to go. wdyt? @iocanel