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

kamel run --output yaml does not include resources #3396

Closed
sidharthramesh opened this issue Jun 26, 2022 · 2 comments
Closed

kamel run --output yaml does not include resources #3396

sidharthramesh opened this issue Jun 26, 2022 · 2 comments
Labels
kind/question Further information is requested

Comments

@sidharthramesh
Copy link

Steps to reproduce

I'm trying to get the output of an Integration in YAML to be applied later via GitOps using ArgoCD.
My Java file with modeline looks like this:

// camel-k: name=hl7-sink language=java resource=file:composition.jslt resource=file:patient.jslt property=file:application.properties dependency=mvn:org.apache.camel.quarkus:camel-quarkus-hl7 dependency=mvn:org.apache.camel.quarkus:camel-quarkus-base64

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.camel.AggregationStrategy;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.util.Terser;

public class Sink extends RouteBuilder {
  AggregationStrategy combinedData = (oldExchange, newExchange) -> {
    if (oldExchange != null) {
      HashMap<String, String> oldData = oldE...
...

Running kamel run Sink.java -o yaml produces YAML:

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  annotations:
    networking.knative.dev/disable-auto-tls: "true"
  creationTimestamp: null
  name: hl7-sink
  namespace: default
spec:
  dependencies:
  - mvn:org.apache.camel.quarkus:camel-quarkus-hl7
  - mvn:org.apache.camel.quarkus:camel-quarkus-base64
  sources:
  - content: |
      // camel-k: name=hl7-sink language=java resource=file:composition.jslt resource=file:patient.jslt property=file:application.properties dependency=mvn:org.apache.camel.quarkus:camel-quarkus-hl7 dependency=mvn:org.apache.camel.quarkus:camel-quarkus-base64 annotation=networking.knative.dev/disable-auto-tls=true trait=owner.target-annotations=networking.knative.dev/disable-auto-tls

      import java.util.ArrayList;
      import java.util.HashMap;
      import java.util.List;
      import java.util.Map;
...
...
...
traits:
    camel:
      configuration:
        properties:
        - fhirUrl = example.com
        - openehrUrl = example.com
        - templateId = string
        - blobUpload = example.com
    mount:
      configuration:
        resources:
        - configmap:cm-05e3ce58d0d145de025ad919cf0b763216b88cf5/composition.jslt@/etc/camel/resources/composition.jslt
        - configmap:cm-2298cb03631fddcc33ab4d3832953f3e535d37b2/patient.jslt@/etc/camel/resources/patient.jslt
    owner:
      configuration:
        targetAnnotations:
        - networking.knative.dev/disable-auto-tls

The resources composition.jslt and patient.jslt are applied to the Kubernetes cluster as configmaps, and their reference is present here. But they are not included in the YAML output.

Expected

The YAML file should include the resources, configmaps, and secrets generated from files along with the the integration CRD.

@squakez
Copy link
Contributor

squakez commented Jun 27, 2022

Resource field is deprecated since a while (a73dce3#diff-df704f21201b6d30fe851b7bee054f77855f8b5720e77d93e8462fffb9c71cb3) and will be soon removed. Instead you should use configmap or secret. As you can see in your code, the resource is converted into a configmap automatically for you and exported as:

        resources:
        - configmap:cm-05e3ce58d0d145de025ad919cf0b763216b88cf5/composition.jslt@/etc/camel/resources/composition.jslt
        - configmap:cm-2298cb03631fddcc33ab4d3832953f3e535d37b2/patient.jslt@/etc/camel/resources/patient.jslt

However, for portability this is not good. In such case you need to use configmap on your own.

@squakez squakez added the kind/question Further information is requested label Jun 27, 2022
@squakez
Copy link
Contributor

squakez commented Jul 13, 2022

Closing as answered. Feel free to reach out for more info.

@squakez squakez closed this as completed Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants