You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/04/12 18:27:46 UTC

[GitHub] [camel-k] moehajj edited a comment on issue #2205: Expose gRPC endpoint with Knative serving

moehajj edited a comment on issue #2205:
URL: https://github.com/apache/camel-k/issues/2205#issuecomment-817999876


   ```
   apiVersion: camel.apache.org/v1
   kind: Integration
   metadata:
     creationTimestamp: "2021-04-12T17:32:58Z"
     generation: 1
     name: sample-grpc-camel-route
     namespace: camel-k
     resourceVersion: "154392144"
     selfLink: /apis/camel.apache.org/v1/namespaces/camel-k/integrations/sample-grpc-camel-route
     uid: ca791fb8-2902-4af0-b508-ad9eb0a72249
   spec:
     dependencies:
     - mvn:com.sample.compute:compute-proto:1.0.0-SNAPSHOT
     - mvn:org.apache.camel:camel-grpc:3.9.0
     - mvn:org.apache.camel:camel-componentdsl:3.9.0
     sources:
     - content: |-
         package com.sample.compute.service.grpc;
   
         import com.google.protobuf.ByteString;
         import com.sample.compute.ComputeRequest;
         import com.sample.compute.ComputeResponse;
         import com.sample.compute.Payload;
         import org.apache.camel.Message;
         import org.apache.camel.builder.RouteBuilder;
   
         import java.nio.charset.StandardCharsets;
   
         public class SampleGrpcCamelRoute extends RouteBuilder {
   
             @Override
             public void configure() throws Exception {
                 fromF("grpc://localhost:9000/com.sample.compute.ComputeService?synchronous=true")
                         .process(exchange -> {
                             final Message message = exchange.getMessage();
                             final ComputeRequest request = message.getBody(ComputeRequest.class);
   
                             final String scriptOutputBody = "Hello World!";
   
                             final Payload responsePayload = Payload.newBuilder()
                                     .setPayload(ByteString.copyFrom(scriptOutputBody.getBytes(StandardCharsets.UTF_8)))
                                     .build();
                             final ComputeResponse response = ComputeResponse.newBuilder()
                                     .setPayload(responsePayload)
                                     .build();
   
                             message.setBody(response);
                         });
             }
         }
       name: SampleGrpcCamelRoute.java
     traits:
       container:
         configuration:
           servicePort: 9000
           servicePortName: h2c
       knative:
         configuration:
           enabled: true
       knative-service:
         configuration:
           auto: true
           class: kpa.autoscaling.knative.dev
           enabled: true
           maxScale: 1
           minScale: 1
   status:
     conditions:
     - firstTruthyTime: "2021-04-12T17:32:58Z"
       lastTransitionTime: "2021-04-12T17:32:58Z"
       lastUpdateTime: "2021-04-12T17:32:58Z"
       message: camel-k
       reason: IntegrationPlatformAvailable
       status: "True"
       type: IntegrationPlatformAvailable
     - firstTruthyTime: "2021-04-12T17:33:12Z"
       lastTransitionTime: "2021-04-12T17:33:12Z"
       lastUpdateTime: "2021-04-12T17:33:12Z"
       message: kit-c1q88iiga9qjbbv623lg
       reason: IntegrationKitAvailable
       status: "True"
       type: IntegrationKitAvailable
     - lastTransitionTime: "2021-04-12T17:33:12Z"
       lastUpdateTime: "2021-04-12T17:33:12Z"
       message: different controller strategy used (deployment)
       reason: CronJobNotAvailableReason
       status: "False"
       type: CronJobAvailable
     - firstTruthyTime: "2021-04-12T17:33:12Z"
       lastTransitionTime: "2021-04-12T17:33:12Z"
       lastUpdateTime: "2021-04-12T17:33:12Z"
       message: deployment name is sample-grpc-camel-route
       reason: DeploymentAvailable
       status: "True"
       type: DeploymentAvailable
     - firstTruthyTime: "2021-04-12T17:33:15Z"
       lastTransitionTime: "2021-04-12T17:33:15Z"
       lastUpdateTime: "2021-04-12T17:33:15Z"
       reason: ReplicaSetReady
       status: "True"
       type: Ready
     dependencies:
     - mvn:com.sample.compute:compute-proto:1.0.0-SNAPSHOT
     - mvn:org.apache.camel.k/camel-k-loader-java
     - mvn:org.apache.camel.k/camel-k-runtime
     - mvn:org.apache.camel:camel-componentdsl:3.9.0
     - mvn:org.apache.camel:camel-grpc:3.9.0
     digest: voLtPQb2I5N8-AC5xlk4fAJWTa8uBsZd-GEsQ16Enk7s
     image: quay.io/verygoodsecurity/camel-k-kit-c1q88iiga9qjbbv623lg@sha256:473ee4ebb3aefe32ee22fd771a645f96471baf592e5510a7977e9e27841d8e2f
     kit: kit-c1q88iiga9qjbbv623lg
     lastInitTimestamp: "2021-04-12T17:32:58Z"
     phase: Running
     platform: camel-k
     profile: knative
     replicas: 1
     runtimeProvider: quarkus
     runtimeVersion: 1.6.0
     selector: camel.apache.org/integration=sample-grpc-camel-route
     version: 1.3.1
   ```


-- 
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.

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