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 571928270d5311767ac8d2684df02a060c3ebed7
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Tue Oct 10 16:36:10 2023 +0200

    fix(trait): configmap identifier
---
 pkg/trait/camel.go      | 6 ++++--
 pkg/trait/camel_test.go | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkg/trait/camel.go b/pkg/trait/camel.go
index e96dd6fcb..36e3d74b4 100644
--- a/pkg/trait/camel.go
+++ b/pkg/trait/camel.go
@@ -229,8 +229,9 @@ func (t *camelTrait) computeConfigMaps(e *Environment) 
[]ctrl.Object {
                )
        }
 
-       for i, s := range sources {
-               if s.ContentRef != "" || e.isEmbedded(s) {
+       i := 0
+       for _, s := range sources {
+               if s.ContentRef != "" || e.isEmbedded(s) || 
s.IsGeneratedFromKamelet() {
                        continue
                }
 
@@ -258,6 +259,7 @@ func (t *camelTrait) computeConfigMaps(e *Environment) 
[]ctrl.Object {
                }
 
                maps = append(maps, &cm)
+               i++
        }
 
        return maps
diff --git a/pkg/trait/camel_test.go b/pkg/trait/camel_test.go
index f6edf5eaa..692c5df21 100644
--- a/pkg/trait/camel_test.go
+++ b/pkg/trait/camel_test.go
@@ -195,7 +195,7 @@ func TestApplyCamelTraitWithSources(t *testing.T) {
 
        assert.Equal(t, 1, environment.Resources.Size())
        sourceCm := environment.Resources.GetConfigMap(func(cm 
*corev1.ConfigMap) bool {
-               return cm.Name == "some-integration-source-001" && 
cm.Annotations["camel.apache.org/source.language"] == "xml" && 
cm.Annotations["camel.apache.org/source.name"] == "source2.xml"
+               return cm.Name == "some-integration-source-000" && 
cm.Annotations["camel.apache.org/source.language"] == "xml" && 
cm.Annotations["camel.apache.org/source.name"] == "source2.xml"
        })
        assert.NotNil(t, sourceCm)
        assert.Equal(t, map[string]string{

Reply via email to