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/08/24 08:49:21 UTC

[camel-k] branch main updated (6851bb9aa -> 8acd6d2ca)

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 6851bb9aa chore: nightly SBOM update
     new f9a86542e fix(ci): lint errors
     new 8acd6d2ca fix(ctrl): default hot reload to false

The 2 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:
 e2e/common/config/config_reload_test.go              | 13 ++++++++-----
 pkg/apis/camel/v1/trait/mount.go                     |  2 +-
 pkg/controller/integration/integration_controller.go |  4 ++--
 pkg/trait/mount.go                                   |  4 ++--
 pkg/util/digest/digest.go                            |  2 +-
 pkg/util/resource/config.go                          | 11 -----------
 6 files changed, 14 insertions(+), 22 deletions(-)


[camel-k] 02/02: fix(ctrl): default hot reload to false

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 8acd6d2cae78cac7dd9fe35eb3168de89a1e7729
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Aug 24 09:03:22 2023 +0200

    fix(ctrl): default hot reload to false
---
 e2e/common/config/config_reload_test.go              | 13 ++++++++-----
 pkg/apis/camel/v1/trait/mount.go                     |  2 +-
 pkg/controller/integration/integration_controller.go |  2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/e2e/common/config/config_reload_test.go b/e2e/common/config/config_reload_test.go
index c419838f8..0e9f35c7c 100644
--- a/e2e/common/config/config_reload_test.go
+++ b/e2e/common/config/config_reload_test.go
@@ -40,7 +40,13 @@ func TestConfigmapHotReload(t *testing.T) {
 	cmData["my-configmap-key"] = "my configmap content"
 	CreatePlainTextConfigmap(ns, "my-hot-cm", cmData)
 
-	Expect(KamelRunWithID(operatorID, ns, "./files/config-configmap-route.groovy", "--config", "configmap:my-hot-cm").Execute()).To(Succeed())
+	Expect(KamelRunWithID(operatorID, ns,
+		"./files/config-configmap-route.groovy",
+		"--config",
+		"configmap:my-hot-cm",
+		"-t",
+		"mount.hot-reload=true",
+	).Execute()).To(Succeed())
 	Eventually(IntegrationPodPhase(ns, "config-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
 	Eventually(IntegrationConditionStatus(ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
 	Eventually(IntegrationLogs(ns, "config-configmap-route"), TestTimeoutShort).Should(ContainSubstring("my configmap content"))
@@ -52,7 +58,7 @@ func TestConfigmapHotReload(t *testing.T) {
 	Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 }
 
-func TestConfigmapHotReloadFalse(t *testing.T) {
+func TestConfigmapHotReloadDefault(t *testing.T) {
 	RegisterTestingT(t)
 
 	var cmData = make(map[string]string)
@@ -62,9 +68,6 @@ func TestConfigmapHotReloadFalse(t *testing.T) {
 	Expect(KamelRunWithID(operatorID, ns, "./files/config-configmap-route.groovy",
 		"--config",
 		"configmap:my-hot-cm-2",
-		// DO NOT hot reload
-		"-t",
-		"mount.hot-reload=false",
 	).Execute()).To(Succeed())
 	Eventually(IntegrationPodPhase(ns, "config-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
 	Eventually(IntegrationConditionStatus(ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
diff --git a/pkg/apis/camel/v1/trait/mount.go b/pkg/apis/camel/v1/trait/mount.go
index 2782a0eb3..d01da2f7d 100644
--- a/pkg/apis/camel/v1/trait/mount.go
+++ b/pkg/apis/camel/v1/trait/mount.go
@@ -35,6 +35,6 @@ type MountTrait struct {
 	Resources []string `property:"resources" json:"resources,omitempty"`
 	// A list of Persistent Volume Claims to be mounted. Syntax: [pvcname:/container/path]
 	Volumes []string `property:"volumes" json:"volumes,omitempty"`
-	// Enable "hot reload" when a secret/configmap mounted is edited (default true)
+	// Enable "hot reload" when a secret/configmap mounted is edited (default false)
 	HotReload *bool `property:"hot-reload" json:"hotReload,omitempty"`
 }
diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index 1a879d8cc..5f0837694 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -187,7 +187,7 @@ func configmapEnqueueRequestsFromMapFunc(ctx context.Context, c client.Client, c
 
 	for _, integration := range list.Items {
 		found := false
-		if integration.Spec.Traits.Mount == nil || !pointer.BoolDeref(integration.Spec.Traits.Mount.HotReload, true) {
+		if integration.Spec.Traits.Mount == nil || !pointer.BoolDeref(integration.Spec.Traits.Mount.HotReload, false) {
 			continue
 		}
 		for _, c := range integration.Spec.Traits.Mount.Configs {


[camel-k] 01/02: fix(ci): lint errors

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 f9a86542eaf5fe2936f5209dcf0736ce2a4689f3
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Aug 23 14:28:37 2023 +0200

    fix(ci): lint errors
---
 pkg/controller/integration/integration_controller.go |  2 +-
 pkg/trait/mount.go                                   |  4 ++--
 pkg/util/digest/digest.go                            |  2 +-
 pkg/util/resource/config.go                          | 11 -----------
 4 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index c4013d382..1a879d8cc 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -351,7 +351,7 @@ func add(ctx context.Context, mgr manager.Manager, c client.Client, r reconcile.
 
 				return integrationPlatformEnqueueRequestsFromMapFunc(ctx, c, p)
 			})).
-		// Watch for Configmaps or Secret used in the Integrations for updates.
+		// Watch for Configmaps or Secret used in the Integrations for updates
 		Watches(&source.Kind{Type: &corev1.ConfigMap{}},
 			handler.EnqueueRequestsFromMapFunc(func(a ctrl.Object) []reconcile.Request {
 				cm, ok := a.(*corev1.ConfigMap)
diff --git a/pkg/trait/mount.go b/pkg/trait/mount.go
index eaf58a9c3..815d01f2e 100644
--- a/pkg/trait/mount.go
+++ b/pkg/trait/mount.go
@@ -116,7 +116,7 @@ func (t *mountTrait) Apply(e *Environment) error {
 		// Volumes declared in the Integration resources
 		e.configureVolumesAndMounts(volumes, &container.VolumeMounts)
 		// Volumes declared in the trait config/resource options
-		err := t.configureVolumesAndMounts(e, volumes, &container.VolumeMounts)
+		err := t.configureVolumesAndMounts(volumes, &container.VolumeMounts)
 		if err != nil {
 			return err
 		}
@@ -125,7 +125,7 @@ func (t *mountTrait) Apply(e *Environment) error {
 	return nil
 }
 
-func (t *mountTrait) configureVolumesAndMounts(e *Environment, vols *[]corev1.Volume, mnts *[]corev1.VolumeMount) error {
+func (t *mountTrait) configureVolumesAndMounts(vols *[]corev1.Volume, mnts *[]corev1.VolumeMount) error {
 	for _, c := range t.Configs {
 		if conf, parseErr := utilResource.ParseConfig(c); parseErr == nil {
 			t.mountResource(vols, mnts, conf)
diff --git a/pkg/util/digest/digest.go b/pkg/util/digest/digest.go
index ed5e8331d..4965aedd9 100644
--- a/pkg/util/digest/digest.go
+++ b/pkg/util/digest/digest.go
@@ -40,7 +40,7 @@ import (
 )
 
 const (
-	// IntegrationDigestEnvVar --
+	// IntegrationDigestEnvVar -- .
 	IntegrationDigestEnvVar = "CAMEL_K_DIGEST"
 )
 
diff --git a/pkg/util/resource/config.go b/pkg/util/resource/config.go
index 8f52444ea..87fe5afba 100644
--- a/pkg/util/resource/config.go
+++ b/pkg/util/resource/config.go
@@ -18,7 +18,6 @@ limitations under the License.
 package resource
 
 import (
-	"crypto/sha1" // nolint: gosec
 	"fmt"
 	"regexp"
 	"strings"
@@ -175,13 +174,3 @@ func parse(item string, contentType ContentType) (*Config, error) {
 
 	return newConfig(cot, contentType, value), nil
 }
-
-func hashFrom(contents ...[]byte) string {
-	// SHA1 because we need to limit the length to less than 64 chars
-	hash := sha1.New() // nolint: gosec
-	for _, c := range contents {
-		hash.Write(c)
-	}
-
-	return fmt.Sprintf("%x", hash.Sum(nil))
-}