raflyalk opened a new issue, #6864:
URL: https://github.com/apache/camel-k/issues/6864

   ### Bug description
   
   ### What happened?
   
   After upgrading Camel K from **2.10.1 to 2.11.0**, all of our integrations 
fail while building their IntegrationKit.
   
   We migrated our build/registry configuration from the deprecated 
`IntegrationPlatform` to an `IntegrationProfile`.
   
   The `Integration` correctly selects the `IntegrationProfile` using:
   
   ```yaml
   metadata:
     annotations:
       camel.apache.org/integration-profile.id: my-integration-profile
   ```
   
   The selected `IntegrationProfile` contains the registry configuration:
   
   ```yaml
   apiVersion: camel.apache.org/v1
   kind: IntegrationProfile
   metadata:
     name: my-integration-profile
     namespace: my-namespace
   spec:
     build:
       registry:
         address: image-registry.openshift-image-registry.svc:5000
         insecure: true
         organization: my-namespace
         secret: camel-k-builder-dockerconfigjson
   ```
   
   However, when Camel K creates the `IntegrationKit` and `Build`, the registry 
configuration is not propagated to the Jib build task.
   
   The generated `Build` contains:
   
   ```yaml
   - jib:
       baseImage: eclipse-temurin:17-jdk@sha256:...
       configuration: {}
       image: /camel-k/camel-k-kit-dav51j9qq1us73cma2r0:1694932814
       name: jib
       registry: {}
   ```
   
   The resulting image reference is invalid because the registry address is 
missing:
   
   ```text
   /camel-k/camel-k-kit-dav51j9qq1us73cma2r0:1694932814
   ```
   
   The expected image would be similar to:
   
   ```text
   
image-registry.openshift-image-registry.svc:5000/my-namespace/camel-k-kit-dav51j9qq1us73cma2r0:<tag>
   ```
   
   ### Error
   
   The operator reports:
   
   ```text
   Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.1:build
   (default-cli) on project camel-k-integration:
   
   Invalid image reference
   /camel-k/camel-k-kit-dav51j9qq1us73cma2r0:1694932814
   ```
   
   Jib also reports:
   
   ```text
   For example, slash-separated name components cannot have uppercase letters:
   Invalid image reference:
   /camel-k/camel-k-kit-dav51j9qq1us73cma2r0:1694932814
   ```
   
   The IntegrationKit eventually transitions to `Error`.
   
   A subsequent error is produced when the Integration attempts to create its 
CronJob:
   
   ```text
   CronJob.batch "my-application" is invalid:
   spec.jobTemplate.spec.template.spec.containers[0].image: Required value
   ```
   
   This appears to be a secondary consequence of the IntegrationKit failing to 
produce an image.
   
   ### IntegrationProfile selection appears to work
   
   The `IntegrationKit` correctly contains the profile annotation:
   
   ```yaml
   metadata:
     annotations:
       camel.apache.org/integration-profile.id: my-integration-profile
       camel.apache.org/operator.id: camel-k
   ```
   
   The generated `Build` also correctly contains it:
   
   ```yaml
   metadata:
     annotations:
       camel.apache.org/integration-profile.id: my-integration-profile
       camel.apache.org/operator.id: camel-k
   ```
   
   Therefore, the IntegrationProfile selection/annotation propagation itself 
appears to work.
   
   The problem seems to occur when the Build/Jib task is generated: the 
`spec.build.registry` configuration from the selected IntegrationProfile is not 
reflected in the generated Jib task.
   
   ### Environment / topology
   
   Camel K version:
   
   ```text
   2.11.0
   ```
   
   Runtime provider:
   
   ```text
   plain-quarkus
   ```
   
   Runtime version shown on the IntegrationKit:
   
   ```text
   3.39.1
   ```
   
   Kubernetes distribution:
   
   ```text
   OpenShift
   ```
   
   Registry:
   
   ```text
   image-registry.openshift-image-registry.svc:5000
   ```
   
   The generated IntegrationKit and Build are located in the Camel K operator 
namespace:
   
   ```text
   camel-k
   ```
   
   For example:
   
   ```yaml
   kind: IntegrationKit
   metadata:
     name: kit-dav51j9qq1us73cma2r0
     namespace: camel-k
     labels:
       camel.apache.org/created.by.kind: Integration
       camel.apache.org/created.by.name: my-application
       camel.apache.org/created.by.namespace: my-namespace
   ```
   
   This may be relevant if registry configuration from a namespace-local 
IntegrationProfile is not being resolved when the IntegrationKit/Build is 
created in the operator namespace.
   
   ### Steps to reproduce
   
   1. Install/upgrade Camel K to `2.11.0`.
   
   2. Run the operator in namespace `camel-k`.
   
   3. Create an `IntegrationProfile` in another watched namespace:
   
   ```yaml
   apiVersion: camel.apache.org/v1
   kind: IntegrationProfile
   metadata:
     name: my-integration-profile
     namespace: my-namespace
   spec:
     build:
       registry:
         address: image-registry.openshift-image-registry.svc:5000
         organization: my-namespace
         insecure: true
         secret: camel-k-builder-dockerconfigjson
   ```
   
   4. Create an Integration in the same application namespace and select the 
profile:
   
   ```yaml
   apiVersion: camel.apache.org/v1
   kind: Integration
   metadata:
     name: my-application
     namespace: my-namespace
     annotations:
       camel.apache.org/integration-profile.id: my-profile
   spec:
     ...
   ```
   
   5. Wait for the IntegrationKit/Build to be generated.
   
   6. Inspect the generated `Build`.
   
   ### Actual result
   
   The generated Jib task contains:
   
   ```yaml
   jib:
     image: /camel-k/camel-k-kit-...:<tag>
     registry: {}
   ```
   
   and the build fails with `Invalid image reference`.
   
   ### Expected result
   
   The registry information from the selected `IntegrationProfile` should be 
used by the generated Build, for example:
   
   ```yaml
   jib:
     image: 
image-registry.openshift-image-registry.svc:5000/my-namespace/camel-k-kit-...:<tag>
   ```
   
   and the IntegrationKit should successfully build and push its image.
   
   The failure occurs because the generated Build already contains an invalid 
Jib image reference and an empty registry configuration.
   
   ### Related
   
   Possibly related to:
   
   - #6705 — Support registry configuration in IntegrationProfile
   
   
   ### Camel K or runtime version
   
   2.11.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to