You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/06/28 06:47:09 UTC

[camel-k] 02/07: doc: maven proxy configuration

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 f6fa287c61c5aaad31957c21015bf05ceeafc31b
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Jun 14 11:02:56 2023 +0200

    doc: maven proxy configuration
---
 .../ROOT/pages/installation/advanced/advanced.adoc | 35 +++++-------
 .../pages/installation/advanced/maven-proxy.adoc   | 66 ++++++++++++++++++++++
 .../ROOT/pages/installation/advanced/maven.adoc    | 55 +++++++++++++-----
 3 files changed, 120 insertions(+), 36 deletions(-)

diff --git a/docs/modules/ROOT/pages/installation/advanced/advanced.adoc b/docs/modules/ROOT/pages/installation/advanced/advanced.adoc
index 2303b193b..c34e804d6 100644
--- a/docs/modules/ROOT/pages/installation/advanced/advanced.adoc
+++ b/docs/modules/ROOT/pages/installation/advanced/advanced.adoc
@@ -3,18 +3,6 @@
 
 Camel K Operators offers several possibility of customization. The default installation could be good in the most of the cases, but, we have a series of configuration that can be applied when you want to fine tune your Camel K operator and get the very best of it. The following settings will work for an installation via `kamel` CLI, but the same configuration could be done with the other xref:installation/installation.adoc[installation procedures] by applying the required changes on the  [...]
 
-[[storage]]
-== Storage
-
-Since version 2.0, Camel K requires some persistent storage. You can change the storage configuration using the following settings:
-
-```
---storage                                     If false, it won't use a persistent storage (recommended for development purpose only) (default true)
---storage-access-mode string                  Persistent Volume Access Mode (any of ReadWriteOnce, ReadOnlyMany, ReadWriteMany or ReadWriteOncePod)(default "ReadWriteOnce")
---storage-capacity string                     How much capacity to use (default "20Gi")
---storage-class-name string                   Use a storage class name to create a dynamic volume (if empty will look up for cluster default)
-```
-
 [[resources]]
 == Resource management
 
@@ -52,17 +40,20 @@ A very important set of configuration you can provide is related to Maven:
 ```
 You can learn more in details in the xref:installation/advanced/maven.adoc[Maven configuration] page.
 
-Finally, you can change the registry where to host your integration containers:
+[[publish-configuration]]
+== Publish configuration
+
+Camel K requires a container registry where to store the applications built. These are the main configurations:
 
 ```
---organization string                         A organization on the Docker registry that can be used to publish images
---registry string                             A Docker registry that can be used to publish images
---registry-auth-file string                   A docker registry configuration file containing authorization tokens for pushing and pulling images
---registry-auth-password string               The docker registry authentication password
---registry-auth-server string                 The docker registry authentication server
---registry-auth-username string               The docker registry authentication username
---registry-insecure                           Configure to configure registry access in insecure mode or not
---registry-secret string                      A secret used to push/pull images to the Docker registry
+--organization string                         A organization on the Docker Hub that can be used to publish images
+--registry string                             A container registry that can be used to publish images
+--registry-auth-file string                   A container registry configuration file containing authorization tokens for pushing and pulling images
+--registry-auth-password string               The container registry authentication password
+--registry-auth-server string                 The container registry authentication server
+--registry-auth-username string               The container registry authentication username
+--registry-insecure                           Configure registry access in insecure mode or not (`http` vs `https`)
+--registry-secret string                      A secret used to push/pull images to the container registry
 ```
 We have a dedicated section to explain more in details xref:installation/registry/registry.adoc[how to configure a registry].
 
@@ -85,4 +76,4 @@ We have also certain configuration that let you control how to deploy your Camel
 --global                                      Configure the operator to watch all namespaces. No integration platform is created. You can run integrations in a namespace by installing an integration platform: 'kamel install --skip-operator-setup -n my-namespace'
 --operator-id string                          Set the operator id that is used to select the resources this operator should manage (default "camel-k")
 ```
-Learn more about xref:installation/advanced/multi.adoc[Camel K multi-tenancy].
\ No newline at end of file
+Learn more about xref:installation/advanced/multi.adoc[Camel K multi-tenancy].
diff --git a/docs/modules/ROOT/pages/installation/advanced/maven-proxy.adoc b/docs/modules/ROOT/pages/installation/advanced/maven-proxy.adoc
new file mode 100644
index 000000000..762984071
--- /dev/null
+++ b/docs/modules/ROOT/pages/installation/advanced/maven-proxy.adoc
@@ -0,0 +1,66 @@
+[[maven-proxy]]
+= Run a Maven Proxy
+
+Production or corporate environments generally relies on a corporate Maven repository manager that can be used as a proxy for your Camel K operator. This is a https://maven.apache.org/repository-management.html[Maven best practice] we want to foster as it improves efficiency while performing Camel K builds.
+
+If your environments has not yet any, here we provide some simple example that can be used as a reference to run your own Maven proxy beside Camel K.
+
+== Nexus Maven repository manager
+
+The following configuration is a very simple one from where you can start your own self managed Maven repository manager. It is based on https://www.sonatype.com/products/sonatype-nexus-repository[Nexus] and once it's up and running, it can work togheter with Camel K as explained in /camel-k/next/installation/advanced/maven.html#maven-proxy[Maven proxy configuration].
+
+NOTE: this configuration is NOT production ready. It is ephemeral and uses plain http protocol. It requires some important tuning in order to be used in a production environment.
+
+```yaml
+apiVersion: v1
+kind: Service
+metadata:
+  name: nexus
+spec:
+  selector:
+    app: nexus
+  ports:
+    - protocol: TCP
+      port: 80
+      targetPort: 8081
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: nexus
+spec:
+  selector:
+    matchLabels:
+      app: nexus
+  template:
+    metadata:
+      labels:
+        app: nexus
+    spec:
+      containers:
+        - name: nexus
+          image: sonatype/nexus3
+          ports:
+            - containerPort: 8081
+              name: 8081-tcp
+          livenessProbe:
+            httpGet:
+              path: /service/rest/v1/status
+              port: 8081
+            initialDelaySeconds: 90
+            periodSeconds: 3
+          readinessProbe:
+            httpGet:
+              path: /service/rest/v1/status
+              port: 8081
+            initialDelaySeconds: 90
+            periodSeconds: 3
+          volumeMounts:
+            - name: nexus-data
+              mountPath: /nexus-data
+      volumes:
+        - name: nexus-data
+          emptyDir: {}
+```
+
+Once you have created a file with this content (ie, `nexus.yaml`), then, you can apply to your cluster via `kubectl apply -f nexus.yaml`. Et voilá, after a few seconds, you will be able to use http://nexus/ as a Maven proxy repository.
\ No newline at end of file
diff --git a/docs/modules/ROOT/pages/installation/advanced/maven.adoc b/docs/modules/ROOT/pages/installation/advanced/maven.adoc
index 564e4bd64..4cdf74883 100644
--- a/docs/modules/ROOT/pages/installation/advanced/maven.adoc
+++ b/docs/modules/ROOT/pages/installation/advanced/maven.adoc
@@ -1,18 +1,47 @@
 = Configure Maven
 
+Camel K builds are performed by Maven. For this reason it may requires certain Maven best practices that will make your application to run faster, more secure and more resiliently. The Maven configuration is defined at IntegrationPlatform level. Have a look at the following sections to discover how to configure Maven in Camel K.
+
+[[maven-proxy]]
+== Maven Repository Manager (Proxy)
+
+The first best practice we suggest is to provide a https://maven.apache.org/repository-management.html[Maven Repository Manager] that acts as an intermediary between the cluster and the various artifacts repositories that may be required by Camel K.
+
+If your company has already one available in the cluster, you should use it. If not, we suggest you to take the opportunity and xref:maven-proxy.adoc[run a Maven proxy beside your Camel K operator]. There are many benefits by introducing a proxy, above all the reduction in the time required to download dependencies (which are cached in the proxy) and inherently the egress bandwidth cost saving.
+
+You can create a `settings.xml` file as illustred below:
+
+```xml
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
+    <mirrors>
+        <mirror>
+            <id>camel-k-maven-repository-manager</id>
+            <name>Maven Repository Manager</name>
+            <url>MAVEN_PROXY_URL[:MAVEN_PROXY_PORT]/</url>
+            <mirrorOf>*</mirrorOf>
+        </mirror>
+    </mirrors>
+</settings>
+```
+
+You can use any id or name. What's important is the location where to expect the service and the `mirrorOf` configuration which specifies that this service acts as a proxy for any repository required by the operator build. See the next paragraph to learn how to apply this configuration to your Camel K operator.
+
 [[maven-settings]]
 == Maven Settings
 
-The Maven settings, used by the Camel K operator, can be provided in a ConfigMap or a Secret.
+In general you can https://maven.apache.org/settings.html[tune Maven] with any parameter expected by `settings.xml` configuration file. Once you have the file ready you can create a Configmap or a Secret in order to use it in your Camel K installation:
 
-The `kubectl` CLI provides convenient commands, to create a ConfigMap or a Secret from a file, e.g.:
+```
+kubectl create cm my-maven-proxy --from-file settings.xml
+```
 
-[source,console]
-----
-$ kubectl create configmap maven-settings --from-file=settings.xml
-----
+Once the Configmap/Secret is ready, then, you can configure it in your Camel K operator directly at installation time:
 
-The created ConfigMap or Secret can then be referenced in the IntegrationPlatform resource, from the `spec.pipeline.maven.settings` field, e.g.:
+```
+kamel install --maven-settings configmap:my-maven-proxy/settings.xml
+```
+
+The ConfigMap or Secret can then be also referenced in the IntegrationPlatform resource, from the `spec.pipeline.maven.settings` field, e.g.:
 
 [source,yaml]
 ----
@@ -29,6 +58,8 @@ spec:
           name: maven-settings
 ----
 
+This last method is useful when you introduce any configuration while Camel K operator is running (it won't require a restart).
+
 [[maven-settings-security]]
 === Maven Settings Security
 
@@ -67,14 +98,10 @@ The IntegrationPlatform resource can be edited directly, to reference the Config
 $ kubectl edit ip camel-k
 ----
 
-Alternatively, the Kamel CLI provides the `--maven-settings` option, with the `install` command, that can be used to configure the Maven settings at installation time, e.g.:
-
-[source,console]
-----
-$ kamel install --maven-settings=configmap|secret:name[/key]
-----
+[[maven-repositories]]
+== Maven Repositories
 
-In case you only want to configure remote repositories, you can use the `--maven-repository` option, that automatically generates a `settings.xml` file and relieves from creating a ConfigMap or Secret, e.g.:
+In case you only want to configure remote repositories, you can use the `--maven-repository` option, that automatically generates a `settings.xml` file (which is stored as a Configmap anyway):
 
 [source,console]
 ----