From 767928c75323913ac1a6ade66a12d98fd1b99685 Mon Sep 17 00:00:00 2001 From: Christoph Deppisch Date: Tue, 27 Sep 2022 19:38:42 +0200 Subject: [PATCH 1/2] fix(#3671): Fix native mode for KameletBinding Propagate annotation trait configuration from Integration to IntegrationKit. This makes sure that the kit matches the integration once the native build is done. --- pkg/trait/quarkus.go | 11 +++++++++++ pkg/trait/quarkus_test.go | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go index f93de9cb09..828bd914b2 100644 --- a/pkg/trait/quarkus.go +++ b/pkg/trait/quarkus.go @@ -21,6 +21,7 @@ import ( "encoding/json" "fmt" "sort" + "strings" "github.com/rs/xid" @@ -270,6 +271,16 @@ func (t *quarkusTrait) newIntegrationKit(e *Environment, packageType quarkusPack if v, ok := integration.Annotations[v1.PlatformSelectorAnnotation]; ok { kit.Annotations[v1.PlatformSelectorAnnotation] = v } + + if kit.GetAnnotations() == nil { + kit.SetAnnotations(make(map[string]string)) + } + for k, v := range integration.Annotations { + if strings.HasPrefix(k, v1.TraitAnnotationPrefix) { + kit.GetAnnotations()[k] = v + } + } + operatorID := defaults.OperatorID() if operatorID != "" { kit.Annotations[v1.OperatorIDAnnotation] = operatorID diff --git a/pkg/trait/quarkus_test.go b/pkg/trait/quarkus_test.go index 1b54f3d93c..fb4ae4cf28 100644 --- a/pkg/trait/quarkus_test.go +++ b/pkg/trait/quarkus_test.go @@ -69,6 +69,27 @@ func TestApplyQuarkusTraitDefaultKitLayout(t *testing.T) { assert.Equal(t, environment.IntegrationKits[0].Labels[v1.IntegrationKitLayoutLabel], v1.IntegrationKitLayoutFastJar) } +func TestApplyQuarkusTraitAnnotationKitConfiguration(t *testing.T) { + quarkusTrait, environment := createNominalQuarkusTest() + environment.Integration.Status.Phase = v1.IntegrationPhaseBuildingKit + + if environment.Integration.GetAnnotations() == nil { + environment.Integration.SetAnnotations(make(map[string]string)) + } + environment.Integration.GetAnnotations()[v1.TraitAnnotationPrefix+"quarkus.foo"] = "camel-k" + + configured, err := quarkusTrait.Configure(environment) + assert.True(t, configured) + assert.Nil(t, err) + + err = quarkusTrait.Apply(environment) + assert.Nil(t, err) + assert.Len(t, environment.IntegrationKits, 1) + assert.Equal(t, v1.IntegrationKitLayoutFastJar, environment.IntegrationKits[0].Labels[v1.IntegrationKitLayoutLabel]) + assert.Equal(t, "camel-k", environment.IntegrationKits[0].Annotations[v1.TraitAnnotationPrefix+"quarkus.foo"]) + +} + func createNominalQuarkusTest() (*quarkusTrait, *Environment) { trait, _ := newQuarkusTrait().(*quarkusTrait) trait.Enabled = BoolP(true) From c532a156e9259d58da23198841fdedc6ff454fb9 Mon Sep 17 00:00:00 2001 From: Christoph Deppisch Date: Tue, 4 Oct 2022 21:20:08 +0200 Subject: [PATCH 2/2] chore(build): Update Kind cluster version Fixes "failed to set GOMAXPROCS from cgroups" errors on Camel K operator --- .github/workflows/builder.yml | 4 ++-- .github/workflows/knative.yml | 8 ++++---- .github/workflows/kubernetes.yml | 4 ++-- .github/workflows/upgrade.yml | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index b520ff8a7e..9d2efc1b58 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -83,8 +83,8 @@ jobs: - name: Kubernetes KinD Cluster uses: container-tools/kind-action@v1 with: - version: v0.11.0 - node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad + version: v0.14.0 + node_image: kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae - name: Info run: | kubectl cluster-info diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml index e333dbc1cc..3e28317288 100644 --- a/.github/workflows/knative.yml +++ b/.github/workflows/knative.yml @@ -82,8 +82,8 @@ jobs: - name: Kubernetes KinD Cluster uses: container-tools/kind-action@v1 with: - version: v0.11.0 - node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad + version: v0.14.0 + node_image: kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae - name: Info run: | kubectl version @@ -200,8 +200,8 @@ jobs: - name: Kubernetes KinD Cluster uses: container-tools/kind-action@v1 with: - version: v0.11.0 - node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad + version: v0.14.0 + node_image: kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae - name: Info run: | kubectl version diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml index 654d70a986..a693877f89 100644 --- a/.github/workflows/kubernetes.yml +++ b/.github/workflows/kubernetes.yml @@ -84,8 +84,8 @@ jobs: - name: Kubernetes KinD Cluster uses: container-tools/kind-action@v1 with: - version: v0.11.0 - node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad + version: v0.14.0 + node_image: kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae - name: Info run: | kubectl cluster-info diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml index f85cdfb191..d40813c872 100644 --- a/.github/workflows/upgrade.yml +++ b/.github/workflows/upgrade.yml @@ -85,8 +85,8 @@ jobs: - name: Kubernetes KinD Cluster uses: container-tools/kind-action@v1 with: - version: v0.11.0 - node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad + version: v0.14.0 + node_image: kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae - name: Info run: | kubectl cluster-info