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 b594c397f8bd96c27d871839e768b8c25d801c79
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Mon Oct 7 21:33:17 2024 +0200

    fix(trait): execute GC only in running phases
    
    This is required as many resource are not available in the Initialization 
phase, therefore may be removed even when they are expected to be instead 
updated (by Deployer trait).
    
    Closes #5874
---
 pkg/trait/gc.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pkg/trait/gc.go b/pkg/trait/gc.go
index 91254de68..be1ba1212 100644
--- a/pkg/trait/gc.go
+++ b/pkg/trait/gc.go
@@ -113,7 +113,9 @@ func (t *gcTrait) Configure(e *Environment) (bool, 
*TraitCondition, error) {
                return false, NewIntegrationConditionUserDisabled("GC"), nil
        }
 
-       return e.IntegrationInPhase(v1.IntegrationPhaseInitialization) || 
e.IntegrationInRunningPhases(), nil, nil
+       // We need to execute this trait only when all resources have been 
created and
+       // deployed with a new generation if there is was any change during the 
Integration drift.
+       return e.IntegrationInRunningPhases(), nil, nil
 }
 
 func (t *gcTrait) Apply(e *Environment) error {

Reply via email to