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

Error: unknown flag: --trait on local build #2776

Closed
scodeman opened this issue Nov 24, 2021 · 4 comments
Closed

Error: unknown flag: --trait on local build #2776

scodeman opened this issue Nov 24, 2021 · 4 comments
Assignees

Comments

@scodeman
Copy link

scodeman commented Nov 24, 2021

As per #2769 I am trying to build a local integration image and use it in for my integration manifest.
I have the following IntegrationFile.java simple java DSL example with modelines:

// camel-k: language=java
// camel-k: trait=container.enabled=true
// camel-k: trait=container.image=localhost:5000/camelk_test:latest

import org.apache.camel.builder.RouteBuilder;

public class IntegrationFile extends RouteBuilder {
  @Override
  public void configure() throws Exception {

      // Write your routes here, for example:
      from("timer:java?period=1000")
        .routeId("java")
        .setBody()
          .simple("Hello Camel K from ${routeId}")
        .to("log:info");

  }
}

But it fails to local build kamel local build IntegrationFile.java with the following error reported

Modeline options have been loaded from source files
Full command: kamel local build IntegrationFile.java --trait=container.enabled=true --trait=container.image=localhost:5000/camelk_test:latest 
Error: unknown flag: --trait
@scodeman
Copy link
Author

scodeman commented Nov 24, 2021

Note that the dry-run (cf:#2769) kamel run IntegrationFile.java -o yaml call works as expected providing me the following output

Modeline options have been loaded from source files
Full command: kamel run IntegrationFile.java -o yaml --trait=container.enabled=true --trait=container.image=localhost:5000/camelk_test:latest 
apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  creationTimestamp: null
  name: integration-file
  namespace: default
spec:
  sources:
  - content: |
      // camel-k: language=java
      // camel-k: trait=container.enabled=true
      // camel-k: trait=container.image=localhost:5000/camelk_test:latest

      import org.apache.camel.builder.RouteBuilder;

      public class IntegrationFile extends RouteBuilder {
        @Override
        public void configure() throws Exception {

            // Write your routes here, for example:
            from("timer:java?period=1000")
              .routeId("java")
              .setBody()
                .simple("Hello Camel K from ${routeId}")
              .to("log:info");

        }
      }
    name: IntegrationFile.java
  traits:
    container:
      configuration:
        enabled: true
        image: localhost:5000/camelk_test:latest
status: {}

@squakez
Copy link
Contributor

squakez commented Nov 24, 2021

The Trait feature is something mainly thought to tune your integration on a Kubernetes platform, reason why it's not present in the kamel local command.

@tadayosi
Copy link
Member

Duplicate of #2499

@tadayosi tadayosi marked this as a duplicate of #2499 Jan 14, 2022
@tadayosi tadayosi self-assigned this Feb 14, 2022
@tadayosi
Copy link
Member

Let me close this in favour of #2499

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

3 participants