You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2020/02/26 18:34:52 UTC

[camel-k] 09/15: chore(platform): Move registry auto-configuration in a dedicated method

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

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

commit 1c1ea50f14fe0d425a66e290fd4e98837bb7eff4
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Feb 25 13:47:18 2020 +0100

    chore(platform): Move registry auto-configuration in a dedicated method
---
 pkg/platform/defaults.go | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go
index c508d25..c75de42 100644
--- a/pkg/platform/defaults.go
+++ b/pkg/platform/defaults.go
@@ -98,10 +98,27 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
 		}
 	}
 
-	// Default to using OpenShift internal container images registry when using a strategy other than S2I
+	err = configureRegistry(ctx, c, p)
+	if err != nil {
+		return err
+	}
+
+	if verbose && p.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategyS2I && p.Status.Build.Registry.Address == "" {
+		log.Log.Info("No registry specified for publishing images")
+	}
+
+	if verbose && p.Status.Build.Maven.GetTimeout().Duration != 0 {
+		log.Log.Infof("Maven Timeout set to %s", p.Status.Build.Maven.GetTimeout().Duration)
+	}
+
+	return nil
+}
+
+func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPlatform) error {
 	if p.Status.Cluster == v1.IntegrationPlatformClusterOpenShift &&
 		p.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategyS2I &&
 		p.Status.Build.Registry.Address == "" {
+		// Default to using OpenShift internal container images registry when using a strategy other than S2I
 		p.Status.Build.Registry.Address = "image-registry.openshift-image-registry.svc:5000"
 
 		// OpenShift automatically injects the service CA certificate into the service-ca.crt key on the ConfigMap
@@ -134,14 +151,6 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
 		}
 	}
 
-	if verbose && p.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategyS2I && p.Status.Build.Registry.Address == "" {
-		log.Log.Info("No registry specified for publishing images")
-	}
-
-	if verbose && p.Status.Build.Maven.GetTimeout().Duration != 0 {
-		log.Log.Infof("Maven Timeout set to %s", p.Status.Build.Maven.GetTimeout().Duration)
-	}
-
 	return nil
 }