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 2022/08/11 12:48:50 UTC

[camel-k] branch main updated: doc: local operator id procedure

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


The following commit(s) were added to refs/heads/main by this push:
     new 2ac249919 doc: local operator id procedure
2ac249919 is described below

commit 2ac249919755ec3d12a8522af23e8c135ea227ab
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Aug 11 11:27:18 2022 +0200

    doc: local operator id procedure
    
    Closes #3472
---
 .../ROOT/pages/contributing/local-development.adoc        | 15 ++++++++-------
 pkg/cmd/operator/operator.go                              |  3 +--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/docs/modules/ROOT/pages/contributing/local-development.adoc b/docs/modules/ROOT/pages/contributing/local-development.adoc
index f2774ea01..2fe75a52f 100644
--- a/docs/modules/ROOT/pages/contributing/local-development.adoc
+++ b/docs/modules/ROOT/pages/contributing/local-development.adoc
@@ -8,14 +8,15 @@ If you plan on contributing to Camel K, you will end up needing to run and troub
 
 As soon as you build your operator locally you will ask yourself how to test it. The idea is that you execute it locally and instruct it to **watch** a namespace on a Kubernetes cluster (it may be remote or any local environment). Let's use a namespace called ``operator-test``.
 
-* You can start with setting the environment variable ``WATCH_NAMESPACE`` with the namespace you'd like your operator to watch.
+* You can start with setting the environment variable ``WATCH_NAMESPACE`` with the namespace you'd like your operator to watch. You also need to specify the name of the operator, as you may have different operators running on the cluster.
 ----
 export WATCH_NAMESPACE=operator-test
+export KAMEL_OPERATOR_ID="camel-k-dev"
 ----
 
-* The next step is to install an ``IntegrationPlatform`` on the cluster namespace. You probably need to tweak the registry parameters in order to be able to authenticate against an image repository (see below paragraph for local repository instructions).
+* The next step is to install an ``IntegrationPlatform`` on the cluster namespace. You probably need to tweak the registry parameters in order to be able to authenticate against an image repository (see below paragraph for local repository instructions). It's important to specify the target operator that will take care of this IntegrationPlatform (`-x` or `--operator-id` option).
 ----
-./kamel install --skip-operator-setup -n operator-test --registry my-registry:5000
+./kamel install --skip-operator-setup -n operator-test --registry my-registry:5000 -x camel-k-dev
 ----
 
 * Finally, assuming you've built your application correctly we can run the operator:
@@ -25,10 +26,10 @@ export WATCH_NAMESPACE=operator-test
 
 * Test the local operator by creating a test `Integration`.
 -----
-./kamel run xyz.abc -n operator-test
+./kamel run xyz.abc -n operator-test -x camel-k-dev
 -----
 
-IMPORTANT: make sure no other Camel K Operators are watching this namespace, neither you have a global Camel K Operator installed on your cluster.
+IMPORTANT: make sure no other Camel K Operators are watching this namespace, neither you have a global Camel K Operator  installed on your cluster. As you may have more than one Camel K operator installed on the cluster, it's important you specify the `-x` (or `--operator-id`) option.
 
 [[local-minikube]]
 == Local operator and local cluster
@@ -53,7 +54,7 @@ kubectl port-forward --namespace kube-system registry-fttbv 5000:5000
 
 * Update the ``IntegrationPlatform`` to instruct it to use the ``localhost`` registry:
 ----
-./kamel install --skip-operator-setup -n operator-test --registry localhost:5000 --force
+./kamel install --skip-operator-setup -n operator-test --registry localhost:5000 --force -x camel-k-dev
 ----
 
 A similar procedure may work if you use other local environments. The idea is to expose the docker registry and be able to use it from your local operator.
@@ -62,7 +63,7 @@ A similar procedure may work if you use other local environments. The idea is to
 
 Camel K integrations are based on https://github.com/apache/camel-k-runtime[Camel K runtime], generally paired with the operator release. If you need to specify a different runtime, or you have a local Camel K runtime that you want to test, then you will need to specify it in the `Integration Platform`:
 ----
-./kamel install --skip-operator-setup -n operator-test --registry localhost:5000 --force --runtime-version $version
+./kamel install --skip-operator-setup -n operator-test --registry localhost:5000 --force --runtime-version $version -x camel-k-dev
 ----
 
 The `$version` variable must be replaced with the version you are building. For example, `1.3.1-SNAPSHOT`. With these instructions, the operator will pick up and use the snapshot version you have released locally. In order to use the local maven repository, you will also need to edit your IntegrationPlatform as follow:
diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index 61b471acb..e4fd8e4c6 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -75,11 +75,10 @@ var log = logutil.Log.WithName("cmd")
 func printVersion() {
 	log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
 	log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
-	log.Info(fmt.Sprintf("Buildah Version: %v", defaults.BuildahVersion))
-	log.Info(fmt.Sprintf("Kaniko Version: %v", defaults.KanikoVersion))
 	log.Info(fmt.Sprintf("Camel K Operator Version: %v", defaults.Version))
 	log.Info(fmt.Sprintf("Camel K Default Runtime Version: %v", defaults.DefaultRuntimeVersion))
 	log.Info(fmt.Sprintf("Camel K Git Commit: %v", defaults.GitCommit))
+	log.Info(fmt.Sprintf("Camel K Operator ID: %v", defaults.OperatorID()))
 
 	// Will only appear if DEBUG level has been enabled using the env var LOG_LEVEL
 	log.Debug("*** DEBUG level messages will be logged ***")