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/05/03 12:51:18 UTC

[camel-k] branch main updated (9210eb815 -> 45d976e79)

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

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


    from 9210eb815 Merge pull request #3193 from johnpoth/run-verbose
     new 14a397c7d Preparing for next release
     new d3c15f736 Preparing for next release: e2e preflight test improvement
     new 83050f27b chore: Upgrade controller-gen to 0.6.1
     new f7fdf356a (#3053): Adds ability to modify the level of the operator logs
     new 45d976e79 chore: Fixes linter issues

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../kamel-build-bundle/build-bundle-image.sh       |  2 +-
 .../kamel-build-bundle/build-index-image.sh        |  2 +-
 .../actions/kamel-preflight-test/preflight-test.sh | 27 ++++++++--
 config/crd/bases/camel.apache.org_builds.yaml      |  2 +-
 .../crd/bases/camel.apache.org_camelcatalogs.yaml  |  2 +-
 .../bases/camel.apache.org_integrationkits.yaml    |  2 +-
 .../camel.apache.org_integrationplatforms.yaml     |  2 +-
 .../crd/bases/camel.apache.org_integrations.yaml   |  2 +-
 .../bases/camel.apache.org_kameletbindings.yaml    |  2 +-
 config/crd/bases/camel.apache.org_kamelets.yaml    |  2 +-
 config/manager/operator-deployment.yaml            |  6 +--
 ...r-service-account.yaml => patch-log-level.yaml} | 11 ++--
 .../bases/camel-k.clusterserviceversion.yaml       | 11 ++--
 config/manifests/kustomization.yaml                |  2 +-
 e2e/common/cli/install_test.go                     | 15 ++++++
 go.mod                                             |  6 +--
 helm/camel-k/Chart.yaml                            |  2 +-
 helm/camel-k/crds/crd-build.yaml                   |  2 +-
 helm/camel-k/crds/crd-camel-catalog.yaml           |  2 +-
 helm/camel-k/crds/crd-integration-kit.yaml         |  2 +-
 helm/camel-k/crds/crd-integration-platform.yaml    |  2 +-
 helm/camel-k/crds/crd-integration.yaml             |  2 +-
 helm/camel-k/crds/crd-kamelet-binding.yaml         |  2 +-
 helm/camel-k/crds/crd-kamelet.yaml                 |  2 +-
 helm/camel-k/values.yaml                           |  2 +-
 install/Makefile                                   | 22 +++++++-
 pkg/client/camel/go.mod                            |  2 +-
 pkg/cmd/install.go                                 |  7 +++
 pkg/cmd/install_test.go                            | 63 ++++++++++++++++++++++
 pkg/cmd/operator/operator.go                       | 42 ++++++++++++++-
 pkg/controller/integration/build_kit.go            | 29 +++++++---
 .../integration/integration_controller.go          |  2 +
 pkg/controller/integration/kits.go                 | 13 +++++
 pkg/kamelet/repository/go.mod                      |  4 +-
 pkg/resources/resources.go                         | 62 +++++++++++++++++----
 pkg/trait/trait.go                                 | 21 +++++++-
 pkg/util/defaults/defaults.go                      |  4 +-
 pkg/util/knative/apis.go                           | 10 ++--
 pkg/util/olm/operator.go                           | 10 ++++
 script/Makefile                                    |  2 +-
 40 files changed, 336 insertions(+), 71 deletions(-)
 copy config/manager/{operator-service-account.yaml => patch-log-level.yaml} (90%)


[camel-k] 01/05: Preparing for next release

Posted by pc...@apache.org.
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 14a397c7d2b520f9d7d31cbe493346d92f0289bc
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Thu Apr 28 16:37:42 2022 +0100

    Preparing for next release
---
 config/manager/operator-deployment.yaml                   |  6 +++---
 config/manifests/bases/camel-k.clusterserviceversion.yaml | 11 ++++++-----
 config/manifests/kustomization.yaml                       |  2 +-
 go.mod                                                    |  6 +++---
 helm/camel-k/Chart.yaml                                   |  2 +-
 helm/camel-k/values.yaml                                  |  2 +-
 pkg/client/camel/go.mod                                   |  2 +-
 pkg/kamelet/repository/go.mod                             |  4 ++--
 pkg/util/defaults/defaults.go                             |  2 +-
 9 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/config/manager/operator-deployment.yaml b/config/manager/operator-deployment.yaml
index a05075000..56fae2a86 100644
--- a/config/manager/operator-deployment.yaml
+++ b/config/manager/operator-deployment.yaml
@@ -25,7 +25,7 @@ metadata:
     name: camel-k-operator
     app.kubernetes.io/component: operator
     app.kubernetes.io/name: camel-k
-    app.kubernetes.io/version: "1.9.0"
+    app.kubernetes.io/version: "1.9.1-SNAPSHOT"
 spec:
   replicas: 1
   strategy:
@@ -41,12 +41,12 @@ spec:
         app: "camel-k"
         app.kubernetes.io/component: operator
         app.kubernetes.io/name: camel-k
-        app.kubernetes.io/version: "1.9.0"
+        app.kubernetes.io/version: "1.9.1-SNAPSHOT"
     spec:
       serviceAccountName: camel-k-operator
       containers:
         - name: camel-k-operator
-          image: docker.io/apache/camel-k:1.9.0
+          image: docker.io/apache/camel-k:1.9.1-SNAPSHOT
           imagePullPolicy: IfNotPresent
           command:
             - kamel
diff --git a/config/manifests/bases/camel-k.clusterserviceversion.yaml b/config/manifests/bases/camel-k.clusterserviceversion.yaml
index 325f3ed11..c3bc1fddc 100644
--- a/config/manifests/bases/camel-k.clusterserviceversion.yaml
+++ b/config/manifests/bases/camel-k.clusterserviceversion.yaml
@@ -22,8 +22,8 @@ metadata:
     capabilities: Full Lifecycle
     categories: Integration & Delivery
     certified: "false"
-    containerImage: docker.io/apache/camel-k:1.9.0
-    createdAt: 2022-04-26T08:32:16Z
+    containerImage: docker.io/apache/camel-k:1.9.1-SNAPSHOT
+    createdAt: 2022-04-28T15:23:24Z
     description: Apache Camel K is a lightweight integration platform, born on Kubernetes,
       with serverless superpowers.
     operators.operatorframework.io/builder: operator-sdk-v1.3.0
@@ -31,7 +31,7 @@ metadata:
     operators.operatorframework.io/project_layout: go.kubebuilder.io/v2
     repository: https://github.com/apache/camel-k
     support: Camel
-  name: camel-k.v1.9.0
+  name: camel-k.v1.9.1
   namespace: placeholder
 spec:
   apiservicedefinitions: {}
@@ -153,8 +153,9 @@ spec:
   minKubeVersion: 1.11.0
   provider:
     name: The Apache Software Foundation
+  replaces: camel-k-operator.v1.9.0
   selector:
     matchLabels:
       name: camel-k-operator
-  version: 1.9.0
-  replaces: camel-k-operator.v1.8.2
+  version: 1.9.1
+  replaces: camel-k-operator.v1.9.0
diff --git a/config/manifests/kustomization.yaml b/config/manifests/kustomization.yaml
index 3a6ba2eaa..712233df9 100644
--- a/config/manifests/kustomization.yaml
+++ b/config/manifests/kustomization.yaml
@@ -34,4 +34,4 @@ patchesStrategicMerge:
 images:
 - name: docker.io/apache/camel-k
   newName: docker.io/apache/camel-k
-  newTag: 1.9.0
+  newTag: 1.9.1-SNAPSHOT
diff --git a/go.mod b/go.mod
index 540a92026..1fd5047e7 100644
--- a/go.mod
+++ b/go.mod
@@ -4,9 +4,9 @@ go 1.16
 
 require (
 	github.com/Masterminds/semver v1.5.0
-	github.com/apache/camel-k/pkg/apis/camel v1.9.0
-	github.com/apache/camel-k/pkg/client/camel v1.9.0
-	github.com/apache/camel-k/pkg/kamelet/repository v1.9.0
+	github.com/apache/camel-k/pkg/apis/camel v0.0.0
+	github.com/apache/camel-k/pkg/client/camel v0.0.0
+	github.com/apache/camel-k/pkg/kamelet/repository v0.0.0
 	github.com/container-tools/spectrum v0.3.8
 	github.com/evanphx/json-patch v4.12.0+incompatible
 	github.com/fatih/camelcase v1.0.0
diff --git a/helm/camel-k/Chart.yaml b/helm/camel-k/Chart.yaml
index 6edb714c7..5bdd09068 100644
--- a/helm/camel-k/Chart.yaml
+++ b/helm/camel-k/Chart.yaml
@@ -35,7 +35,7 @@ version: 0.10.0
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application.
-appVersion: 1.9.0
+appVersion: 1.9.1-SNAPSHOT
 
 icon: https://github.com/apache/camel/raw/main/docs/img/logo64-d.png
 home: https://camel.apache.org/camel-k/latest/
diff --git a/helm/camel-k/values.yaml b/helm/camel-k/values.yaml
index 73aedaf9c..4cf6d7021 100644
--- a/helm/camel-k/values.yaml
+++ b/helm/camel-k/values.yaml
@@ -23,7 +23,7 @@ nameOverride: ""
 fullnameOverride: ""
 
 operator:
-  image: docker.io/apache/camel-k:1.9.0
+  image: docker.io/apache/camel-k:1.9.1-SNAPSHOT
 
 platform:
   build:
diff --git a/pkg/client/camel/go.mod b/pkg/client/camel/go.mod
index 3c0fa8e33..fb7ea4a71 100644
--- a/pkg/client/camel/go.mod
+++ b/pkg/client/camel/go.mod
@@ -3,7 +3,7 @@ module github.com/apache/camel-k/pkg/client/camel
 go 1.16
 
 require (
-	github.com/apache/camel-k/pkg/apis/camel v1.9.0
+	github.com/apache/camel-k/pkg/apis/camel v0.0.0
 	k8s.io/api v0.22.5
 	k8s.io/apimachinery v0.22.5
 	k8s.io/client-go v0.22.5
diff --git a/pkg/kamelet/repository/go.mod b/pkg/kamelet/repository/go.mod
index 2904b1401..f7c94e829 100644
--- a/pkg/kamelet/repository/go.mod
+++ b/pkg/kamelet/repository/go.mod
@@ -3,8 +3,8 @@ module github.com/apache/camel-k/pkg/kamelet/repository
 go 1.16
 
 require (
-	github.com/apache/camel-k/pkg/apis/camel v1.9.0
-	github.com/apache/camel-k/pkg/client/camel v1.9.0
+	github.com/apache/camel-k/pkg/apis/camel v0.0.0
+	github.com/apache/camel-k/pkg/client/camel v0.0.0
 	github.com/google/go-github/v32 v32.1.0
 	github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7
 	github.com/stretchr/testify v1.7.0
diff --git a/pkg/util/defaults/defaults.go b/pkg/util/defaults/defaults.go
index 647181afd..e36b214b4 100644
--- a/pkg/util/defaults/defaults.go
+++ b/pkg/util/defaults/defaults.go
@@ -23,7 +23,7 @@ package defaults
 
 const (
 	// Version --
-	Version = "1.9.0"
+	Version = "1.9.1-SNAPSHOT"
 
 	// DefaultRuntimeVersion --
 	DefaultRuntimeVersion = "1.13.0"


[camel-k] 04/05: (#3053): Adds ability to modify the level of the operator logs

Posted by pc...@apache.org.
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 f7fdf356a1567e831490f09df2102684c5cd3339
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Tue Apr 19 13:58:09 2022 +0100

    (#3053): Adds ability to modify the level of the operator logs
    
    * Exposes a switch --log-level (-v) at the CLI level allowing the operator
      to have its level of logging changed (info, debug, 0 ... 10)
    
    * The switch translates to an env variable LOG_LEVEL which is included in
      the operator deployment. It is this env var that determines the internal
      level of the log.
    
    * install.go
     * The CLI switch for setting the log-level
    
    * operator.go
     * The setting of the log-level based on the env variable
    
    * Adds debug logging for building the integration kits and integrations
    
    * Wraps errors when building integration kits to identify more precisely
      where the error is occurring and the reason
---
 config/manager/patch-log-level.yaml                | 22 ++++++++
 e2e/common/cli/install_test.go                     | 15 ++++++
 install/Makefile                                   | 22 +++++++-
 pkg/cmd/install.go                                 |  7 +++
 pkg/cmd/install_test.go                            | 63 ++++++++++++++++++++++
 pkg/cmd/operator/operator.go                       | 42 ++++++++++++++-
 pkg/controller/integration/build_kit.go            | 29 +++++++---
 .../integration/integration_controller.go          |  2 +
 pkg/controller/integration/kits.go                 | 13 +++++
 pkg/resources/resources.go                         | 44 +++++++++++++++
 pkg/trait/trait.go                                 | 19 ++++++-
 11 files changed, 268 insertions(+), 10 deletions(-)

diff --git a/config/manager/patch-log-level.yaml b/config/manager/patch-log-level.yaml
new file mode 100644
index 000000000..27a9ec293
--- /dev/null
+++ b/config/manager/patch-log-level.yaml
@@ -0,0 +1,22 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+- op: add
+  path: /spec/template/spec/containers/0/env/-
+  value:
+    name: LOG_LEVEL
+    value: "info"
diff --git a/e2e/common/cli/install_test.go b/e2e/common/cli/install_test.go
index b52f6c772..d1a76dc3c 100644
--- a/e2e/common/cli/install_test.go
+++ b/e2e/common/cli/install_test.go
@@ -39,6 +39,7 @@ import (
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/apache/camel-k/pkg/util/openshift"
 	console "github.com/openshift/api/console/v1"
+	corev1 "k8s.io/api/core/v1"
 )
 
 func TestBasicInstallation(t *testing.T) {
@@ -148,3 +149,17 @@ func TestInstallSkipDefaultKameletsInstallation(t *testing.T) {
 		Expect(KameletList(ns)()).Should(BeEmpty())
 	})
 }
+
+func TestInstallDebugLogging(t *testing.T) {
+	WithNewTestNamespace(t, func(ns string) {
+		Expect(Kamel("install", "-n", ns, "-z", "debug").Execute()).To(Succeed())
+
+		podFunc := OperatorPod(ns)
+		Eventually(podFunc).ShouldNot(BeNil())
+
+		pod := podFunc()
+		logs := Logs(ns, pod.Name, corev1.PodLogOptions{})
+		Eventually(logs).ShouldNot(BeEmpty())
+		Eventually(logs).Should(ContainSubstring("DEBUG level messages will be logged"))
+	})
+}
diff --git a/install/Makefile b/install/Makefile
index faf8466d6..f9aa2708f 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -48,6 +48,8 @@ MONITORING ?= false
 MONITORING_PORT ?= 8080
 # Health Port: integer
 HEALTH_PORT ?= 8081
+# Operator Logging Level: string [info, debug, 0, 1]
+LOGGING_LEVEL ?= info
 
 CONFIG := ../config
 MANAGER := $(CONFIG)/manager
@@ -67,6 +69,7 @@ ROLE_TO_CROLE_PATCH := $(RBAC)/patch-role-to-clusterrole
 ROLEBIN_TO_CROLEBIN_PATCH := $(RBAC)/patch-rolebinding-to-clusterrolebinding
 # Operator patches
 PORTS_PATCH := patch-ports
+LOG_LEVEL_PATCH := patch-log-level
 IMAGE_PULL_POLICY_PATCH := patch-image-pull-policy-always
 WATCH_NAMESPACE_PATCH := patch-watch-namespace-global
 # Platform patches
@@ -229,7 +232,7 @@ else
 		sed 's/$(PLACEHOLDER)/$(NAMESPACE)/'
 endif
 
-.PHONY: operator .operator-port-patch .operator-can-monitor
+.PHONY: operator .operator-port-patch .operator-can-monitor .operator-log-level-patch
 
 #
 # Customizes the port patch
@@ -240,6 +243,12 @@ endif
 	@sed -i 's/--health-port=.*/--health-port=$(HEALTH_PORT)/' $(MANAGER)/$(PORTS_PATCH).$(YAML)
 	@sed -i '/path:.*\/httpGet\/port/,/- op/{s/value: .*/value: $(HEALTH_PORT)/}' $(MANAGER)/$(PORTS_PATCH).$(YAML)
 
+#
+# Customizes the log level patch
+#
+.operator-log-level-patch:
+	@sed -i 's/    value:.*/    value: "$(LOGGING_LEVEL)"/' $(MANAGER)/$(LOG_LEVEL_PATCH).$(YAML)
+
 .operator-can-monitor: kubectl
 	@output=$$(kubectl get crd prometheusrules.monitoring.coreos.com 2>&1) || (echo "****" && echo "**** ERROR: Montoring not available as Prometheus CRDs not installed in cluster ****" && echo "****"; exit 1)
 
@@ -258,9 +267,10 @@ endif
 #   MONITORING:         Adds the prometheus monitoring resources
 #   MONITORING_PORT:    Set a custom monitoring port
 #   HEALTH_PORT:        Set a custom health port
+#   LOGGING_LEVEL:      Set the level of logging [info|debug]
 #   DRY_RUN:            Prints the resources to be applied instead of applying them
 #
-operator: check-admin have-platform kustomize kubectl .operator-port-patch
+operator: check-admin have-platform kustomize kubectl .operator-port-patch .operator-log-level-patch
 ifeq ($(MONITORING), true)
 	@$(MAKE) -s .operator-can-monitor
 	@$(call add-remove-operator-monitoring,$@,add)
@@ -289,6 +299,14 @@ ifneq ($(MONITORING_PORT), 8080)
 else ifneq ($(HEALTH_PORT), 8081)
 	@$(call add-remove-kind-patch,$(MANAGER),add,$(PORTS_PATCH).$(YAML),Deployment)
 endif
+# Set the Log level of the operator
+ifneq ($(LOGGING_LEVEL), info)
+	@$(call add-remove-kind-patch,$(MANAGER),add,$(LOG_LEVEL_PATCH).$(YAML),Deployment)
+else ifneq ($(LOGGING_LEVEL), 0)
+		@$(call add-remove-kind-patch,$(MANAGER),add,$(LOG_LEVEL_PATCH).$(YAML),Deployment)
+else
+	@$(call add-remove-kind-patch,$(MANAGER),remove,$(LOG_LEVEL_PATCH).$(YAML),Deployment)
+endif
 ifeq ($(DRY_RUN), false)
 	@$(KUSTOMIZE) build $(KOPTIONS) $@ | kubectl apply -f -
 else
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 4adf46cc9..89d36621a 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -142,6 +142,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) (*cobra.Command, *installCmdO
 	cmd.Flags().StringArray("node-selector", nil, "Add a NodeSelector to the operator Pod")
 	cmd.Flags().StringArray("operator-resources", nil, "Define the resources requests and limits assigned to the operator Pod as <requestType.requestResource=value> (i.e., limits.memory=256Mi)")
 	cmd.Flags().StringArray("operator-env-vars", nil, "Add an environment variable to set in the operator Pod(s), as <name=value>")
+	cmd.Flags().StringP("log-level", "z", "info", "The level of operator logging (default - info): info or 0, debug or 1")
 
 	// save
 	cmd.Flags().Bool("save", false, "Save the install parameters into the default kamel configuration file (kamel-config.yaml)")
@@ -195,6 +196,7 @@ type installCmdOptions struct {
 	Tolerations              []string `mapstructure:"tolerations"`
 	NodeSelectors            []string `mapstructure:"node-selectors"`
 	ResourcesRequirements    []string `mapstructure:"operator-resources"`
+	LogLevel                 string   `mapstructure:"log-level"`
 	EnvVars                  []string `mapstructure:"operator-env-vars"`
 
 	registry         v1.RegistrySpec
@@ -219,6 +221,11 @@ func (o *installCmdOptions) install(cobraCmd *cobra.Command, _ []string) error {
 		o.EnvVars = append(o.EnvVars, "KAMEL_INSTALL_DEFAULT_KAMELETS=false")
 	}
 
+	// Set the log-level
+	if len(o.LogLevel) > 0 {
+		o.EnvVars = append(o.EnvVars, fmt.Sprintf("LOG_LEVEL=%s", strings.TrimSpace(o.LogLevel)))
+	}
+
 	installViaOLM := false
 	if o.Olm {
 		var err error
diff --git a/pkg/cmd/install_test.go b/pkg/cmd/install_test.go
index 874b1538c..c1aaaee59 100644
--- a/pkg/cmd/install_test.go
+++ b/pkg/cmd/install_test.go
@@ -393,3 +393,66 @@ func TestInstallMavenExtension(t *testing.T) {
 	assert.Nil(t, err)
 	assert.Equal(t, "fi.yle.tools:aws-maven:1.4.2", installCmdOptions.MavenExtensions[0])
 }
+
+func TestInstallInfoLogging(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall)
+	assert.Nil(t, err)
+	assert.Equal(t, "info", installCmdOptions.LogLevel)
+}
+
+func TestInstallInfoLogging1(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "-z", "0")
+	assert.Nil(t, err)
+	assert.Equal(t, "0", installCmdOptions.LogLevel)
+}
+
+func TestInstallInfoLogging2(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "--log-level", "0")
+	assert.Nil(t, err)
+	assert.Equal(t, "0", installCmdOptions.LogLevel)
+}
+
+func TestInstallInfoLogging3(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "-z", "info")
+	assert.Nil(t, err)
+	assert.Equal(t, "info", installCmdOptions.LogLevel)
+}
+
+func TestInstallInfoLogging4(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "--log-level", "info")
+	assert.Nil(t, err)
+	assert.Equal(t, "info", installCmdOptions.LogLevel)
+}
+
+func TestInstallDebugLogging1(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "-z", "1")
+	assert.Nil(t, err)
+	assert.Equal(t, "1", installCmdOptions.LogLevel)
+}
+
+func TestInstallDebugLogging2(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "--log-level", "1")
+	assert.Nil(t, err)
+	assert.Equal(t, "1", installCmdOptions.LogLevel)
+}
+
+func TestInstallDebugLogging3(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "-z", "debug")
+	assert.Nil(t, err)
+	assert.Equal(t, "debug", installCmdOptions.LogLevel)
+}
+
+func TestInstallDebugLogging4(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "--log-level", "debug")
+	assert.Nil(t, err)
+	assert.Equal(t, "debug", installCmdOptions.LogLevel)
+}
diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index c58db2d00..5b5bc29d7 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -25,6 +25,7 @@ import (
 	"os"
 	"runtime"
 	"strconv"
+	"strings"
 	"time"
 
 	"go.uber.org/automaxprocs/maxprocs"
@@ -39,8 +40,9 @@ import (
 	"k8s.io/apimachinery/pkg/selection"
 	"k8s.io/client-go/tools/leaderelection/resourcelock"
 	"k8s.io/client-go/tools/record"
-	"k8s.io/klog/v2"
+	klog "k8s.io/klog/v2"
 
+	"go.uber.org/zap/zapcore"
 	"sigs.k8s.io/controller-runtime/pkg/cache"
 	ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 	"sigs.k8s.io/controller-runtime/pkg/client/config"
@@ -61,9 +63,11 @@ import (
 	"github.com/apache/camel-k/pkg/platform"
 	"github.com/apache/camel-k/pkg/util/defaults"
 	"github.com/apache/camel-k/pkg/util/kubernetes"
+	camelLog "github.com/apache/camel-k/pkg/util/log"
 )
 
 var log = logf.Log.WithName("cmd")
+var camLog = camelLog.Log.WithName("log")
 
 func printVersion() {
 	log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
@@ -73,6 +77,17 @@ func printVersion() {
 	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))
+
+	// Will only appear if DEBUG level has been enabled using the env var LOG_LEVEL
+	camLog.Debug("*** DEBUG level messages will be logged ***")
+}
+
+type loglvl struct {
+	Level zapcore.Level
+}
+
+func (l loglvl) Enabled(lvl zapcore.Level) bool {
+	return l.Level.Enabled(lvl)
 }
 
 // Run starts the Camel K operator.
@@ -85,8 +100,33 @@ func Run(healthPort, monitoringPort int32, leaderElection bool, leaderElectionID
 	// implementing the logr.Logger interface. This logger will
 	// be propagated through the whole operator, generating
 	// uniform and structured logs.
+
+	// The constants specified here are zap specific
+	var logLevel zapcore.Level
+	logLevelVal, ok := os.LookupEnv("LOG_LEVEL")
+	if ok {
+		switch strings.ToLower(logLevelVal) {
+		case "error":
+			logLevel = zapcore.ErrorLevel
+		case "info":
+			logLevel = zapcore.InfoLevel
+		case "debug":
+			logLevel = zapcore.DebugLevel
+		default:
+			customLevel, err := strconv.Atoi(strings.ToLower(logLevelVal))
+			exitOnError(err, "Invalid log-level")
+			// Need to multiply by -1 to turn logr expected level into zap level
+			logLevel = zapcore.Level(int8(customLevel) * -1)
+		}
+	}
+
+	logLevelEnabler := loglvl{
+		Level: logLevel,
+	}
+
 	logf.SetLogger(zap.New(func(o *zap.Options) {
 		o.Development = false
+		o.Level = logLevelEnabler
 	}))
 
 	klog.SetLogger(log)
diff --git a/pkg/controller/integration/build_kit.go b/pkg/controller/integration/build_kit.go
index 3acd1e0a6..a08ff0bba 100644
--- a/pkg/controller/integration/build_kit.go
+++ b/pkg/controller/integration/build_kit.go
@@ -63,8 +63,8 @@ func (action *buildKitAction) Handle(ctx context.Context, integration *v1.Integr
 	// IntegrationKit may be nil if its being upgraded
 	//
 	if integration.Status.IntegrationKit != nil {
-
 		// IntegrationKit fully defined so find it
+		action.L.Debugf("Finding integration kit %s for integration %s\n", integration.Status.IntegrationKit.Name, integration.Name)
 		kit, err := kubernetes.GetIntegrationKit(ctx, action.client, integration.Status.IntegrationKit.Name, integration.Status.IntegrationKit.Namespace)
 		if err != nil {
 			return nil, errors.Wrapf(err, "unable to find integration kit %s/%s, %s", integration.Status.IntegrationKit.Namespace, integration.Status.IntegrationKit.Name, err)
@@ -73,14 +73,16 @@ func (action *buildKitAction) Handle(ctx context.Context, integration *v1.Integr
 		if kit.Labels[v1.IntegrationKitTypeLabel] == v1.IntegrationKitTypePlatform {
 			match, err := integrationMatches(integration, kit)
 			if err != nil {
-				return nil, err
+				return nil, errors.Wrapf(err, "unable to match any integration kit with integration %s/%s", integration.Namespace, integration.Name)
 			} else if !match {
 				// We need to re-generate a kit, or search for a new one that
 				// matches the integration, so let's remove the association
 				// with the kit.
+
 				//
 				// All tests & conditionals check for a nil assignment
 				//
+				action.L.Debug("No match found between integration and integrationkit. Resetting integration's integrationkit to empty", "integration", integration.Name, "integrationkit", integration.Status.IntegrationKit.Name, "namespace", integration.Namespace)
 				integration.SetIntegrationKit(nil)
 				return integration, nil
 			}
@@ -101,38 +103,49 @@ func (action *buildKitAction) Handle(ctx context.Context, integration *v1.Integr
 		return nil, nil
 	}
 
+	action.L.Debug("No kit specified in integration status so looking up", "integration", integration.Name, "namespace", integration.Namespace)
 	existingKits, err := lookupKitsForIntegration(ctx, action.client, integration)
 	if err != nil {
-		return nil, err
+		return nil, errors.Wrapf(err, "failed to lookup kits for integration %s/%s", integration.Namespace, integration.Name)
 	}
 
+	action.L.Debug("Applying traits to integration", "integration", integration.Name, "namespace", integration.Namespace)
 	env, err := trait.Apply(ctx, action.client, integration, nil)
 	if err != nil {
-		return nil, err
+		return nil, errors.Wrapf(err, "failed to apply traits to integration %s/%s", integration.Namespace, integration.Name)
 	}
 
+	action.L.Debug("Searching integration kits to assign to integration", "integration", integration.Name, "namespace", integration.Namespace)
 	var integrationKit *v1.IntegrationKit
 kits:
 	for _, kit := range env.IntegrationKits {
 		kit := kit
+
 		for i := range existingKits {
 			k := &existingKits[i]
+
+			action.L.Debug("Comparing existing kit with environment", "env kit", kit.Name, "existing kit", k.Name)
 			match, err := kitMatches(&kit, k)
 			if err != nil {
-				return nil, err
+				return nil, errors.Wrapf(err, "error occurred matches integration kits with environment for integration %s/%s", integration.Namespace, integration.Name)
 			}
 			if match {
 				if integrationKit == nil ||
 					integrationKit.Status.Phase != v1.IntegrationKitPhaseReady && k.Status.Phase == v1.IntegrationKitPhaseReady ||
 					integrationKit.Status.Phase == v1.IntegrationKitPhaseReady && k.Status.Phase == v1.IntegrationKitPhaseReady && k.HasHigherPriorityThan(integrationKit) {
 					integrationKit = k
+					action.L.Debug("Found matching kit", "integration kit", integrationKit.Name)
 				}
 
 				continue kits
+			} else {
+				action.L.Debug("Cannot match kits", "env kit", kit.Name, "existing kit", k.Name)
 			}
 		}
+
+		action.L.Debug("No existing kit available for integration. Creating a new one.", "integration", integration.Name, "namespace", integration.Namespace, "integration kit", kit.Name)
 		if err := action.client.Create(ctx, &kit); err != nil {
-			return nil, err
+			return nil, errors.Wrapf(err, "failed to create new integration kit for integration %s/%s", integration.Namespace, integration.Name)
 		}
 		if integrationKit == nil {
 			integrationKit = &kit
@@ -140,12 +153,16 @@ kits:
 	}
 
 	if integrationKit != nil {
+
+		action.L.Debug("Setting integration kit for integration", "integration", integration.Name, "namespace", integration.Namespace, "integration kit", integrationKit.Name)
 		// Set the kit name so the next handle loop, will fall through the
 		// same path as integration with a user defined kit
 		integration.SetIntegrationKit(integrationKit)
 		if integrationKit.Status.Phase == v1.IntegrationKitPhaseReady {
 			integration.Status.Phase = v1.IntegrationPhaseDeploying
 		}
+	} else {
+		action.L.Debug("Not yet able to assign an integration kit to integration", "integration", integration.Name, "namespace", integration.Namespace)
 	}
 
 	return integration, nil
diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index 4700c48d6..729db0ca3 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -141,6 +141,8 @@ func add(mgr manager.Manager, c client.Client, r reconcile.Reconciler) error {
 
 				for i := range list.Items {
 					integration := &list.Items[i]
+					log.Debug("Integration Controller: Assessing integration", "integration", integration.Name, "namespace", integration.Namespace)
+
 					if match, err := integrationMatches(integration, kit); err != nil {
 						log.Errorf(err, "Error matching integration %q with kit %q", integration.Name, kit.Name)
 
diff --git a/pkg/controller/integration/kits.go b/pkg/controller/integration/kits.go
index 6994ab206..283104065 100644
--- a/pkg/controller/integration/kits.go
+++ b/pkg/controller/integration/kits.go
@@ -33,6 +33,7 @@ import (
 	"github.com/apache/camel-k/pkg/trait"
 	"github.com/apache/camel-k/pkg/util"
 	"github.com/apache/camel-k/pkg/util/defaults"
+	"github.com/apache/camel-k/pkg/util/log"
 )
 
 func lookupKitsForIntegration(ctx context.Context, c ctrl.Reader, integration *v1.Integration, options ...ctrl.ListOption) ([]v1.IntegrationKit, error) {
@@ -83,19 +84,27 @@ func lookupKitsForIntegration(ctx context.Context, c ctrl.Reader, integration *v
 
 // integrationMatches returns whether the v1.IntegrationKit meets the requirements of the v1.Integration.
 func integrationMatches(integration *v1.Integration, kit *v1.IntegrationKit) (bool, error) {
+	ilog := log.ForIntegration(integration)
+
+	ilog.Debug("Matching integration", "integration", integration.Name, "integration-kit", kit.Name, "namespace", integration.Namespace)
 	if kit.Status.Phase == v1.IntegrationKitPhaseError {
+		ilog.Debug("Integration kit has a phase of Error", "integration-kit", kit.Name, "namespace", integration.Namespace)
 		return false, nil
 	}
 	if kit.Status.Version != integration.Status.Version {
+		ilog.Debug("Integration and integration-kit versions do not match", "integration", integration.Name, "integration-kit", kit.Name, "namespace", integration.Namespace)
 		return false, nil
 	}
 	if kit.Status.RuntimeProvider != integration.Status.RuntimeProvider {
+		ilog.Debug("Integration and integration-kit runtime providers do not match", "integration", integration.Name, "integration-kit", kit.Name, "namespace", integration.Namespace)
 		return false, nil
 	}
 	if kit.Status.RuntimeVersion != integration.Status.RuntimeVersion {
+		ilog.Debug("Integration and integration-kit runtime versions do not match", "integration", integration.Name, "integration-kit", kit.Name, "namespace", integration.Namespace)
 		return false, nil
 	}
 	if len(integration.Status.Dependencies) != len(kit.Spec.Dependencies) {
+		ilog.Debug("Integration and integration-kit have different number of dependencies", "integration", integration.Name, "integration-kit", kit.Name, "namespace", integration.Namespace)
 		return false, nil
 	}
 	// When a platform kit is created it inherits the traits from the integrations and as
@@ -109,11 +118,15 @@ func integrationMatches(integration *v1.Integration, kit *v1.IntegrationKit) (bo
 	// A kit can be used only if it contains a subset of the traits and related configurations
 	// declared on integration.
 	if match, err := hasMatchingTraits(integration.Spec.Traits, kit.Spec.Traits); !match || err != nil {
+		ilog.Debug("Integration and integration-kit traits do not match", "integration", integration.Name, "integration-kit", kit.Name, "namespace", integration.Namespace)
 		return false, err
 	}
 	if !util.StringSliceContains(kit.Spec.Dependencies, integration.Status.Dependencies) {
+		ilog.Debug("Integration and integration-kit dependencies do not match", "integration", integration.Name, "integration-kit", kit.Name, "namespace", integration.Namespace)
 		return false, nil
 	}
+
+	ilog.Debug("Matched Integration and integration-kit", "integration", integration.Name, "integration-kit", kit.Name, "namespace", integration.Namespace)
 	return true, nil
 }
 
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index f1ec667ba..848ed4981 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -188,6 +188,13 @@ var assets = func() http.FileSystem {
 
 			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x53\x4d\x6f\xeb\x38\x0c\xbc\xeb\x57\x0c\xe2\x4b\x0b\xe4\x63\x77\x8f\xd9\x93\xb7\x4d\xb0\xc6\x16\x49\x51\xa7\x5b\xf4\xc8\xd8\x8c\x4d\x54\x96\xf4\x24\xb9\x6e\xfe\xfd\x83\x9c\xa4\x1f\x78\x78\xb7\xf2\x64\x4b\xd4\x70\x86\x43\x66\x98\x7d\x5f\xa8\x0c\x77\x52\xb1\x09\x5c\x23\x5a\xc4\x96\x91\x3b\xaa\x5a\x46\x69\x0f\x71\x20\xcf\x58\xdb\xde\xd4\x14\xc5\x1a\x5c\xe5\xe5\xfa\x1a\xbd\xa9\xd9\xc3\x1a\x86\xf5\xe8\xac\x67\x95\xa1\x [...]
 		},
+		"/manager/patch-log-level.yaml": &vfsgen۰CompressedFileInfo{
+			name:             "patch-log-level.yaml",
+			modTime:          time.Time{},
+			uncompressedSize: 1041,
+
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x53\x41\x6e\xdb\x30\x10\xbc\xf3\x15\x03\xeb\x92\x00\xb6\x15\xf4\xe8\x9e\xdc\xc4\x6e\x85\x1a\x16\x10\x39\x09\x72\x2a\x68\x69\x2d\x2d\x2a\x71\x59\x92\x8a\xe2\xdf\x17\x94\xed\x26\x41\xaf\xe1\x8d\xe2\x6a\x67\x66\x67\x36\xc1\xec\xf3\x8e\x4a\xb0\xe1\x92\x8c\xa7\x0a\x41\x10\x1a\xc2\xd2\xea\xb2\x21\x14\x72\x08\x83\x76\x84\xb5\xf4\xa6\xd2\x81\xc5\xe0\x6a\x59\xac\xaf\xd1\x9b\x8a\x1c\xc4\x10\xc4\xa1\x13\x47\x2a\x41\x29\x26\x [...]
+		},
 		"/manager/patch-node-selector.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "patch-node-selector.yaml",
 			modTime:          time.Time{},
@@ -632,6 +639,7 @@ var assets = func() http.FileSystem {
 		fs["/manager/operator-deployment.yaml"].(os.FileInfo),
 		fs["/manager/operator-service-account.yaml"].(os.FileInfo),
 		fs["/manager/patch-image-pull-policy-always.yaml"].(os.FileInfo),
+		fs["/manager/patch-log-level.yaml"].(os.FileInfo),
 		fs["/manager/patch-node-selector.yaml"].(os.FileInfo),
 		fs["/manager/patch-ports.yaml"].(os.FileInfo),
 		fs["/manager/patch-resource-requirements.yaml"].(os.FileInfo),
@@ -724,6 +732,11 @@ func (fs vfsgen۰FS) Open(path string) (http.File, error) {
 			vfsgen۰CompressedFileInfo: f,
 			gr:                        gr,
 		}, nil
+	case *vfsgen۰FileInfo:
+		return &vfsgen۰File{
+			vfsgen۰FileInfo: f,
+			Reader:          bytes.NewReader(f.content),
+		}, nil
 	case *vfsgen۰DirInfo:
 		return &vfsgen۰Dir{
 			vfsgen۰DirInfo: f,
@@ -805,6 +818,37 @@ func (f *vfsgen۰CompressedFile) Close() error {
 	return f.gr.Close()
 }
 
+// vfsgen۰FileInfo is a static definition of an uncompressed file (because it's not worth gzip compressing).
+type vfsgen۰FileInfo struct {
+	name    string
+	modTime time.Time
+	content []byte
+}
+
+func (f *vfsgen۰FileInfo) Readdir(count int) ([]os.FileInfo, error) {
+	return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
+}
+func (f *vfsgen۰FileInfo) Stat() (os.FileInfo, error) { return f, nil }
+
+func (f *vfsgen۰FileInfo) NotWorthGzipCompressing() {}
+
+func (f *vfsgen۰FileInfo) Name() string       { return f.name }
+func (f *vfsgen۰FileInfo) Size() int64        { return int64(len(f.content)) }
+func (f *vfsgen۰FileInfo) Mode() os.FileMode  { return 0444 }
+func (f *vfsgen۰FileInfo) ModTime() time.Time { return f.modTime }
+func (f *vfsgen۰FileInfo) IsDir() bool        { return false }
+func (f *vfsgen۰FileInfo) Sys() interface{}   { return nil }
+
+// vfsgen۰File is an opened file instance.
+type vfsgen۰File struct {
+	*vfsgen۰FileInfo
+	*bytes.Reader
+}
+
+func (f *vfsgen۰File) Close() error {
+	return nil
+}
+
 // vfsgen۰DirInfo is a static definition of a directory.
 type vfsgen۰DirInfo struct {
 	name    string
diff --git a/pkg/trait/trait.go b/pkg/trait/trait.go
index ca5fa5050..0158b78a4 100644
--- a/pkg/trait/trait.go
+++ b/pkg/trait/trait.go
@@ -29,13 +29,23 @@ import (
 	"github.com/apache/camel-k/pkg/client"
 	"github.com/apache/camel-k/pkg/platform"
 	"github.com/apache/camel-k/pkg/util/kubernetes"
+	"github.com/apache/camel-k/pkg/util/log"
 	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
 )
 
 func Apply(ctx context.Context, c client.Client, integration *v1.Integration, kit *v1.IntegrationKit) (*Environment, error) {
+	var ilog log.Logger
+	if integration != nil {
+		ilog = log.ForIntegration(integration)
+	} else if kit != nil {
+		ilog = log.ForIntegrationKit(kit)
+	} else {
+		ilog = log.WithValues("Function", "trait.Apply")
+	}
+
 	environment, err := newEnvironment(ctx, c, integration, kit)
 	if err != nil {
-		return nil, err
+		return nil, errors.Wrap(err, "error creating trait environment")
 	}
 
 	catalog := NewCatalog(c)
@@ -56,6 +66,13 @@ func Apply(ctx context.Context, c client.Client, integration *v1.Integration, ki
 		}
 	}
 
+	if integration != nil {
+		ilog.Debug("Applied traits to Integration", "integration", integration.Name, "namespace", integration.Namespace)
+	} else if kit != nil {
+		ilog.Debug("Applied traits to Integration kit", "integration kit", kit.Name, "namespace", kit.Namespace)
+	} else {
+		ilog.Debug("Applied traits")
+	}
 	return environment, nil
 }
 


[camel-k] 02/05: Preparing for next release: e2e preflight test improvement

Posted by pc...@apache.org.
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 d3c15f73673c24417cfd24584e7684cab1d280e9
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Thu Apr 28 17:02:19 2022 +0100

    Preparing for next release: e2e preflight test improvement
    
    * preflight-test.sh
     * Wait for the catalog source to become READY rather than assume it is
    
    * build-bundle-image.sh
    * build-index-image.sh
     * Change the upgrade-test channel to avoid a conflict with existing
       channels
    
    * .../operator.go
     * Functions assume existence of Config reference but this is no longer
       being created implicitly so add to avoid panics
---
 .../kamel-build-bundle/build-bundle-image.sh       |  2 +-
 .../kamel-build-bundle/build-index-image.sh        |  2 +-
 .../actions/kamel-preflight-test/preflight-test.sh | 27 ++++++++++++++++++----
 pkg/util/olm/operator.go                           | 10 ++++++++
 4 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/.github/actions/kamel-build-bundle/build-bundle-image.sh b/.github/actions/kamel-build-bundle/build-bundle-image.sh
index ff5aef7b1..575ada06d 100755
--- a/.github/actions/kamel-build-bundle/build-bundle-image.sh
+++ b/.github/actions/kamel-build-bundle/build-bundle-image.sh
@@ -108,7 +108,7 @@ export CUSTOM_IMAGE=${IMAGE_NAME}
 
 export PREV_XY_CHANNEL="stable-$(make get-last-released-version | grep -Po '\d.\d')"
 echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
-export NEW_XY_CHANNEL=stable-$(make get-version | grep -Po "\d.\d")
+export NEW_XY_CHANNEL=stable-dev-$(make get-version | grep -Po "\d.\d")
 echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV
 
 make bundle-build \
diff --git a/.github/actions/kamel-build-bundle/build-index-image.sh b/.github/actions/kamel-build-bundle/build-index-image.sh
index bfad918f0..8857d1531 100755
--- a/.github/actions/kamel-build-bundle/build-index-image.sh
+++ b/.github/actions/kamel-build-bundle/build-index-image.sh
@@ -211,7 +211,7 @@ cat << EOF >> ${CATALOG_DIR}/camel-k.yaml
 ---
 schema: olm.channel
 package: camel-k
-name: stable-$(make get-version | grep -Po "\d.\d")
+name: stable-dev-$(make get-version | grep -Po "\d.\d")
 entries:
   - name: camel-k.v$(make get-version | grep -Po "\d.\d.\d")
     replaces: $(make get-last-released-img-name).v$(make get-last-released-version | grep -Po "\d.\d.\d")
diff --git a/.github/actions/kamel-preflight-test/preflight-test.sh b/.github/actions/kamel-preflight-test/preflight-test.sh
index f85e41ef7..a815006da 100755
--- a/.github/actions/kamel-preflight-test/preflight-test.sh
+++ b/.github/actions/kamel-preflight-test/preflight-test.sh
@@ -113,11 +113,28 @@ if [ -n "${BUILD_CATALOG_SOURCE}" ]; then
   #
   # Check catalog source is actually available
   #
-  STATE=$(kubectl get catalogsource ${BUILD_CATALOG_SOURCE} -n ${IMAGE_NAMESPACE} -o=jsonpath='{.status.connectionState.lastObservedState}')
-  if [ "${STATE}" != "READY" ]; then
-    echo "Error: catalog source status is not ready."
-    exit 1
-  fi
+  timeout=5
+  catalog_ready=0
+  until [ ${catalog_ready} -eq 1 ] || [ ${timeout} -eq 0 ]
+  do
+    echo "Info: Awaiting catalog source to become ready"
+    let timeout=${timeout}-1
+
+    STATE=$(kubectl get catalogsource ${BUILD_CATALOG_SOURCE} -n ${IMAGE_NAMESPACE} -o=jsonpath='{.status.connectionState.lastObservedState}')
+    if [ "${STATE}" == "READY" ]; then
+      let catalog_ready=1
+      echo "Info: Catalog source is ready"
+      continue
+    else
+      echo "Warning: catalog source status is not ready."
+      if [ ${timeout} -eq 0 ]; then
+        echo "Error: timedout while awaiting catalog source to start"
+        exit 1
+      fi
+    fi
+
+    sleep 1m
+  done
 
   export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${IMAGE_NAMESPACE}
   export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE}
diff --git a/pkg/util/olm/operator.go b/pkg/util/olm/operator.go
index a2f30a9e7..9bc7a86e0 100644
--- a/pkg/util/olm/operator.go
+++ b/pkg/util/olm/operator.go
@@ -176,6 +176,7 @@ func Install(ctx context.Context, client client.Client, namespace string, global
 			Channel:                options.Channel,
 			StartingCSV:            options.StartingCSV,
 			InstallPlanApproval:    operatorsv1alpha1.ApprovalAutomatic,
+			Config:                 &operatorsv1alpha1.SubscriptionConfig{},
 		},
 	}
 	// Additional configuration
@@ -235,6 +236,15 @@ func maybeSetTolerations(sub *operatorsv1alpha1.Subscription, tolArray []string)
 		if err != nil {
 			return err
 		}
+		if sub == nil {
+			panic("sub is nil")
+		}
+		if sub.Spec == nil {
+			panic("sub.Spec is nil")
+		}
+		if sub.Spec.Config == nil {
+			panic("sub.Spec.Config is nil")
+		}
 		sub.Spec.Config.Tolerations = tolerations
 	}
 	return nil


[camel-k] 03/05: chore: Upgrade controller-gen to 0.6.1

Posted by pc...@apache.org.
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 83050f27bd6b81450e0888d1557b3c8ff5dd0b38
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Thu Apr 28 20:46:27 2022 +0100

    chore: Upgrade controller-gen to 0.6.1
---
 config/crd/bases/camel.apache.org_builds.yaml          |  2 +-
 config/crd/bases/camel.apache.org_camelcatalogs.yaml   |  2 +-
 config/crd/bases/camel.apache.org_integrationkits.yaml |  2 +-
 .../bases/camel.apache.org_integrationplatforms.yaml   |  2 +-
 config/crd/bases/camel.apache.org_integrations.yaml    |  2 +-
 config/crd/bases/camel.apache.org_kameletbindings.yaml |  2 +-
 config/crd/bases/camel.apache.org_kamelets.yaml        |  2 +-
 helm/camel-k/crds/crd-build.yaml                       |  2 +-
 helm/camel-k/crds/crd-camel-catalog.yaml               |  2 +-
 helm/camel-k/crds/crd-integration-kit.yaml             |  2 +-
 helm/camel-k/crds/crd-integration-platform.yaml        |  2 +-
 helm/camel-k/crds/crd-integration.yaml                 |  2 +-
 helm/camel-k/crds/crd-kamelet-binding.yaml             |  2 +-
 helm/camel-k/crds/crd-kamelet.yaml                     |  2 +-
 pkg/resources/resources.go                             | 18 +++++++++---------
 script/Makefile                                        |  2 +-
 16 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/config/crd/bases/camel.apache.org_builds.yaml b/config/crd/bases/camel.apache.org_builds.yaml
index c10a60b1b..f13c37914 100644
--- a/config/crd/bases/camel.apache.org_builds.yaml
+++ b/config/crd/bases/camel.apache.org_builds.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/config/crd/bases/camel.apache.org_camelcatalogs.yaml b/config/crd/bases/camel.apache.org_camelcatalogs.yaml
index 88661625a..dc89a50e4 100644
--- a/config/crd/bases/camel.apache.org_camelcatalogs.yaml
+++ b/config/crd/bases/camel.apache.org_camelcatalogs.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/config/crd/bases/camel.apache.org_integrationkits.yaml b/config/crd/bases/camel.apache.org_integrationkits.yaml
index 0aa8a4319..94c534481 100644
--- a/config/crd/bases/camel.apache.org_integrationkits.yaml
+++ b/config/crd/bases/camel.apache.org_integrationkits.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 91884f24f..8da22b4b4 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/config/crd/bases/camel.apache.org_integrations.yaml b/config/crd/bases/camel.apache.org_integrations.yaml
index c477a4534..09d67be81 100644
--- a/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/config/crd/bases/camel.apache.org_integrations.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/config/crd/bases/camel.apache.org_kameletbindings.yaml b/config/crd/bases/camel.apache.org_kameletbindings.yaml
index f02dfc036..0604bff56 100644
--- a/config/crd/bases/camel.apache.org_kameletbindings.yaml
+++ b/config/crd/bases/camel.apache.org_kameletbindings.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/config/crd/bases/camel.apache.org_kamelets.yaml b/config/crd/bases/camel.apache.org_kamelets.yaml
index 6f4aa3d76..48176545f 100644
--- a/config/crd/bases/camel.apache.org_kamelets.yaml
+++ b/config/crd/bases/camel.apache.org_kamelets.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml
index c10a60b1b..f13c37914 100644
--- a/helm/camel-k/crds/crd-build.yaml
+++ b/helm/camel-k/crds/crd-build.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/helm/camel-k/crds/crd-camel-catalog.yaml b/helm/camel-k/crds/crd-camel-catalog.yaml
index 88661625a..dc89a50e4 100644
--- a/helm/camel-k/crds/crd-camel-catalog.yaml
+++ b/helm/camel-k/crds/crd-camel-catalog.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/helm/camel-k/crds/crd-integration-kit.yaml b/helm/camel-k/crds/crd-integration-kit.yaml
index 0aa8a4319..94c534481 100644
--- a/helm/camel-k/crds/crd-integration-kit.yaml
+++ b/helm/camel-k/crds/crd-integration-kit.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml
index 91884f24f..8da22b4b4 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/helm/camel-k/crds/crd-integration.yaml b/helm/camel-k/crds/crd-integration.yaml
index c477a4534..09d67be81 100644
--- a/helm/camel-k/crds/crd-integration.yaml
+++ b/helm/camel-k/crds/crd-integration.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/helm/camel-k/crds/crd-kamelet-binding.yaml b/helm/camel-k/crds/crd-kamelet-binding.yaml
index f02dfc036..0604bff56 100644
--- a/helm/camel-k/crds/crd-kamelet-binding.yaml
+++ b/helm/camel-k/crds/crd-kamelet-binding.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/helm/camel-k/crds/crd-kamelet.yaml b/helm/camel-k/crds/crd-kamelet.yaml
index 6f4aa3d76..48176545f 100644
--- a/helm/camel-k/crds/crd-kamelet.yaml
+++ b/helm/camel-k/crds/crd-kamelet.yaml
@@ -19,7 +19,7 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    controller-gen.kubebuilder.io/version: v0.4.1
+    controller-gen.kubebuilder.io/version: v0.6.1
   creationTimestamp: null
   labels:
     app: camel-k
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 076e871bc..f1ec667ba 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -119,49 +119,49 @@ var assets = func() http.FileSystem {
 			modTime:          time.Time{},
 			uncompressedSize: 40381,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3d\x5d\x73\x23\xb9\x71\xef\xfa\x15\x5d\xa7\x87\xd5\x56\x89\xe4\xdd\xf9\xec\x5c\x94\x4a\xa5\x68\xed\xad\xad\xec\x87\x94\xa5\x6e\x6d\xbf\x09\x9c\x69\x92\x30\x67\x80\x09\x80\x11\x97\x4e\xe5\xbf\xa7\xd0\x00\x86\x43\x72\x3e\x30\xfa\xd8\x75\x6c\xe1\x65\x57\x43\xa0\xd1\x68\x34\xfa\x0b\x0d\xe0\x14\x46\x4f\x57\x4e\x4e\xe1\x3d\x4f\x50\x68\x4c\xc1\x48\x30\x2b\x84\x69\xc1\x92\x15\xc2\x4c\x2e\xcc\x86\x29\x84\xb7\xb2\x14\x29\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3d\x6b\x73\x1b\x39\x72\xdf\xf5\x2b\xba\x56\x1f\x2c\x57\x89\xe4\xee\xde\x23\x1b\xa5\x52\x29\x9e\xbc\xbe\x53\xfc\x90\x62\x6a\x7d\x77\xdf\x04\xce\x34\x49\x1c\x67\x80\x09\x80\x11\xcd\x4b\xe5\xbf\xa7\xd0\x00\x86\x43\x72\x1e\x18\x3d\xec\xcb\xad\xf0\xc5\xd6\x10\x68\x34\x1a\x8d\x7e\xa1\x01\x9c\xc2\xe8\xe9\xca\xc9\x29\xbc\xe7\x09\x0a\x8d\x29\x18\x09\x66\x85\x30\x2d\x58\xb2\x42\x98\xc9\x85\xd9\x30\x85\xf0\x56\x96\x22\x65\x [...]
 		},
 		"/crd/bases/camel.apache.org_camelcatalogs.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_camelcatalogs.yaml",
 			modTime:          time.Time{},
 			uncompressedSize: 18201,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\x4f\x73\xdb\xb8\x15\xbf\xf3\x53\xbc\x89\x0e\x49\x66\x24\x6a\xd3\xf6\xd0\x51\x4f\xae\xed\xec\xaa\xf1\xda\xa9\xa5\x64\x67\x8f\x10\xf9\x44\x21\x26\x01\x16\x00\x25\x6b\x3b\xfd\xee\x1d\x00\xa4\x48\x4a\xfc\x03\xca\xf6\x64\x77\xd6\x38\x59\x04\xf0\xf0\xc3\xfb\xff\x40\xd0\x23\x98\x3c\x5f\xf3\x46\x70\x43\x03\x64\x12\x43\x50\x1c\xd4\x06\xe1\x22\x25\xc1\x06\x61\xc1\xd7\x6a\x47\x04\xc2\x47\x9e\xb1\x90\x28\xca\x19\xbc\xbb\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\x4f\x73\xdb\xb8\x15\xbf\xf3\x53\xbc\x89\x0e\x49\x66\x24\x6a\xd3\xce\x74\x3a\xea\xc9\xb5\x9d\x5d\x35\x5e\x3b\xb5\x94\xec\xec\x11\x22\x9f\x28\xc4\x24\xc0\x02\xa0\x64\x6d\xa7\xdf\xbd\x03\x80\x14\x49\x89\x7f\x40\xd9\x9e\xec\xce\x1a\x27\x8b\x00\x1e\x7e\x78\xff\x1f\x08\x7a\x04\x93\xe7\x6b\xde\x08\x6e\x68\x80\x4c\x62\x08\x8a\x83\xda\x20\x5c\xa4\x24\xd8\x20\x2c\xf8\x5a\xed\x88\x40\xf8\xc8\x33\x16\x12\x45\x39\x83\x77\x [...]
 		},
 		"/crd/bases/camel.apache.org_integrationkits.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_integrationkits.yaml",
 			modTime:          time.Time{},
 			uncompressedSize: 10779,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x5a\xdf\x8f\xda\x48\xf2\x7f\xe7\xaf\x28\x65\x1e\x76\x22\x81\x67\xf3\xfd\xde\xc3\x89\x7b\xe2\x26\xc9\x2d\x4a\x32\x33\x0a\x64\x57\x2b\xe5\x61\x0a\xbb\x30\x1d\xec\x6e\x5f\x77\x1b\x86\x3b\xdd\xff\x7e\xaa\x6a\x1b\x0c\xd8\xc0\xb1\x89\xd6\x4f\x83\xbb\xbb\xea\x53\xbf\xab\xcb\x73\x03\x83\xef\xf7\xf4\x6e\xe0\xa3\x8a\x49\x3b\x4a\xc0\x1b\xf0\x0b\x82\x51\x81\xf1\x82\x60\x62\xe6\x7e\x8d\x96\xe0\xbd\x29\x75\x82\x5e\x19\x0d\xb7\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x5a\xdf\x8f\xda\x48\xf2\x7f\xe7\xaf\x28\x65\x1e\x76\x22\x81\x67\xf3\xfd\x4a\xa7\x13\xf7\xc4\x4d\x92\x5b\x94\x64\x66\x14\xc8\xae\x56\xca\xc3\x14\x76\x61\x3a\xd8\xdd\xbe\xee\x36\x0c\x77\xba\xff\xfd\x54\xd5\x36\x18\xb0\x81\x63\x13\xad\x9f\x06\x77\x77\xd5\xa7\x7e\x57\x97\xe7\x06\x06\xdf\xef\xe9\xdd\xc0\x47\x15\x93\x76\x94\x80\x37\xe0\x17\x04\xa3\x02\xe3\x05\xc1\xc4\xcc\xfd\x1a\x2d\xc1\x7b\x53\xea\x04\xbd\x32\x1a\x6e\x [...]
 		},
 		"/crd/bases/camel.apache.org_integrationplatforms.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_integrationplatforms.yaml",
 			modTime:          time.Time{},
 			uncompressedSize: 33300,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5d\x5f\x73\xe3\x38\x72\x7f\xd7\xa7\xe8\x5a\x3f\xcc\x6c\x95\x44\xed\xe6\xee\x2a\x17\xa5\x52\x29\x9d\xc6\xb3\xe7\x78\xc6\x76\x2c\xcd\x6c\xee\x69\x0d\x91\x2d\x12\x67\x10\x60\x00\x50\x1a\x5d\x2a\xdf\x3d\x85\x3f\xa4\x28\x89\xff\xe4\xf1\x6c\xb6\xb6\xc8\x87\x5d\x8f\x08\x34\x1a\xdd\x8d\x5f\x77\x03\xe8\xe2\x15\x4c\x5e\xef\x19\x5d\xc1\x07\x1a\x22\x57\x18\x81\x16\xa0\x13\x84\x79\x46\xc2\x04\x61\x29\x36\x7a\x47\x24\xc2\x7b\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5d\x5f\x73\xe3\x38\x72\x7f\xd7\xa7\xe8\x5a\x3f\xcc\x6c\x95\x44\xed\xe6\x72\xc9\x45\xa9\x54\x4a\xa7\xf1\xec\x39\x9e\xb1\x1d\x4b\x33\x9b\x7b\x5a\x43\x64\x8b\xc4\x19\x04\x18\x00\x94\x46\x97\xca\x77\x4f\xe1\x0f\x29\x4a\xe2\x3f\x79\x3c\x9b\xad\x2d\xf2\x61\xd7\x23\x02\x8d\x46\x77\xe3\xd7\xdd\x00\xba\x78\x05\x93\xd7\x7b\x46\x57\xf0\x81\x86\xc8\x15\x46\xa0\x05\xe8\x04\x61\x9e\x91\x30\x41\x58\x8a\x8d\xde\x11\x89\xf0\x5e\x [...]
 		},
 		"/crd/bases/camel.apache.org_integrations.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_integrations.yaml",
 			modTime:          time.Time{},
 			uncompressedSize: 391718,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x6b\x73\x1b\x37\xb6\x28\xfa\xdd\xbf\x02\x25\xa7\x8e\xa4\x1d\x91\xb2\x33\x73\xa6\xf6\xf8\x4e\x9d\x94\xb6\x24\x27\xba\xb1\x65\x96\xa5\x24\x27\xe5\x78\x12\xb0\x1b\x24\x71\xd4\x04\x7a\x00\x34\x25\xee\xeb\xfb\xdf\x6f\x61\x01\xe8\x07\x5f\xbd\xd0\x12\x1d\x67\x6e\x63\xaa\x26\x26\xc5\x5e\x8d\xc7\xc2\x7a\x3f\x9e\x93\xc1\xd3\x8d\x67\xcf\xc9\x1b\x9e\x30\xa1\x59\x4a\x8c\x24\x66\xc6\xc8\x59\x4e\x93\x19\x23\x37\x72\x62\xee\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7b\x73\x1b\x37\xf6\x28\xf8\xbf\x3f\x05\x4a\x49\x5d\x49\x13\x91\xb2\x33\x73\x53\xbf\xf1\x4e\xdd\x94\x46\x92\x13\x6d\x6c\x99\x65\x29\xc9\x4d\x39\x9e\x04\xec\x06\x49\x5c\x35\x81\x1e\x00\x4d\x89\xbf\xf5\x7e\xf7\x2d\x1c\x00\xfd\xe0\xab\x0f\x5a\xa2\xe3\xcc\x36\xa6\x6a\x62\x52\xec\xd3\x78\x1c\x9c\xf7\xe3\x0b\x32\x78\xba\xf1\xec\x0b\xf2\x9a\x27\x4c\x68\x96\x12\x23\x89\x99\x31\x72\x96\xd3\x64\xc6\xc8\x8d\x9c\x98\x7b\x [...]
 		},
 		"/crd/bases/camel.apache.org_kameletbindings.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_kameletbindings.yaml",
 			modTime:          time.Time{},
 			uncompressedSize: 458195,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\xfd\x73\x1b\x37\xb2\x2f\x8c\xff\xee\xbf\x02\x25\xa7\xae\xa4\x13\x92\xb2\xb3\xbb\xa9\xb3\xfe\x6e\xdd\x94\x56\x96\x13\x7d\x63\xcb\x2c\x4b\x71\x6e\xca\xc9\x49\xc0\x19\x90\xc4\xd5\x10\x98\x05\x30\x94\xb8\x8f\x9f\xff\xfd\x29\x34\x80\x79\xe1\x9b\xd0\x43\x51\x51\x36\x83\x53\x75\x36\x92\x35\x3d\x18\x00\xdd\xe8\xee\x4f\xbf\x3c\x27\xfd\x87\x1b\xcf\x9e\x93\xb7\x3c\x61\x42\xb3\x94\x18\x49\xcc\x94\x91\xd3\x9c\x26\x53\x46\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\xfd\x73\x1b\x37\xb2\x2f\x8c\xff\xee\xbf\x02\x25\xa7\xae\xa4\x13\x92\xb2\xb3\xbb\xa9\xb3\xfe\x6e\xdd\x94\x56\x96\x13\x7d\x63\xcb\x2c\x4b\x71\x6e\xca\xc9\x49\xc0\x19\x90\xc4\xd5\x10\x98\x05\x30\x94\xb8\x8f\x9f\xff\xfd\x29\x34\x80\x79\xe1\x9b\xd0\x43\x51\x51\x36\x83\x53\x75\x36\x92\x35\x3d\x18\x00\xdd\xe8\xee\x4f\xbf\x3c\x27\xfd\x87\x1b\xcf\x9e\x93\xb7\x3c\x61\x42\xb3\x94\x18\x49\xcc\x94\x91\xd3\x9c\x26\x53\x46\x [...]
 		},
 		"/crd/bases/camel.apache.org_kamelets.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_kamelets.yaml",
 			modTime:          time.Time{},
 			uncompressedSize: 25705,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\xff\x4f\xe3\x3a\xb6\xff\xbd\x7f\xc5\x11\x5c\x69\x18\x89\x94\x96\xc2\xdc\x99\xbe\x1f\x46\x5c\x98\xd9\xed\xbb\x5c\x06\x51\xd8\x7d\xf7\xc1\xac\xe4\x26\xa7\xad\x2f\x89\x9d\xb5\x1d\x4a\xf7\xc2\xff\xfe\x64\x3b\x49\xd3\x2f\x49\xdc\x52\xd8\xd1\xd3\x5a\x1a\x0d\x69\xec\xe3\xf3\xcd\xc7\xc7\xf6\xc7\xd9\x05\x6f\x7b\xa5\xb1\x0b\xe7\xd4\x47\x26\x31\x00\xc5\x41\x8d\x11\x4e\x62\xe2\x8f\x11\xfa\x7c\xa8\x26\x44\x20\x7c\xe5\x09\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\xff\x4f\xe3\x3a\xb6\xff\xbd\x7f\xc5\x11\x5c\x69\x18\x89\x94\x96\x02\x77\xa6\xef\x87\x11\x17\x66\x76\xfb\x2e\x17\x10\x85\xdd\x77\x1f\xcc\x4a\x6e\x72\xda\xfa\x92\xd8\x59\xdb\xa1\x74\x2f\xfc\xef\x4f\xb6\x93\x34\xa5\x4d\xe2\x96\xc2\x8e\x9e\xd6\xd2\x68\x48\x63\x1f\x9f\x6f\x3e\x3e\xb6\x3f\xce\x36\x78\x9b\x2b\x8d\x6d\x38\xa3\x3e\x32\x89\x01\x28\x0e\x6a\x8c\x70\x1c\x13\x7f\x8c\xd0\xe7\x43\x35\x21\x02\xe1\x1b\x4f\x58\x [...]
 		},
 		"/manager": &vfsgen۰DirInfo{
 			name:    "manager",
@@ -170,9 +170,9 @@ var assets = func() http.FileSystem {
 		"/manager/operator-deployment.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "operator-deployment.yaml",
 			modTime:          time.Time{},
-			uncompressedSize: 2659,
+			uncompressedSize: 2686,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x55\x4f\x8f\xda\xc8\x13\xbd\xfb\x53\x3c\xe1\x4b\x22\xcd\x98\x99\x9c\xf2\xf3\xef\xe4\x9d\x61\x36\x68\xb3\x80\x30\xd9\x28\xa7\x55\xd3\x2e\xec\x16\xed\x6e\x6f\x77\x19\xc2\x7e\xfa\x55\x1b\xcc\x00\xf3\x67\x13\x69\xa4\xf5\x09\x5c\xd5\xaf\xde\x7b\xf5\x6c\xc7\xb8\x7e\xbb\x2b\x8a\xf1\x59\x49\x32\x9e\x0a\xb0\x05\x57\x84\xac\x11\xb2\x22\xe4\x76\xc5\x5b\xe1\x08\x0f\xb6\x35\x85\x60\x65\x0d\xde\x65\xf9\xc3\x7b\xb4\xa6\x20\x07\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x56\x5d\x6f\xe2\x46\x14\x7d\xf7\xaf\x38\xc2\x2f\xbb\x52\x80\xb0\x4f\x5b\xf7\xc9\x4d\x48\x83\x9a\x02\xc2\x6c\xa3\x7d\xaa\x86\xf1\x05\x8f\x18\xcf\xb8\x33\xd7\xb0\xf4\xd7\x57\x63\x30\x01\xf2\xd1\x46\x8a\x54\x3f\x05\xdf\x3b\xe7\x9e\x8f\x6b\x3b\x31\xba\x1f\x77\x45\x31\x1e\x94\x24\xe3\x29\x07\x5b\x70\x41\x48\x2b\x21\x0b\x42\x66\x97\xbc\x15\x8e\x70\x67\x6b\x93\x0b\x56\xd6\xe0\x53\x9a\xdd\x7d\x46\x6d\x72\x72\xb0\x86\x60\x [...]
 		},
 		"/manager/operator-service-account.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "operator-service-account.yaml",
diff --git a/script/Makefile b/script/Makefile
index 528af4a56..2bfb00e07 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -22,7 +22,7 @@ RUNTIME_VERSION := 1.13.0
 BUILDAH_VERSION := 1.14.0
 KANIKO_VERSION := 0.17.1
 INSTALL_DEFAULT_KAMELETS := true
-CONTROLLER_GEN_VERSION := v0.4.1
+CONTROLLER_GEN_VERSION := v0.6.1
 OPERATOR_SDK_VERSION := v1.14.0
 KUSTOMIZE_VERSION := v4.1.2
 OPM_VERSION := v1.21.0


[camel-k] 05/05: chore: Fixes linter issues

Posted by pc...@apache.org.
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 45d976e792f13df46230c6159d26358e70952c79
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Fri Apr 29 16:23:46 2022 +0100

    chore: Fixes linter issues
---
 pkg/trait/trait.go            | 14 ++++++++------
 pkg/util/defaults/defaults.go |  2 +-
 pkg/util/knative/apis.go      | 10 +++++-----
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/pkg/trait/trait.go b/pkg/trait/trait.go
index 0158b78a4..98f8ef706 100644
--- a/pkg/trait/trait.go
+++ b/pkg/trait/trait.go
@@ -35,11 +35,12 @@ import (
 
 func Apply(ctx context.Context, c client.Client, integration *v1.Integration, kit *v1.IntegrationKit) (*Environment, error) {
 	var ilog log.Logger
-	if integration != nil {
+	switch {
+	case integration != nil:
 		ilog = log.ForIntegration(integration)
-	} else if kit != nil {
+	case kit != nil:
 		ilog = log.ForIntegrationKit(kit)
-	} else {
+	default:
 		ilog = log.WithValues("Function", "trait.Apply")
 	}
 
@@ -66,11 +67,12 @@ func Apply(ctx context.Context, c client.Client, integration *v1.Integration, ki
 		}
 	}
 
-	if integration != nil {
+	switch {
+	case integration != nil:
 		ilog.Debug("Applied traits to Integration", "integration", integration.Name, "namespace", integration.Namespace)
-	} else if kit != nil {
+	case kit != nil:
 		ilog.Debug("Applied traits to Integration kit", "integration kit", kit.Name, "namespace", kit.Namespace)
-	} else {
+	default:
 		ilog.Debug("Applied traits")
 	}
 	return environment, nil
diff --git a/pkg/util/defaults/defaults.go b/pkg/util/defaults/defaults.go
index e36b214b4..e6ba7de4c 100644
--- a/pkg/util/defaults/defaults.go
+++ b/pkg/util/defaults/defaults.go
@@ -47,5 +47,5 @@ const (
 	installDefaultKamelets = true
 )
 
-//GitCommit must be provided during application build
+// GitCommit must be provided during application build
 var GitCommit string
diff --git a/pkg/util/knative/apis.go b/pkg/util/knative/apis.go
index 2dffb8f15..a39a6ce12 100644
--- a/pkg/util/knative/apis.go
+++ b/pkg/util/knative/apis.go
@@ -206,29 +206,29 @@ func GetServiceType(ref v1.ObjectReference) (*knativev1.CamelServiceType, error)
 	return nil, nil
 }
 
-// nolint: gocritic
 func fillMissingReferenceDataWith(serviceTypes []GroupVersionKindResource, ref v1.ObjectReference) []v1.ObjectReference {
 	list := make([]v1.ObjectReference, 0)
-	if ref.APIVersion == "" && ref.Kind == "" {
+	switch {
+	case ref.APIVersion == "" && ref.Kind == "":
 		for _, st := range serviceTypes {
 			refCopy := ref.DeepCopy()
 			refCopy.APIVersion = st.GroupVersion().String()
 			refCopy.Kind = st.Kind
 			list = append(list, *refCopy)
 		}
-	} else if ref.APIVersion == "" {
+	case ref.APIVersion == "":
 		for _, gv := range getGroupVersions(serviceTypes, ref.Kind) {
 			refCopy := ref.DeepCopy()
 			refCopy.APIVersion = gv
 			list = append(list, *refCopy)
 		}
-	} else if ref.Kind == "" {
+	case ref.Kind == "":
 		for _, k := range getKinds(serviceTypes, ref.APIVersion) {
 			refCopy := ref.DeepCopy()
 			refCopy.Kind = k
 			list = append(list, *refCopy)
 		}
-	} else {
+	default:
 		list = append(list, ref)
 	}
 	return list