Skip to content

Commit

Permalink
fix(trait): use a configmap index
Browse files Browse the repository at this point in the history
Closes #5924
  • Loading branch information
squakez committed Jan 19, 2025
1 parent 6ee480f commit 2bf44a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/trait/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 {
Expand Down

0 comments on commit 2bf44a0

Please sign in to comment.