Skip to content

Commit a29fbb4

Browse files
committed
fix(trait): use a configmap index
Closes #5924
1 parent 21f7461 commit a29fbb4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/trait/mount.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,17 @@ func (t *mountTrait) configureVolumesAndMounts(e *Environment, vols *[]corev1.Vo
180180
// configureCamelVolumesAndMounts is in charge to mount volumes and mounts coming from Camel configuration
181181
// (ie, sources, properties, kamelets, etcetera).
182182
func (t *mountTrait) configureCamelVolumesAndMounts(e *Environment, vols *[]corev1.Volume, mnts *[]corev1.VolumeMount) {
183-
// Sources
183+
// Sources index
184184
idx := 0
185+
// Configmap index (may differ as generated sources can have a different name)
186+
cmx := 0
185187
for _, s := range e.Integration.AllSources() {
186188
// We don't process routes embedded (native) or Kamelets
187189
if e.isEmbedded(s) || s.IsGeneratedFromKamelet() {
188190
continue
189191
}
190192
// Routes are copied under /etc/camel/sources and discovered by the runtime accordingly
191-
cmName := fmt.Sprintf("%s-source-%03d", e.Integration.Name, idx)
193+
cmName := fmt.Sprintf("%s-source-%03d", e.Integration.Name, cmx)
192194
if s.ContentRef != "" {
193195
cmName = s.ContentRef
194196
}
@@ -205,6 +207,9 @@ func (t *mountTrait) configureCamelVolumesAndMounts(e *Environment, vols *[]core
205207
*vols = append(*vols, *vol)
206208
*mnts = append(*mnts, *mnt)
207209
idx++
210+
if s.ContentRef == "" {
211+
cmx++
212+
}
208213
}
209214
// Resources (likely application properties or kamelets)
210215
if e.Resources != nil {

0 commit comments

Comments
 (0)