From 68d18f515794b9c26dc8ba283ffee98f59d94885 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Thu, 23 Nov 2023 17:36:56 +0100 Subject: [PATCH] chore(trait): run mount only when necessary --- pkg/trait/mount.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/trait/mount.go b/pkg/trait/mount.go index 35324a633e..0a08eb798b 100644 --- a/pkg/trait/mount.go +++ b/pkg/trait/mount.go @@ -62,8 +62,11 @@ func (t *mountTrait) Configure(e *Environment) (bool, *TraitCondition, error) { } } - // mount trait needs always to be executed as it will process the sources - return true, nil, nil + // mount trait needs to be executed only when it has sources attached or any trait configuration + return len(e.Integration.Sources()) > 0 || + len(t.Configs) > 0 || + len(t.Resources) > 0 || + len(t.Volumes) > 0, nil, nil } func (t *mountTrait) Apply(e *Environment) error {