lsergio commented on issue #6006:
URL: https://github.com/apache/camel-k/issues/6006#issuecomment-2558509338

   @squakez I did some investigation and have some interesting news:
   
   I changed the operator log level to debug and with that I see these messages 
in the operator log:
   
   ```
   Matching integration
   Integration and integration-kit traits do not match
   No match found between integration and integrationkit. Resetting 
integration's integrationkit to empty
   ```
   
   I tracked the code and realized this happens when the Matches function on 
the CamelTrait returns false:
   
   ```
   func (t *camelTrait) Matches(trait Trait) bool {
        otherTrait, ok := trait.(*camelTrait)
        if !ok {
                return false
        }
        return otherTrait.RuntimeVersion == t.RuntimeVersion
   }
   ```
   
   I added some debugging messages and found out that 
`otherTrait.RuntimeVersion` is "" and `t.RuntimeVersion` is "3.15.0", which is 
set as the default runtime at the Integration Platform.
   If I add the runtimeVersion to my Integration, I see both variables match 
the value I set and the  Integrations builds.
   
   Also, I have eventually seen `t.RuntimeVersion` as 3.8.1, although I haven't 
identified the specific scenario. Trying to understand why, I found this 
function:
   
   ```
   func determineRuntimeVersion(e *Environment) (string, error) {
        if e.Integration != nil && e.Integration.Status.RuntimeVersion != "" {
                return e.Integration.Status.RuntimeVersion, nil
        }
        if e.IntegrationKit != nil && e.IntegrationKit.Status.RuntimeVersion != 
"" {
                return e.IntegrationKit.Status.RuntimeVersion, nil
        }
        if e.IntegrationProfile != nil && 
e.IntegrationProfile.Status.Build.RuntimeVersion != "" {
                return e.IntegrationProfile.Status.Build.RuntimeVersion, nil
        }
        if e.Platform != nil && e.Platform.Status.Build.RuntimeVersion != "" {
                return e.Platform.Status.Build.RuntimeVersion, nil
        }
        return "", errors.New("unable to determine runtime version")
   }
   
   ```
   and decided to check the locations where it can get the runtime from.
   Checking the `IntegrationPlatform` a see that 
`e.Platform.Status.Build.RuntimeVersion` is `3.8.1`, even when the trait in the 
spec says `3.15.0`. So that might be the reason I see 3.8.1 every now and then.
   
   Here are the yamls for the platform:
   
   ```
   apiVersion: camel.apache.org/v1
   kind: IntegrationPlatform
   metadata:
     annotations:
       meta.helm.sh/release-name: camel-k
       meta.helm.sh/release-namespace: mynamespace
     creationTimestamp: "2024-11-05T13:33:19Z"
     generation: 11
     labels:
       app: camel-k
       app.kubernetes.io/instance: camel-k
       app.kubernetes.io/managed-by: Helm
       app.kubernetes.io/name: camel-k
       app.kubernetes.io/version: 2.4.0
       helm.sh/chart: camel-k-2.4.0
     name: camel-k
     namespace: mynamespace
     resourceVersion: "114457626"
     uid: f02efcf5-555d-4009-ba04-500e355f8774
   spec:
     build:
       baseImage: *** omitted ***
       buildConfiguration:
         orderStrategy: sequential
       maven:
         settings:
           configMapKeyRef:
             key: settings.xml
             name: camel-k-maven-settings
         settingsSecurity: {}
       maxRunningBuilds: 3
       publishStrategy: Jib
       registry:
         address: gcr.io
         organization: registry-ipaas-testing
         secret: gcr-json-key
     cluster: ""
     kamelet: {}
     traits:
       builder:
         incrementalImageBuild: true
         nodeSelector:
           kubernetes.io/arch: amd64
       camel:
         runtimeVersion: 3.15.0 <--- default runtime set as 3.15.0
       deployment:
         progressDeadlineSeconds: 600
       pull-secret:
         secretName: gcr-json-key
   status:
     build:
       baseImage: *** omitted ***
       buildConfiguration:
         orderStrategy: sequential
         strategy: routine
       maven:
         cliOptions:
         - -V
         - --no-transfer-progress
         - -Dstyle.color=never
         localRepository: /etc/maven/m2
         settings:
           configMapKeyRef:
             key: settings.xml
             name: camel-k-maven-settings
       maxRunningBuilds: 3
       publishStrategy: Jib
       registry:
         address: gcr.io
         organization: registry-ipaas-testing
         secret: gcr-json-key
       runtimeVersion: 3.8.1                         <-- but here we see 3.8.1
       timeout: 5m0s
     cluster: Kubernetes
     conditions:
     - lastTransitionTime: "2024-11-05T13:33:41Z"
       lastUpdateTime: "2024-11-05T13:33:41Z"
       message: integration platform created
       reason: IntegrationPlatformCreated
       status: "True"
       type: Created
     - lastTransitionTime: "2024-11-05T13:33:41Z"
       lastUpdateTime: "2024-11-05T13:33:41Z"
       message: registry available at gcr.io
       reason: IntegrationPlatformRegistryAvailable
       status: "True"
       type: RegistryAvailable
     - lastTransitionTime: "2024-11-05T13:33:41Z"
       lastUpdateTime: "2024-11-05T13:33:41Z"
       message: camel catalog 3.8.1 available
       reason: IntegrationPlatformCamelCatalogAvailable
       status: "True"
       type: CamelCatalogAvailable
     info:
       gitCommit: 218830ac2f8fcf0ed1813c49343a187433e76bec
       goOS: linux
       goVersion: go1.22.6
     kamelet:
       repositories:
       - uri: none
     observedGeneration: 11
     phase: Ready
     traits:
       builder:
         incrementalImageBuild: true
         nodeSelector:
           kubernetes.io/arch: amd64
       camel:
         runtimeVersion: 3.15.0
       deployment:
         progressDeadlineSeconds: 600
       pull-secret:
         secretName: gcr-json-key
     version: 2.4.0
   
   ```
   
   and the integration:
   
   ```
   apiVersion: camel.apache.org/v1
   kind: Integration
   metadata:
     annotations:
       kubectl.kubernetes.io/last-applied-configuration: |
         
{"apiVersion":"camel.apache.org/v1","kind":"Integration","metadata":{"annotations":{},"name":"bugproperties","namespace":"mynamespace"},"spec":{"sources":[{"content":"-
 from:\n    uri: rest:get:/demo\n    steps:\n    - setBody:\n        constant: 
\"It 
worked\"","name":"main.yaml"}],"traits":{"camel":{"properties":["hello=world"]},"health":{"enabled":true}}}}
     creationTimestamp: "2024-12-22T16:12:36Z"
     generation: 1
     name: bugproperties
     namespace: mynamespace
     resourceVersion: "114464491"
     uid: 7ed347a8-672f-4603-87df-30c51e428033
   spec:
     sources:
     - content: |-
         - from:
             uri: rest:get:/demo
             steps:
             - setBody:
                 constant: "It worked"
       name: main.yaml
     traits:
       camel:
         properties:
         - hello=world
       health:
         enabled: true
   status:
     conditions:
     - firstTruthyTime: "2024-12-22T16:12:36Z"
       lastTransitionTime: "2024-12-22T16:12:36Z"
       lastUpdateTime: "2024-12-22T16:12:36Z"
       message: mynamespace/camel-k
       reason: IntegrationPlatformAvailable
       status: "True"
       type: IntegrationPlatformAvailable
     - firstTruthyTime: "2024-12-22T16:12:36Z"
       lastTransitionTime: "2024-12-22T16:12:36Z"
       lastUpdateTime: "2024-12-22T16:12:36Z"
       message: 'Applied traits: camel,deployer,quarkus'
       reason: TraitConfiguration
       status: "True"
       type: TraitInfo
     - lastTransitionTime: "2024-12-22T16:12:36Z"
       lastUpdateTime: "2024-12-22T16:12:36Z"
       message: creating a new integration kit
       reason: IntegrationKitAvailable
       status: "False"
       type: IntegrationKitAvailable
     dependencies:
     - camel:core
     - camel:rest
     - mvn:org.apache.camel.k:camel-k-runtime
     - mvn:org.apache.camel.quarkus:camel-quarkus-microprofile-health
     - mvn:org.apache.camel.quarkus:camel-quarkus-yaml-dsl
     digest: vmrW8li13LSQOZxBCu5tzQFsUSXwVq6g9IpqbfVDQ5f4
     lastInitTimestamp: "2024-12-22T16:12:36Z"
     observedGeneration: 1
     phase: Building Kit
     platform: camel-k
     profile: Knative
     runtimeProvider: quarkus
     runtimeVersion: 3.15.0
     version: 2.4.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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to