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 2021/02/18 16:11:33 UTC

[camel-k] 02/03: fix(openapi): Clear managed fields from OpenAPI generated ConfigMap to support server-side apply

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 158c28b4db7f3091bcac3dee199c33cc2a9a2920
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Feb 16 19:32:03 2021 +0100

    fix(openapi): Clear managed fields from OpenAPI generated ConfigMap to support server-side apply
---
 pkg/trait/openapi.go | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pkg/trait/openapi.go b/pkg/trait/openapi.go
index 99d94bc..ba23835 100644
--- a/pkg/trait/openapi.go
+++ b/pkg/trait/openapi.go
@@ -26,18 +26,18 @@ import (
 	"strconv"
 	"strings"
 
-	"github.com/apache/camel-k/pkg/util"
-	"github.com/apache/camel-k/pkg/util/digest"
 	"github.com/pkg/errors"
-	k8serrors "k8s.io/apimachinery/pkg/api/errors"
-	"sigs.k8s.io/controller-runtime/pkg/client"
 
 	corev1 "k8s.io/api/core/v1"
+	k8serrors "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
-	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+	"sigs.k8s.io/controller-runtime/pkg/client"
 
+	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+	"github.com/apache/camel-k/pkg/util"
 	"github.com/apache/camel-k/pkg/util/defaults"
+	"github.com/apache/camel-k/pkg/util/digest"
 	"github.com/apache/camel-k/pkg/util/gzip"
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/apache/camel-k/pkg/util/maven"
@@ -171,6 +171,8 @@ func (t *openAPITrait) generateOpenAPIConfigMap(e *Environment, resource v1.Reso
 		// ConfigMap already exists and matches the source
 		// Re-adding it to update its revision
 		cm.ResourceVersion = ""
+		// Clear the managed fields to support server-side apply
+		cm.ManagedFields = nil
 		e.Resources.Add(&cm)
 		return nil
 	}