This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit e1a4dbbce8cb7f809272970b8b12bee6a27f6628
Author: Pasquale Congiusti <pasquale.congiu...@gmail.com>
AuthorDate: Thu Oct 5 12:33:13 2023 +0200

    chore(doc): kamelets deployment explained
---
 .../images/architecture/kamelets_deployment.png    | Bin 0 -> 35011 bytes
 docs/modules/ROOT/nav-end.adoc                     |   1 +
 docs/modules/ROOT/pages/architecture/kamelets.adoc |  19 ++++++++++++++
 .../ROOT/pages/kamelets/kamelets-distribution.adoc |  11 +++++++-
 .../modules/ROOT/pages/kamelets/kamelets-user.adoc |  29 ---------------------
 pkg/apis/camel/v1/common_types_support.go          |  15 ++++++++++-
 pkg/apis/camel/v1/integration_types_support.go     |  13 ---------
 7 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/docs/modules/ROOT/images/architecture/kamelets_deployment.png 
b/docs/modules/ROOT/images/architecture/kamelets_deployment.png
new file mode 100644
index 000000000..dbb184f07
Binary files /dev/null and 
b/docs/modules/ROOT/images/architecture/kamelets_deployment.png differ
diff --git a/docs/modules/ROOT/nav-end.adoc b/docs/modules/ROOT/nav-end.adoc
index 69cf0c052..3f57cc06f 100644
--- a/docs/modules/ROOT/nav-end.adoc
+++ b/docs/modules/ROOT/nav-end.adoc
@@ -83,6 +83,7 @@
 *** xref:architecture/cr/camel-catalog.adoc[CamelCatalog]
 ** xref:architecture/runtime.adoc[Runtime]
 ** xref:architecture/traits.adoc[Traits]
+** xref:architecture/kamelets.adoc[Kamelets]
 ** xref:architecture/incremental-image.adoc[Incremental Image]
 * API
 ** xref:apis/camel-k.adoc[Camel K API]
diff --git a/docs/modules/ROOT/pages/architecture/kamelets.adoc 
b/docs/modules/ROOT/pages/architecture/kamelets.adoc
new file mode 100644
index 000000000..d4006e072
--- /dev/null
+++ b/docs/modules/ROOT/pages/architecture/kamelets.adoc
@@ -0,0 +1,19 @@
+= Kamelets architecture in Camel K
+
+xref:kamelets/kamelets.adoc[Kamelets] are a technology which were originally 
developed as a Camel K side resource but moved into Camel framework as Kamelet 
component. From an design point of view, a Kamelet is a specification that is 
provided into the cluster and which can be used at any point by an Integration 
or a Pipe, in order to reuse the connector style approach.
+
+In Camel framework, a Kamelet is nothing than a component which can be used as 
any other component with the `kamelet` uri scheme. This is translated to one or 
more Route Templates. What's important for Camel runtime is to have the Kamelet 
spec available somewhere when running the application making reference to it.
+
+[[deployment-model]]
+== Deployment model
+
+In Camel K, it is worth to explain how the Kamelets are deployed in order to 
make Camel runtime application to correctly use the Kamelet referenced in the 
Integration. First of all, the operator uses a xref:traits:kamelets.adoc[Camel 
K trait] which is in charge to discover the Kamelets used in your route. This 
is due to get all the specification and dependencies required.
+
+image::architecture/kamelets_deployment.png[Kamelets deployment model]
+
+The operator creates a ConfigMap in order to bundle all the Kamelets which are 
eventually required by the application runtime. The Kamelets spec has to be 
available and in ready phase status. Once the application is created and ready 
to start, the operator mounts such a ConfigMap in a known location (default 
`/etc/camel/kamelets`) so that the Camel application will be able to read the 
definition from such location and run them according the logic expected in the 
same Camel framework.
+
+[[kamelet-parsing]]
+=== Parsing capabilities defined in a Kamelet
+
+The operator is in charge to perform one important hidden operation. The 
Kamelet specification may contains Camel components and capabilities which the 
user should be in charge to define explicitly. However, the operator extract 
the Kamelet source and parses its content as a generated Integration source. In 
this way you will be able to get all the Kubernetes resources which are 
required to run your Integration (ie, a Kamelet using rest or exposing http 
services).
diff --git a/docs/modules/ROOT/pages/kamelets/kamelets-distribution.adoc 
b/docs/modules/ROOT/pages/kamelets/kamelets-distribution.adoc
index 617039bc3..77e5a99fb 100644
--- a/docs/modules/ROOT/pages/kamelets/kamelets-distribution.adoc
+++ b/docs/modules/ROOT/pages/kamelets/kamelets-distribution.adoc
@@ -18,4 +18,13 @@ kamel kamelet add-repo 
<git-platform>:<owner>/<repo>[/path_to_kamelets_folder][@
 ```
 Mind that `<git-platform>` is the repository of your choice, for instance 
`github` and `[@version]` is the tag to use (by default it will use `main` 
branch).
 
-With this approach you can dynamically include any repository where your 
Kamelets are hosted. They will be lazily initialized as soon as they are 
required by any of the Integration or Pipes which will make use of them.
\ No newline at end of file
+With this approach you can dynamically include any repository where your 
Kamelets are hosted. They will be lazily initialized as soon as they are 
required by any of the Integration or Pipes which will make use of them.
+
+[[kamelets-as-dependency]]
+== Kamelets as a dependency
+
+The Camel K has an opinionated way to use Kamelets which is the one exposed 
above. Here the Kamelet spec resource is expected to be available in the 
cluster.
+
+However, you may find situations where you want to bundle a Kamelet in a 
dependency (ie, some external catalog containing all Kamelets spec). As 
Kamelets are a Camel thing, then, you can use such dependency and let the 
runtime use the Kamelets available in the classpath.
+
+If you're using such an approach, then, you will need to make sure to skip the 
Kamelet trait (which is in charge to discover them and get required 
dependencies), and provide all the dependencies which may be required by your 
Kamelet. Additionally, you may need to specify a Camel property to tell the 
runtime where to expect to find the Kamelets, 
`camel.component.kamelet.location` (default `classpath:/kamelets`).
\ No newline at end of file
diff --git a/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc 
b/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc
index cdb00a68f..10eec3afe 100644
--- a/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc
+++ b/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc
@@ -205,35 +205,6 @@ from('timer:tick')
 You can run this integration without specifying other parameters, the Kamelet 
endpoint will be implicitly configured by the Camel K operator that will
 automatically mount the secret into the integration Pod.
 
-[[kamelets-default-catalog]]
-== Kamelets Catalog
-
-When you install a Camel K Operator, you will have automatically a wide set of 
canned Kamelets available to be used. The catalog and the related documentation 
is available at link:/camel-kamelets/next/index.html[Apache Kamelets Catalog]. 
There is a CLI command very useful to have a quick list of the available 
Kamelets:
-[source,shell]
-----
-$ kamel kamelet get
-----
-
-These Kamelets are installed by default when you install Camel K operator. You 
will be able to use them without worrying to install each of them, just look at 
the documentation and be ready to experiment how easy they are.
-
-[[kamelets-custom-catalog]]
-=== Use a custom Catalog
-
-You can overwrite the default catalog by adding certain configuration to the 
`IntegrationPlatform`. In order to add a new repository, you must edit the 
`IntegrationPlatfom` and edit the `.spec.kamelet.repositories[].uri` field, 
which expects an array of repository URIs where you can host your catalog of 
Kamelets, ie:
-[source,yaml]
-----
-spec:
-  ...
-  kamelet:
-    repositories:
-    - uri: github:my-org/my-repo
-  ...
-----
-
-By default the value is null, which means they fallback to the Apache Kamelets 
Catalog.
-
-NOTE: this option is experimental and may be subjected to changes in future 
versions.
-
 [[kamelets-usage-binding]]
 == Binding Kamelets
 
diff --git a/pkg/apis/camel/v1/common_types_support.go 
b/pkg/apis/camel/v1/common_types_support.go
index c8adc7809..4e7b54dc8 100644
--- a/pkg/apis/camel/v1/common_types_support.go
+++ b/pkg/apis/camel/v1/common_types_support.go
@@ -212,7 +212,20 @@ func DecodeValueSource(input string, defaultKey string, 
errorMessage string) (Va
        return ValueSource{}, fmt.Errorf(errorMessage)
 }
 
-// IsGeneratedFromKamelet determines is a source spec is derived from a Kamelet
+// IsGeneratedFromKamelet determines is a source spec is derived from a 
Kamelet.
 func (s *SourceSpec) IsGeneratedFromKamelet() bool {
        return s.FromKamelet
 }
+
+// InferLanguage returns the language of the source or discovers it from file 
extension if not set.
+func (s *SourceSpec) InferLanguage() Language {
+       if s.Language != "" {
+               return s.Language
+       }
+       for _, l := range Languages {
+               if strings.HasSuffix(s.Name, "."+string(l)) {
+                       return l
+               }
+       }
+       return ""
+}
diff --git a/pkg/apis/camel/v1/integration_types_support.go 
b/pkg/apis/camel/v1/integration_types_support.go
index 23c50f9e9..4ad79634f 100644
--- a/pkg/apis/camel/v1/integration_types_support.go
+++ b/pkg/apis/camel/v1/integration_types_support.go
@@ -192,19 +192,6 @@ func NewSourceSpec(name string, content string, language 
Language) SourceSpec {
        }
 }
 
-// InferLanguage returns the language of the source or discovers it from file 
extension if not set.
-func (in *SourceSpec) InferLanguage() Language {
-       if in.Language != "" {
-               return in.Language
-       }
-       for _, l := range Languages {
-               if strings.HasSuffix(in.Name, "."+string(l)) {
-                       return l
-               }
-       }
-       return ""
-}
-
 // SetOperatorID sets the given operator id as an annotation.
 func (in *Integration) SetOperatorID(operatorID string) {
        SetAnnotation(&in.ObjectMeta, OperatorIDAnnotation, operatorID)

Reply via email to