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

pcongiusti pushed a commit to branch release-2.5.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 2bf44a06d7ea87499e616acbc2b8af912c4216b4
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Sat Nov 16 15:52:50 2024 +0100

    fix(trait): use a configmap index
    
    Closes #5924
---
 pkg/trait/mount.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pkg/trait/mount.go b/pkg/trait/mount.go
index 38a770382..fe87b5db2 100644
--- a/pkg/trait/mount.go
+++ b/pkg/trait/mount.go
@@ -180,15 +180,17 @@ func (t *mountTrait) configureVolumesAndMounts(e 
*Environment, vols *[]corev1.Vo
 // configureCamelVolumesAndMounts is in charge to mount volumes and mounts 
coming from Camel configuration
 // (ie, sources, properties, kamelets, etcetera).
 func (t *mountTrait) configureCamelVolumesAndMounts(e *Environment, vols 
*[]corev1.Volume, mnts *[]corev1.VolumeMount) {
-       // Sources
+       // Sources index
        idx := 0
+       // Configmap index (may differ as generated sources can have a 
different name)
+       cmx := 0
        for _, s := range e.Integration.AllSources() {
                // We don't process routes embedded (native) or Kamelets
                if e.isEmbedded(s) || s.IsGeneratedFromKamelet() {
                        continue
                }
                // Routes are copied under /etc/camel/sources and discovered by 
the runtime accordingly
-               cmName := fmt.Sprintf("%s-source-%03d", e.Integration.Name, idx)
+               cmName := fmt.Sprintf("%s-source-%03d", e.Integration.Name, cmx)
                if s.ContentRef != "" {
                        cmName = s.ContentRef
                }
@@ -205,6 +207,9 @@ func (t *mountTrait) configureCamelVolumesAndMounts(e 
*Environment, vols *[]core
                *vols = append(*vols, *vol)
                *mnts = append(*mnts, *mnt)
                idx++
+               if s.ContentRef == "" {
+                       cmx++
+               }
        }
        // Resources (likely application properties or kamelets)
        if e.Resources != nil {

Reply via email to