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

Build error when using traits #1648

Closed
squakez opened this issue Jul 30, 2020 · 13 comments
Closed

Build error when using traits #1648

squakez opened this issue Jul 30, 2020 · 13 comments

Comments

@squakez
Copy link
Contributor

squakez commented Jul 30, 2020

Hi team,
I am using kamel version 1.0.1 to run some integration. It seems that when I tries using traits (Jolokia, for instance), the operator build fails with this trace error:

{"level":"info","ts":1596093483.0354865,"logger":"camel-k.controller.integration","msg":"Invoking action platform-setup","request-namespace":"syndesis","request-name":"hello","api-version":"camel.apache.org/v1","kind":"Integration","ns":"syndesis","name":"hello"}
{"level":"error","ts":1596093483.0358343,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"integration-controller","request":"syndesis/hello","error":"error during trait customization: json: cannot unmarshal string into Go struct field jolokiaTrait.enabled of type bool","errorVerbose":"json: cannot unmarshal string into Go struct field jolokiaTrait.enabled of type bool\nerror during trait customization\ngithub.com/apache/camel-k/pkg/trait.Apply\n\tgithub.com/apache/camel-k@/pkg/trait/trait.go:47\ngithub.com/apache/camel-k/pkg/controller/integration.(*platformSetupAction).Handle\n\tgithub.com/apache/camel-k@/pkg/controller/integration/platform_setup.go:54\ngithub.com/apache/camel-k/pkg/controller/integration.(*ReconcileIntegration).Reconcile\n\tgithub.com/apache/camel-k@/pkg/controller/integration/integration_controller.go:273\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:256\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:88\nruntime.goexit\n\truntime/asm_amd64.s:1357","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tgithub.com/go-logr/zapr@v0.1.1/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:258\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:88"}

This is coming from a simple integration as below:

$ kamel describe integration hello
Name:                hello
Namespace:           syndesis
Creation Timestamp:  Thu, 30 Jul 2020 09:17:53 +0200
Phase:               
Runtime Version:     
Kit:                 
Image:               
Version:             
Sources:
  Name          Language  Compression  Ref  Ref Key
  hello.groovy  groovy    false             
Traits:
  Jolokia:
    Configuration:
      Enabled:  true

It happens the same with Prometheus trait, which are the ones I am using.

@nicolaferraro
Copy link
Member

Perhaps latest changes in trait serialization/deserialization changed the way props should be set in the struct.

I guess that setting enabled: true instead of enabled: "true" is a workaround.

I don't know if we can/should improve mapping to overcome this issue (@astefanutti).

@nicolaferraro
Copy link
Member

@squakez can you paste kubectl get it -o yaml to check if that's the issue?

@squakez
Copy link
Contributor Author

squakez commented Aug 3, 2020

Thanks @nicolaferraro, this is the output of the failing integration:

apiVersion: v1
items:
- apiVersion: camel.apache.org/v1
  kind: Integration
  metadata:
    creationTimestamp: 2020-08-03T12:59:22Z
    generation: 1
    managedFields:
    - apiVersion: camel.apache.org/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:spec:
          .: {}
          f:sources: {}
          f:traits:
            .: {}
            f:jolokia:
              .: {}
              f:configuration:
                .: {}
                f:enabled: {}
        f:status: {}
      manager: kamel
      operation: Update
      time: 2020-08-03T12:59:22Z
    name: hello
    namespace: syndesis
    resourceVersion: "622532"
    selfLink: /apis/camel.apache.org/v1/namespaces/syndesis/integrations/hello
    uid: 32a7ae33-5792-4659-9dc5-2285c9cab3a1
  spec:
    sources:
    - content: |
        from('timer:tick?period=3000')
          .setBody().constant('Hello world from Camel K!')
          .to('log:info')
      name: hello.groovy
    traits:
      jolokia:
        configuration:
          enabled: "true"
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

I've double checked the configuration and actually my kamel CLI installed version is 1.0.0 whilst the operator deployed image points to 1.1.0, not sure if those are meant to be incompatible.

@astefanutti
Copy link
Member

Right, the camel-k 1.1.0 operator is not compatible with the kamel 1.0.0 CLI. One option is to use kamel 1.1.0. Generally, using on par CLI is a good safety measure. It may be possible to handle downward compatibility, though that would ideally be a case for introducing a new API version, which comes with extra costs.

@squakez
Copy link
Contributor Author

squakez commented Aug 4, 2020

Thanks @astefanutti , I am good with aligning CLI and operator. Maybe some warning in case of a CLI operating on a different operator version may be good to let the user know about that. I can create an issue requesting that.

@squakez squakez closed this as completed Aug 4, 2020
@astefanutti
Copy link
Member

@squakez thanks for the feedback. I agree with you a warning would be useful.

@nicolaferraro
Copy link
Member

Got the same issue with client and operator from master:

Running:

kamel run source.yaml -t quarkus.enabled=true

Operator logs:

{"level":"error","ts":1596706872.1788838,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"integration-controller","request":"camel-nf-sinkbinding/source","error":"IntegrationKit.camel.apache.org \"kit-bslt0e7ft8fnqb4uj5h0\" is invalid: spec.traits.quarkus.configuration.enabled: Invalid value: \"boolean\": spec.traits.quarkus.configuration.enabled in body must be of type string: \"boolean\"","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/nferraro/go/pkg/mod/github.com/go-logr/zapr@v0.1.1/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/home/nferraro/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:258\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/nferraro/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\t/home/nferraro/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/home/nferraro/go/pkg/mod/k8s.io/apimachinery@v0.17.6/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/home/nferraro/go/pkg/mod/k8s.io/apimachinery@v0.17.6/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\t/home/nferraro/go/pkg/mod/k8s.io/apimachinery@v0.17.6/pkg/util/wait/wait.go:88"}

@nicolaferraro nicolaferraro reopened this Aug 6, 2020
@nicolaferraro nicolaferraro added this to the 1.1.1 milestone Aug 6, 2020
@nicolaferraro
Copy link
Member

My problem was that even kubectl apply couldn't manage to update the integrationkit CRD on an existing cluster, without returning any error (may there be some operator replacing the CRD?).

@astefanutti astefanutti removed this from the 1.1.1 milestone Aug 6, 2020
@jamesnetherton
Copy link
Contributor

Is this fixed on master? I think I'm seeing a similar problem.

kamel run examples/Sample.java -t quarkus.enabled=true
{"level":"error","ts":1597937313.632321,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"integration-controller","request":"camel-k/sample","error":"IntegrationKit.camel.apache.org \"kit-bsv9d8aiqjq5bpuijdp0\" is invalid: spec.traits.quarkus.configuration.enabled: Invalid value: \"boolean\": spec.traits.quarkus.configuration.enabled in body must be of type string: \"boolean\"","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\tgithub.com/go-logr/zapr@v0.1.1/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:258\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\tsigs.k8s.io/controller-runtime@v0.5.2/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\tk8s.io/apimachinery@v0.18.2/pkg/util/wait/wait.go:88"}

@astefanutti
Copy link
Member

@jamesnetherton it should be :) Could you check the kamel CLI and the operator versions are aligned?

@jamesnetherton
Copy link
Contributor

@jamesnetherton it should be :) Could you check the kamel CLI and the operator versions are aligned?

They should be because I've built them from the latest source. I'm actually running the operator from my IDE against a local cluster. Then creating integrations with the freshly built kamel binary as per normal.

It's my first time hacking on the project in 6 months, so there's a chance I've screwed something up 😛.

@astefanutti
Copy link
Member

astefanutti commented Aug 20, 2020

It's my first time hacking on the project in 6 months, so there's a chance I've screwed something up 😛.

I'll let you argue with CI 😉. Joke aside, have you re-installed the CRDs?

@jamesnetherton
Copy link
Contributor

have you re-installed the CRDs?

Yep, that was it. I had stale CRDs 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants