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

Trying to get sample RestWithUndertow working #1175

Closed
waytoharish opened this issue Dec 30, 2019 · 18 comments
Closed

Trying to get sample RestWithUndertow working #1175

waytoharish opened this issue Dec 30, 2019 · 18 comments

Comments

@waytoharish
Copy link

Hi When trying to run the code getting this error-
{"level":"info","ts":1577616088.4333324,"logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"myproject","request-name":"rest-with-undertow"}
{"level":"info","ts":1577616088.4333866,"logger":"camel-k.controller.integration","msg":"Invoking action deploy","request-namespace":"myproject","request-name":"rest-with-undertow","api-version":"camel.apache.org/v1","kind":"Integration","ns":"myproject","name":"rest-with-undertow"}
{"level":"info","ts":1577616088.4334643,"logger":"camel-k.trait","msg":"Apply trait: camel"}
{"level":"info","ts":1577616088.441048,"logger":"camel-k.trait","msg":"Apply trait: knative"}
{"level":"info","ts":1577616088.4410796,"logger":"camel-k.trait","msg":"Apply trait: environment"}
{"level":"info","ts":1577616088.4410868,"logger":"camel-k.trait","msg":"Apply trait: deployer"}
{"level":"info","ts":1577616088.4416955,"logger":"camel-k.trait","msg":"Apply trait: gc"}
{"level":"info","ts":1577616088.442474,"logger":"camel-k.trait","msg":"Apply trait: knative-service"}
{"level":"info","ts":1577616088.4424946,"logger":"camel-k.trait","msg":"Apply trait: container"}
{"level":"info","ts":1577616088.4425054,"logger":"camel-k.traits","msg":"Environment variable POD_NAME uses fieldRef and cannot be set on a Knative service","trait":"container"}
{"level":"info","ts":1577616088.4425159,"logger":"camel-k.trait","msg":"Apply trait: jolokia"}
{"level":"info","ts":1577616088.442522,"logger":"camel-k.trait","msg":"Apply trait: prometheus"}
{"level":"info","ts":1577616088.4425256,"logger":"camel-k.trait","msg":"Apply trait: classpath"}
{"level":"info","ts":1577616088.4425483,"logger":"camel-k.trait","msg":"Apply trait: owner"}
{"level":"error","ts":1577616089.744228,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"integration-controller","request":"myproject/rest-with-undertow","error":"error executing post actions: error during replace resource: could not create or replace resource rest-with-undertow: no matches for kind "Service" in version "serving.knative.dev/v1"","errorVerbose":"no matches for kind "Service" in version "serving.knative.dev/v1"\ncould not create or replace resource rest-with-undertow\ngithub.com/apache/camel-k/pkg/util/kubernetes.ReplaceResource\n\tgithub.com/apache/camel-k@/pkg/util/kubernetes/replace.go:69\ngithub.com/apache/camel-k/pkg/util/kubernetes.ReplaceResources\n\tgithub.com/apache/camel-k@/pkg/util/kubernetes/replace.go:38\ngithub.com/apache/camel-k/pkg/trait.(*deployerTrait).Apply.func1\n\tgithub.com/apache/camel-k@/pkg/trait/deployer.go:64\ngithub.com/apache/camel-k/pkg/trait.Apply\n\tgithub.com/apache/camel-k@/pkg/trait/trait.go:52\ngithub.com/apache/camel-k/pkg/controller/integration.(*deployAction).Handle\n\tgithub.com/apache/camel-k@/pkg/controller/integration/deploy.go:56\ngithub.com/apache/camel-k/pkg/controller/integration.(*ReconcileIntegration).Reconcile\n\tgithub.com/apache/camel-k@/pkg/controller/integration/integration_controller.go:257\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:256\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:88\nruntime.goexit\n\truntime/asm_amd64.s:1357\nerror during replace resource\ngithub.com/apache/camel-k/pkg/trait.(*deployerTrait).Apply.func1\n\tgithub.com/apache/camel-k@/pkg/trait/deployer.go:65\ngithub.com/apache/camel-k/pkg/trait.Apply\n\tgithub.com/apache/camel-k@/pkg/trait/trait.go:52\ngithub.com/apache/camel-k/pkg/controller/integration.(*deployAction).Handle\n\tgithub.com/apache/camel-k@/pkg/controller/integration/deploy.go:56\ngithub.com/apache/camel-k/pkg/controller/integration.(*ReconcileIntegration).Reconcile\n\tgithub.com/apache/camel-k@/pkg/controller/integration/integration_controller.go:257\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:256\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:88\nruntime.goexit\n\truntime/asm_amd64.s:1357\nerror executing post actions\ngithub.com/apache/camel-k/pkg/trait.Apply\n\tgithub.com/apache/camel-k@/pkg/trait/trait.go:54\ngithub.com/apache/camel-k/pkg/controller/integration.(*deployAction).Handle\n\tgithub.com/apache/camel-k@/pkg/controller/integration/deploy.go:56\ngithub.com/apache/camel-k/pkg/controller/integration.(*ReconcileIntegration).Reconcile\n\tgithub.com/apache/camel-k@/pkg/controller/integration/integration_controller.go:257\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:256\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\tk8s.io/apimachinery@v0.0.0/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.4.0/pkg/internal/controller/controller.go:258\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\tsigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\tk8s.io/apimachinery@v0.0.0/pkg/util/wait/wait.go:88"}

@lburgazzoli
Copy link
Contributor

Can you add some more information about the environment ?

@waytoharish
Copy link
Author

I am using minishift on Laptop OCv3.11.Please let me know if you need any specific information

@lburgazzoli
Copy link
Contributor

would be nice to know the camel-k version, knative version, the command line used to run the code and how the camel-k operator is configured (i.e. provide the IntegrationPlatform custom resource)

@waytoharish
Copy link
Author

waytoharish commented Jan 2, 2020

I am running this on minishift 3.11. CamelK operator installed using "Kamel Install". Below is other details.

bash-3.2$ Kamel version
Camel K Client 1.0.0-RC1

Operator Imaged Used --
docker.io/apache/camel-k:1.0.0-RC1

Command used to run the code--
kamel run --name=withrest --dependency=camel-undertow examples/routes.js --dev

attached is the route.js
routes.txt

Please let me know if anything else required.

This issue i am facing with all the CamelK resource creation.

@lburgazzoli
Copy link
Contributor

What is the knative version you have installed ? camel-k now requires serving v1 api

@waytoharish
Copy link
Author

waytoharish commented Jan 2, 2020

I have not manually installed Knative. I have followed the CamelK document and there is no Knative install step.

@lburgazzoli
Copy link
Contributor

can you post the output of:

  1. oc get integrationplatform -o yaml
  2. oc get integration withrest -o yaml

@waytoharish
Copy link
Author

apiVersion: v1
items:

  • apiVersion: camel.apache.org/v1
    kind: IntegrationPlatform
    metadata:
    creationTimestamp: "2019-12-29T09:36:07Z"
    generation: 1
    labels:
    app: camel-k
    name: camel-k
    namespace: myproject
    resourceVersion: "394175"
    selfLink: /apis/camel.apache.org/v1/namespaces/myproject/integrationplatforms/camel-k
    uid: a3c04bf7-2a1e-11ea-97f0-ee6b7ed25c5d
    spec:
    build:
    maven:
    settings: {}
    registry: {}
    resources: {}
    status:
    build:
    baseImage: fabric8/s2i-java:3.0-java8
    buildStrategy: routine
    camelVersion: 3.0.0
    maven:
    localRepository: /tmp/artifacts/m2
    settings:
    configMapKeyRef:
    key: settings.xml
    name: camel-k-maven-settings
    timeout: 3m45s
    persistentVolumeClaim: camel-k
    publishStrategy: S2I
    runtimeVersion: 1.0.9
    timeout: 5m0s
    cluster: OpenShift
    phase: Ready
    version: 1.0.0-RC1
    kind: List
    metadata:
    resourceVersion: ""
    selfLink: ""

@waytoharish
Copy link
Author

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
creationTimestamp: "2020-01-04T00:59:49Z"
generation: 1
name: rest-with-undertow
namespace: myproject
resourceVersion: "395715"
selfLink: /apis/camel.apache.org/v1/namespaces/myproject/integrations/rest-with-undertow
uid: 81e84fee-2e8d-11ea-ae13-ee6b7ed25c5d
spec:
dependencies:

  • camel:rest

  • camel:undertow
    sources:

  • content: |
    import org.apache.camel.Exchange;

    public class RestWithUndertow extends org.apache.camel.builder.RouteBuilder {
    @OverRide
    public void configure() throws Exception {
    restConfiguration()
    .component("undertow")
    .host("0.0.0.0")
    .port("8080");

          rest()
              .get("/hello")
              .to("direct:hello");
    
          from("direct:hello")
              .setHeader(Exchange.CONTENT_TYPE, constant("text/plain"))
              .transform().simple("Hello World");
      }
    

    }
    name: RestWithUndertow.java
    status:
    camelVersion: 3.0.0
    conditions:

  • lastTransitionTime: "2020-01-04T00:59:49Z"
    lastUpdateTime: "2020-01-04T00:59:49Z"
    message: camel-k
    reason: IntegrationPlatformAvailable
    status: "True"
    type: IntegrationPlatformAvailable

  • lastTransitionTime: "2020-01-04T00:59:49Z"
    lastUpdateTime: "2020-01-04T00:59:49Z"
    message: kit-bo482dvklieifgubding
    reason: IntegrationKitAvailable
    status: "True"
    type: IntegrationKitAvailable
    dependencies:

  • camel:bean

  • camel:direct

  • camel:rest

  • camel:undertow

  • mvn:org.apache.camel.k/camel-k-loader-java

  • mvn:org.apache.camel.k/camel-k-runtime-main
    digest: vvHNXOk365j03swlFVbjGx9SiGN717onOQ6H8qki1w78
    image: 172.30.1.1:5000/myproject/camel-k-kit-bo482dvklieifgubding:152015
    kit: kit-bo482dvklieifgubding
    phase: Deploying
    platform: camel-k
    profile: Knative
    runtimeVersion: 1.0.9
    version: 1.0.0-RC1

@lburgazzoli
Copy link
Contributor

looks like camel-k thinks you have knative installed somehow. can you try to delete the integration kits and run it again ?

oc delete integrationkits --all
oc delete integrations --all

I'm trying to install minishift but experiencing few issues to get it running

@lburgazzoli
Copy link
Contributor

I did try to reproduce the issue but it works for me so to me it looks like your minishift set-up is somehow broken, can you try to recreate it ?

@waytoharish
Copy link
Author

So just to let you know i do have Knative installed and running for other OpenShift NameSpace not the one i am running using Camel and if this is the case then this is BIg issue in my view.What do you think we can not have 2 different NameSpaces one belong to Knative and one for CamelK on minishift ??

@oscerd
Copy link
Contributor

oscerd commented Jan 6, 2020

Is there a specific reason you can't have knative on the same namespace?

@lburgazzoli
Copy link
Contributor

in that case you have different options:

  • install a knative version compatible with camel-k 1.0.0-RC1
  • disable knative injection in your namespace
  • configure the IntegrationPlatform to use the OpenShift profile by default i.e. upon installation you can use the flag --trait-profile OpenShift
  • run the integration with a specific profile with --profile OpenShift

@waytoharish
Copy link
Author

waytoharish commented Jan 6, 2020

Please could you help me how to do the same since i am using minishift. Like this a common scenario and everybody can stuck with

@lburgazzoli
Copy link
Contributor

the simplest thing you can do is:

kamel run --name=withrest --dependency=camel-undertow examples/routes.js --dev --profile OpenShift

this will instruct camel-k to deploy applications without taking into account knative

@waytoharish
Copy link
Author

Thanks. Let me try to test this and will update you

@waytoharish
Copy link
Author

Got it working now. Thanks

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