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

nferraro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit eb4e32e6d1e10018416d7ba7f53563ff638527f3
Author: nicolaferraro <ni.ferr...@gmail.com>
AuthorDate: Thu Oct 21 15:19:14 2021 +0200

    Fix #2687: fix profile on slow platform reconciliation
---
 pkg/controller/integration/platform_setup.go | 4 ++++
 pkg/platform/platform.go                     | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/pkg/controller/integration/platform_setup.go 
b/pkg/controller/integration/platform_setup.go
index de6ac1f..8d01324 100644
--- a/pkg/controller/integration/platform_setup.go
+++ b/pkg/controller/integration/platform_setup.go
@@ -78,6 +78,10 @@ func determineBestProfile(ctx context.Context, c 
client.Client, integration *v1.
                // Use platform profile if set
                return p.Status.Profile
        }
+       if p.Spec.Profile != "" {
+               // Use platform spec profile if set
+               return p.Spec.Profile
+       }
        if knative.IsEnabledInNamespace(ctx, c, integration.Namespace) {
                return v1.TraitProfileKnative
        }
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index 8bb2a46..f0abb99 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -176,6 +176,8 @@ func IsSecondary(p *v1.IntegrationPlatform) bool {
 func GetProfile(p *v1.IntegrationPlatform) v1.TraitProfile {
        if p.Status.Profile != "" {
                return p.Status.Profile
+       } else if p.Spec.Profile != "" {
+               return p.Spec.Profile
        }
 
        switch p.Status.Cluster {

Reply via email to