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:23 UTC

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

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 {