You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/03/29 07:55:39 UTC

[camel-k] branch release-1.10.x updated: fix #4167 : Default integrationPlatform created at operator startup dose not honor OPERATOR_ID config

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

pcongiusti pushed a commit to branch release-1.10.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-1.10.x by this push:
     new f9376ec62 fix #4167 : Default integrationPlatform created at operator startup dose not honor OPERATOR_ID config
f9376ec62 is described below

commit f9376ec62a6be6928b4e1a2730c6290711db522f
Author: Andrea Tarocchi <an...@gmail.com>
AuthorDate: Tue Mar 28 00:21:12 2023 +0200

    fix #4167 : Default integrationPlatform created at operator startup dose not honor OPERATOR_ID config
---
 pkg/cmd/operator/operator.go | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index e4fd8e4c6..03a89001d 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -247,20 +247,26 @@ func Run(healthPort, monitoringPort int32, leaderElection bool, leaderElectionID
 
 // findOrCreateIntegrationPlatform create default integration platform in operator namespace if not already exists.
 func findOrCreateIntegrationPlatform(ctx context.Context, c client.Client, operatorNamespace string) error {
+	operatorID := defaults.OperatorID()
 	var platformName string
-	if defaults.OperatorID() != "" {
-		platformName = defaults.OperatorID()
+	if operatorID != "" {
+		platformName = operatorID
 	} else {
 		platformName = platform.DefaultPlatformName
 	}
 
 	if pl, err := kubernetes.GetIntegrationPlatform(ctx, c, platformName, operatorNamespace); pl == nil || k8serrors.IsNotFound(err) {
 		defaultPlatform := v1.NewIntegrationPlatform(operatorNamespace, platformName)
+
 		if defaultPlatform.Labels == nil {
 			defaultPlatform.Labels = make(map[string]string)
 		}
 		defaultPlatform.Labels["camel.apache.org/platform.generated"] = "true"
 
+		if operatorID != "" {
+			defaultPlatform.SetOperatorID(operatorID)
+		}
+
 		if _, err := c.CamelV1().IntegrationPlatforms(operatorNamespace).Create(ctx, &defaultPlatform, metav1.CreateOptions{}); err != nil {
 			return err
 		}