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

Integration stuck at Building Kit if properties are defined, but the runtime is not #6006

Open
lsergio opened this issue Dec 18, 2024 · 6 comments
Labels
kind/bug Something isn't working

Comments

@lsergio
Copy link
Contributor

lsergio commented Dec 18, 2024

What happened?

Consider the following Integration:

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  name: bugproperties
spec:  
  sources:
  - name: main.yaml
    content: |-
      - from:
          uri: rest:get:/demo
          steps:
          - setBody:
              constant: "It worked"
  traits:
    health:
      enabled: true
    camel:
      properties:
      - hello=world

When I apply it to my cluster, the Integrations remains stuck at Building Kit:

k get it
NAME            PHASE          READY   RUNTIME PROVIDER   RUNTIME VERSION   KIT   REPLICAS
bugproperties   Building Kit           quarkus            3.2.3                   

If I include the runtimeVersion at the camel trait:

    camel:
      runtimeVersion: 3.2.3
      properties:
      - hello=world

or remove the trait completely, the integration build finishes successfully.

I checked the operator log and there is no error message related to the trait. Logs look good as usual.

Steps to reproduce

No response

Relevant log output

No response

Camel K version

2.4.0

@lsergio lsergio added the kind/bug Something isn't working label Dec 18, 2024
@squakez
Copy link
Contributor

squakez commented Dec 19, 2024

Can you verify the status of IntegrationKit and Build resources as well? I think that you have some building against the default Camel version (3.8.1 in Camel K 2.4.0) which are failing for some reason. Likely, setting the runtime version would reuse the existing Kit.

@lsergio
Copy link
Contributor Author

lsergio commented Dec 20, 2024

@squakez sure. Here are some more details.

My Integrationplatform is setup so the default runtime is 3.2.3:

  traits:
    builder:
      incrementalImageBuild: true
      nodeSelector:
        kubernetes.io/arch: amd64
    camel:
      runtimeVersion: 3.2.3
    deployment:
      progressDeadlineSeconds: 600
    pull-secret:
      secretName: gcr-json-key

This is the status of the kit, build and Integration:


kubectl get it,ik,build
NAME                                         PHASE          READY   RUNTIME PROVIDER   RUNTIME VERSION   KIT   REPLICAS
integration.camel.apache.org/bugproperties   Building Kit           quarkus            3.2.3                   

NAME                                                       ALIAS   PHASE   TYPE       LAYOUT     IMAGE                                                                                                                                    ROOT
integrationkit.camel.apache.org/kit-ctil23aacioc739qcn30           Ready   platform   fast-jar   gcr.io/registry-ipaas-testing/camel-k-kit-ctil23aacioc739qcn30@sha256:da2200eb18d562ed763b8ca391e377c0be36c06d19027c0571a27585cadb486e   ***root image omitted***

NAME                                              PHASE       AGE    STARTED   DURATION         ATTEMPTS
build.camel.apache.org/kit-ctil23aacioc739qcn30   Succeeded   3m1s   3m1s      2m7.704334665s   

And these are the final log messages from the operator:

{"level":"info","ts":"2024-12-20T11:14:20Z","logger":"camel-k.controller.build","msg":"Build duration 2m7.704334665s","request-namespace":"mynamespace","request-name":"bugproperties","build-attempt":0,"build-result":"Succeeded","build-duration":127.704334665,"api-version":"camel.apache.org/v1","kind":"Build","ns":"mynamespace","name":"kit-ctil23aacioc739qcn30"}
{"level":"info","ts":"2024-12-20T11:14:20Z","logger":"camel-k.controller.build","msg":"State transition","request-namespace":"mynamespace","request-name":"kit-ctil23aacioc739qcn30","api-version":"camel.apache.org/v1","kind":"Build","ns":"mynamespace","name":"kit-ctil23aacioc739qcn30","phase-from":"Running","phase-to":"Succeeded"}
{"level":"info","ts":"2024-12-20T11:14:20Z","logger":"camel-k.controller.integrationkit","msg":"Invoking action build","request-namespace":"mynamespace","request-name":"kit-ctil23aacioc739qcn30","api-version":"camel.apache.org/v1","kind":"IntegrationKit","ns":"mynamespace","name":"kit-ctil23aacioc739qcn30"}
{"level":"info","ts":"2024-12-20T11:14:20Z","logger":"camel-k.controller.integrationkit","msg":"State transition","request-namespace":"mynamespace","request-name":"kit-ctil23aacioc739qcn30","api-version":"camel.apache.org/v1","kind":"IntegrationKit","ns":"mynamespace","name":"kit-ctil23aacioc739qcn30","phase-from":"Build Running","phase-to":"Ready"}
{"level":"info","ts":"2024-12-20T11:14:20Z","logger":"camel-k","msg":"Kit kit-ctil23aacioc739qcn30 ready, notify integration: bugproperties"}
{"level":"info","ts":"2024-12-20T11:14:20Z","logger":"camel-k.controller.integrationkit","msg":"Invoking action monitor","request-namespace":"mynamespace","request-name":"kit-ctil23aacioc739qcn30","api-version":"camel.apache.org/v1","kind":"IntegrationKit","ns":"mynamespace","name":"kit-ctil23aacioc739qcn30"}

I'll test with other default runtimes and let you know if the behavior changes.

@lsergio
Copy link
Contributor Author

lsergio commented Dec 20, 2024

Using either runtime 3.8.1 or 3.15.0 as default doesn't change the results.

@lsergio
Copy link
Contributor Author

lsergio commented Dec 20, 2024

Also, I have deleted all the Integration Kits and restarted the operator before each test.

@squakez
Copy link
Contributor

squakez commented Dec 22, 2024

Is there any warning condition in the Integration resource? Can you provide the -o yaml output of that?

@lsergio
Copy link
Contributor Author

lsergio commented Dec 22, 2024

@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













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

No branches or pull requests

2 participants