From 0f82384e4488d0231a402b3dd5913b0a6abc96a8 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Tue, 5 Dec 2023 10:15:21 +0100 Subject: [PATCH] doc: synthetic Integrations --- docs/modules/ROOT/nav.adoc | 3 +- docs/modules/ROOT/pages/running/import.adoc | 42 +++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 docs/modules/ROOT/pages/running/import.adoc diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index f13dbd7efa..68fc46113b 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -19,8 +19,9 @@ ** xref:running/dev-mode.adoc[Developer mode] ** xref:running/dry-run.adoc[Dry run] ** xref:running/runtime-version.adoc[Camel version] -** xref:running/camel-runtimes.adoc[Camel runtimes] ** xref:running/quarkus-native.adoc[Quarkus Native] +** xref:running/camel-runtimes.adoc[Camel runtimes] +** xref:running/import.adoc[Import existing Camel apps] ** xref:running/run-from-github.adoc[Run from GitHub] ** xref:running/promoting.adoc[Promote an Integration] ** xref:running/knative-sink.adoc[Knative Sinks] diff --git a/docs/modules/ROOT/pages/running/import.adoc b/docs/modules/ROOT/pages/running/import.adoc new file mode 100644 index 0000000000..dcb652edad --- /dev/null +++ b/docs/modules/ROOT/pages/running/import.adoc @@ -0,0 +1,42 @@ += Importing existing Camel applications + +You may have already a Camel application running on your cluster. You may have created it via a manual deployment, a CICD or any other deployment mechanism you have in place. Since the Camel K operator is meant to operate any Camel application out there, then, you will be able to import it and monitor in a similar fashion of any other Camel K **managed Integration**. + +NOTE: you will be only able to monitor the application. Camel K won't be able to alter the lifecycle of non managed Integrations. + +It's important to notice that the operator won't be altering any field of the original application in order to avoid breaking any deployment procedure which is already in place. As it cannot make any assumption on the way the application is built and deployed, it will only be able to **watch** for any changes happening around it. + +[[deploy-and-monitor]] +== Deploy externally, monitor via Camel K Operator + +An imported Integration is known as **synthetic Integration**. You can import any Camel application deployed as a **Deployment**, **CronJob** or **Knative Service**. We control this behavior via a label (`camel.apache.org/integration`) that the user need to apply on the Camel application (either manually or introducing in the deployment process, ie, via CICD). + +NOTE: the example here will work in a similar way using CronJob and Knative Service. + +As an example, we show how to import a Camel application which was deployed with the Deployment kind. Let's assume it is called `my-deploy`. +``` +$ kubectl label deploy my-camel-sb-svc camel.apache.org/integration=my-it +``` +The operator immediately creates a synthetic Integration: +``` +$ kubectl get it +NAMESPACE NAME PHASE RUNTIME PROVIDER RUNTIME VERSION KIT REPLICAS +test-79c385c3-d58e-4c28-826d-b14b6245f908 my-it Cannot Monitor Pods +``` +You can see it will be in `Cannot Monitor Pods` status phase. This is expected because the way Camel K operator monitor Pods. It requires that the same label applied to the Deployment is inherited by the generated Pods. For this reason, beside labelling the Deployment, we need to add a label in the Deployment template. +``` +$ kubectl patch deployment my-camel-sb-svc --patch '{"spec": {"template": {"metadata": {"labels": {"camel.apache.org/integration": "my-it"}}}}}' +``` +Also this operator can be performed manually or automated in the deployment procedure. We can see now that the operator will be able to monitor accordingly the status of the Pods: +``` +$ kubectl get it +NAMESPACE NAME PHASE RUNTIME PROVIDER RUNTIME VERSION KIT REPLICAS +test-79c385c3-d58e-4c28-826d-b14b6245f908 my-it Running 1 +``` +From now on, you will be able to monitor the status of the synthetic Integration in a similar fashion of what you do with managed Integrations. If, for example, your Deployment will scale up or down, then, you will see this information reflecting accordingly: +``` +$ kubectl scale deployment my-camel-sb-svc --replicas 2 +$ kubectl get it +NAMESPACE NAME PHASE RUNTIME PROVIDER RUNTIME VERSION KIT REPLICAS +test-79c385c3-d58e-4c28-826d-b14b6245f908 my-it Running 2 +```