Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BACKPORT-1.8.x] fix(#3671): Fix native mode for KameletBinding #3695

Merged
merged 2 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/knative.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions pkg/trait/quarkus.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/json"
"fmt"
"sort"
"strings"

"github.com/rs/xid"

Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions pkg/trait/quarkus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down