You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2021/02/03 08:47:27 UTC
[camel-k] branch release-1.3.x updated (12056d9 -> 3c2074a)
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a change to branch release-1.3.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git.
from 12056d9 Fix a little typo good for testing backport action
new d146369 Fix #1928: use "id" property in kamelet binding for adding specific configuration
new 94f604b Fix #1939: workaround for catalogs with duplicate entries
new 06fd19f Fix #1986: use properties instead of URL encoding for Kamelets in bindings
new 3c2074a chore(test): remove old test
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../kamelet-autoload-specific.feature | 23 +++++++++++++++++
.../kamelet-autoload.feature | 21 ++++++++++++++++
.../kamelet-binding-autoload/secret-default.yaml | 10 ++++++++
.../kamelet-binding-autoload/secret-specific.yaml | 11 ++++++++
.../timer-source.kamelet.yaml | 8 +-----
.../yaks-config.yaml | 6 ++---
pkg/apis/camel/v1alpha1/kamelet_types.go | 7 ++++--
pkg/apis/camel/v1alpha1/kamelet_types_support.go | 10 ++++++++
pkg/controller/kameletbinding/common.go | 19 ++++++++++++++
pkg/kamelet/initialize.go | 18 ++++++++++++--
pkg/util/bindings/api.go | 2 ++
pkg/util/bindings/bindings_test.go | 29 ++++++++++++++++++++--
pkg/util/bindings/kamelet.go | 26 ++++++++++++++++---
pkg/util/camel/camel_runtime_catalog.go | 9 +++++++
script/gen_release_notes.sh | 4 +--
15 files changed, 181 insertions(+), 22 deletions(-)
create mode 100644 e2e/yaks/common/kamelet-binding-autoload/kamelet-autoload-specific.feature
create mode 100644 e2e/yaks/common/kamelet-binding-autoload/kamelet-autoload.feature
create mode 100644 e2e/yaks/common/kamelet-binding-autoload/secret-default.yaml
create mode 100644 e2e/yaks/common/kamelet-binding-autoload/secret-specific.yaml
copy e2e/yaks/common/{kamelet-binding => kamelet-binding-autoload}/timer-source.kamelet.yaml (92%)
copy e2e/yaks/common/{kamelet => kamelet-binding-autoload}/yaks-config.yaml (90%)
[camel-k] 04/04: chore(test): remove old test
Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a commit to branch release-1.3.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 3c2074a84dc523cab2a615ff9028741e2c737e6e
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Tue Feb 2 17:17:50 2021 +0100
chore(test): remove old test
---
pkg/util/bindings/bindings_test.go | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/pkg/util/bindings/bindings_test.go b/pkg/util/bindings/bindings_test.go
index 6108af1..084309a 100644
--- a/pkg/util/bindings/bindings_test.go
+++ b/pkg/util/bindings/bindings_test.go
@@ -161,20 +161,6 @@ func TestBindings(t *testing.T) {
},
},
{
- endpoint: v1alpha1.Endpoint{
- Ref: &corev1.ObjectReference{
- Kind: "Kamelet",
- APIVersion: "camel.apache.org/v1any1",
- Name: "mykamelet",
- },
- Properties: asEndpointProperties(map[string]string{
- "id": "myid?",
- "mymessage": "myval",
- }),
- },
- uri: "kamelet:mykamelet/myid%3F?mymessage=myval",
- },
- {
endpointType: v1alpha1.EndpointTypeSink,
endpoint: v1alpha1.Endpoint{
URI: asStringPointer("https://myurl/hey"),
[camel-k] 02/04: Fix #1939: workaround for catalogs with duplicate
entries
Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a commit to branch release-1.3.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 94f604b0e85c69d22496e4e30cc83d93aa5eac4e
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Fri Jan 29 17:00:42 2021 +0100
Fix #1939: workaround for catalogs with duplicate entries
---
pkg/util/camel/camel_runtime_catalog.go | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/pkg/util/camel/camel_runtime_catalog.go b/pkg/util/camel/camel_runtime_catalog.go
index 2482eff..dc71a40 100644
--- a/pkg/util/camel/camel_runtime_catalog.go
+++ b/pkg/util/camel/camel_runtime_catalog.go
@@ -36,6 +36,15 @@ func NewRuntimeCatalog(spec v1.CamelCatalogSpec) *RuntimeCatalog {
for id, artifact := range catalog.Artifacts {
for _, scheme := range artifact.Schemes {
scheme := scheme
+
+ // In case of duplicate only, choose the "org.apache.camel.quarkus" artifact (if present).
+ // Workaround for https://github.com/apache/camel-k-runtime/issues/592
+ if _, duplicate := catalog.artifactByScheme[scheme.ID]; duplicate {
+ if artifact.GroupID != "org.apache.camel.quarkus" {
+ continue
+ }
+ }
+
catalog.artifactByScheme[scheme.ID] = id
catalog.schemesByID[scheme.ID] = scheme
}
[camel-k] 01/04: Fix #1928: use "id" property in kamelet binding
for adding specific configuration
Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a commit to branch release-1.3.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit d14636936793275487362beb1fa7007d2e5cf1e0
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Thu Jan 21 11:08:26 2021 +0100
Fix #1928: use "id" property in kamelet binding for adding specific configuration
---
.../kamelet-autoload-specific.feature | 23 +++++++++++
.../kamelet-autoload.feature | 21 ++++++++++
.../kamelet-binding-autoload/secret-default.yaml | 10 +++++
.../kamelet-binding-autoload/secret-specific.yaml | 11 +++++
.../timer-source.kamelet.yaml | 48 ++++++++++++++++++++++
.../kamelet-binding-autoload/yaks-config.yaml | 29 +++++++++++++
pkg/apis/camel/v1alpha1/kamelet_types.go | 7 +++-
pkg/apis/camel/v1alpha1/kamelet_types_support.go | 10 +++++
pkg/kamelet/initialize.go | 18 +++++++-
pkg/util/bindings/bindings_test.go | 14 +++++++
pkg/util/bindings/kamelet.go | 6 +++
11 files changed, 193 insertions(+), 4 deletions(-)
diff --git a/e2e/yaks/common/kamelet-binding-autoload/kamelet-autoload-specific.feature b/e2e/yaks/common/kamelet-binding-autoload/kamelet-autoload-specific.feature
new file mode 100644
index 0000000..ddba9f0
--- /dev/null
+++ b/e2e/yaks/common/kamelet-binding-autoload/kamelet-autoload-specific.feature
@@ -0,0 +1,23 @@
+Feature: Camel K can load specific secrets for Kamelets
+
+ Background:
+ Given Disable auto removal of Kamelet resources
+ Given Disable auto removal of Kubernetes resources
+ Given Camel-K resource polling configuration
+ | maxAttempts | 20 |
+ | delayBetweenAttempts | 1000 |
+
+ Scenario: KameletBinding can load specific settings for Kamelet
+ Given create Kubernetes service stub-service-2 with target port 8081
+ And bind Kamelet timer-source to uri http://stub-service-2.${YAKS_NAMESPACE}.svc.cluster.local/specific
+ And KameletBinding source properties
+ | id | specific |
+ When create KameletBinding binding-specific
+ Then KameletBinding binding-specific should be available
+
+ Scenario: Verify specific binding
+ Given HTTP server "stub-service-2"
+ And HTTP server timeout is 60000 ms
+ Then expect HTTP request body: specific
+ And receive POST /specific
+ And delete KameletBinding binding-specific
diff --git a/e2e/yaks/common/kamelet-binding-autoload/kamelet-autoload.feature b/e2e/yaks/common/kamelet-binding-autoload/kamelet-autoload.feature
new file mode 100644
index 0000000..c92a126
--- /dev/null
+++ b/e2e/yaks/common/kamelet-binding-autoload/kamelet-autoload.feature
@@ -0,0 +1,21 @@
+Feature: Camel K can load default secrets for Kamelets
+
+ Background:
+ Given Disable auto removal of Kamelet resources
+ Given Disable auto removal of Kubernetes resources
+ Given Camel-K resource polling configuration
+ | maxAttempts | 20 |
+ | delayBetweenAttempts | 1000 |
+
+ Scenario: KameletBinding can load default settings for Kamelet
+ Given create Kubernetes service stub-service with target port 8080
+ And bind Kamelet timer-source to uri http://stub-service.${YAKS_NAMESPACE}.svc.cluster.local/default
+ When create KameletBinding binding
+ Then KameletBinding binding should be available
+
+ Scenario: Verify default binding
+ Given HTTP server "stub-service"
+ And HTTP server timeout is 60000 ms
+ Then expect HTTP request body: default
+ And receive POST /default
+ And delete KameletBinding binding
diff --git a/e2e/yaks/common/kamelet-binding-autoload/secret-default.yaml b/e2e/yaks/common/kamelet-binding-autoload/secret-default.yaml
new file mode 100644
index 0000000..edb12ce
--- /dev/null
+++ b/e2e/yaks/common/kamelet-binding-autoload/secret-default.yaml
@@ -0,0 +1,10 @@
+apiVersion: v1
+kind: Secret
+metadata:
+ name: secret-default
+ labels:
+ camel.apache.org/kamelet: timer-source
+type: Opaque
+data:
+ # camel.kamelet.timer-source.message=default
+ application.properties: Y2FtZWwua2FtZWxldC50aW1lci1zb3VyY2UubWVzc2FnZT1kZWZhdWx0Cg==
diff --git a/e2e/yaks/common/kamelet-binding-autoload/secret-specific.yaml b/e2e/yaks/common/kamelet-binding-autoload/secret-specific.yaml
new file mode 100644
index 0000000..b5cbfcb
--- /dev/null
+++ b/e2e/yaks/common/kamelet-binding-autoload/secret-specific.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Secret
+metadata:
+ name: secret-specific
+ labels:
+ camel.apache.org/kamelet: timer-source
+ camel.apache.org/kamelet.configuration: specific
+type: Opaque
+data:
+ # camel.kamelet.timer-source.specific.message=specific
+ application.properties: Y2FtZWwua2FtZWxldC50aW1lci1zb3VyY2Uuc3BlY2lmaWMubWVzc2FnZT1zcGVjaWZpYwo=
diff --git a/e2e/yaks/common/kamelet-binding-autoload/timer-source.kamelet.yaml b/e2e/yaks/common/kamelet-binding-autoload/timer-source.kamelet.yaml
new file mode 100644
index 0000000..eb74334
--- /dev/null
+++ b/e2e/yaks/common/kamelet-binding-autoload/timer-source.kamelet.yaml
@@ -0,0 +1,48 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+ name: timer-source
+ labels:
+ camel.apache.org/kamelet.type: "source"
+spec:
+ definition:
+ title: "Timer"
+ description: "Produces periodic events with a custom payload"
+ required:
+ - message
+ properties:
+ period:
+ title: Period
+ description: The time interval between two events
+ type: integer
+ default: 1000
+ message:
+ title: Message
+ description: The message to generate
+ type: string
+ flow:
+ from:
+ uri: timer:tick
+ parameters:
+ period: "{{period}}"
+ steps:
+ - set-body:
+ constant: "{{message}}"
+ - to: "kamelet:sink"
diff --git a/e2e/yaks/common/kamelet-binding-autoload/yaks-config.yaml b/e2e/yaks/common/kamelet-binding-autoload/yaks-config.yaml
new file mode 100644
index 0000000..a71f271
--- /dev/null
+++ b/e2e/yaks/common/kamelet-binding-autoload/yaks-config.yaml
@@ -0,0 +1,29 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+config:
+ namespace:
+ temporary: true
+pre:
+- name: installation
+ run: |
+ kamel install -n $YAKS_NAMESPACE
+
+ kubectl apply -f secret-default.yaml -n $YAKS_NAMESPACE
+ kubectl apply -f secret-specific.yaml -n $YAKS_NAMESPACE
+
+ kubectl apply -f timer-source.kamelet.yaml -n $YAKS_NAMESPACE
diff --git a/pkg/apis/camel/v1alpha1/kamelet_types.go b/pkg/apis/camel/v1alpha1/kamelet_types.go
index 7a1cef7..987593d 100644
--- a/pkg/apis/camel/v1alpha1/kamelet_types.go
+++ b/pkg/apis/camel/v1alpha1/kamelet_types.go
@@ -29,6 +29,7 @@ const (
var (
reservedKameletNames = map[string]bool{"source": true, "sink": true}
+ KameletIDProperty = "id"
)
// KameletSpec defines the desired state of Kamelet
@@ -94,8 +95,10 @@ const (
)
const (
- // KameletConditionIllegalName --
- KameletConditionIllegalName string = "IllegalName"
+ // KameletConditionReasonInvalidName --
+ KameletConditionReasonInvalidName string = "InvalidName"
+ // KameletConditionReasonInvalidProperty --
+ KameletConditionReasonInvalidProperty string = "InvalidProperty"
)
type KameletPhase string
diff --git a/pkg/apis/camel/v1alpha1/kamelet_types_support.go b/pkg/apis/camel/v1alpha1/kamelet_types_support.go
index 2aa2c85..9e6f540 100644
--- a/pkg/apis/camel/v1alpha1/kamelet_types_support.go
+++ b/pkg/apis/camel/v1alpha1/kamelet_types_support.go
@@ -140,3 +140,13 @@ func (in *KameletStatus) RemoveCondition(condType KameletConditionType) {
func ValidKameletName(name string) bool {
return !reservedKameletNames[name]
}
+
+func ValidKameletProperties(kamelet *Kamelet) bool {
+ if kamelet == nil || kamelet.Spec.Definition == nil || kamelet.Spec.Definition.Properties == nil {
+ return true
+ }
+ if _, idPresent := kamelet.Spec.Definition.Properties[KameletIDProperty]; idPresent {
+ return false
+ }
+ return true
+}
diff --git a/pkg/kamelet/initialize.go b/pkg/kamelet/initialize.go
index 755c9fc..7fd4373 100644
--- a/pkg/kamelet/initialize.go
+++ b/pkg/kamelet/initialize.go
@@ -30,14 +30,28 @@ import (
func Initialize(kamelet *v1alpha1.Kamelet) (*v1alpha1.Kamelet, error) {
target := kamelet.DeepCopy()
+ ok := true
if !v1alpha1.ValidKameletName(kamelet.Name) {
- target.Status.Phase = v1alpha1.KameletPhaseError
+ ok = false
target.Status.SetCondition(
v1alpha1.KameletConditionReady,
corev1.ConditionFalse,
- v1alpha1.KameletConditionIllegalName,
+ v1alpha1.KameletConditionReasonInvalidName,
fmt.Sprintf("Kamelet name %q is reserved", kamelet.Name),
)
+ }
+ if !v1alpha1.ValidKameletProperties(kamelet) {
+ ok = false
+ target.Status.SetCondition(
+ v1alpha1.KameletConditionReady,
+ corev1.ConditionFalse,
+ v1alpha1.KameletConditionReasonInvalidProperty,
+ fmt.Sprintf("Kamelet property %q is reserved and cannot be part of the schema", v1alpha1.KameletIDProperty),
+ )
+ }
+
+ if !ok {
+ target.Status.Phase = v1alpha1.KameletPhaseError
} else {
target.Status.Phase = v1alpha1.KameletPhaseReady
target.Status.SetCondition(
diff --git a/pkg/util/bindings/bindings_test.go b/pkg/util/bindings/bindings_test.go
index 72e8ce5..55d005f 100644
--- a/pkg/util/bindings/bindings_test.go
+++ b/pkg/util/bindings/bindings_test.go
@@ -137,6 +137,20 @@ func TestBindings(t *testing.T) {
uri: "kamelet:mykamelet?encodedkey%3F=encoded%3Dval&mymessage=myval",
},
{
+ endpoint: v1alpha1.Endpoint{
+ Ref: &corev1.ObjectReference{
+ Kind: "Kamelet",
+ APIVersion: "camel.apache.org/v1any1",
+ Name: "mykamelet",
+ },
+ Properties: asEndpointProperties(map[string]string{
+ "id": "myid?",
+ "mymessage": "myval",
+ }),
+ },
+ uri: "kamelet:mykamelet/myid%3F?mymessage=myval",
+ },
+ {
endpointType: v1alpha1.EndpointTypeSink,
endpoint: v1alpha1.Endpoint{
URI: asStringPointer("https://myurl/hey"),
diff --git a/pkg/util/bindings/kamelet.go b/pkg/util/bindings/kamelet.go
index 48fc456..089a7d4 100644
--- a/pkg/util/bindings/kamelet.go
+++ b/pkg/util/bindings/kamelet.go
@@ -50,6 +50,12 @@ func (k KameletBindingProvider) Translate(ctx BindingContext, endpointType v1alp
if err != nil {
return nil, err
}
+
+ if id, ok := props[v1alpha1.KameletIDProperty]; ok && id != "" {
+ delete(props, v1alpha1.KameletIDProperty)
+ kameletURI = fmt.Sprintf("%s/%s", kameletURI, url.PathEscape(id))
+ }
+
kameletURI = uri.AppendParameters(kameletURI, props)
return &Binding{
[camel-k] 03/04: Fix #1986: use properties instead of URL encoding
for Kamelets in bindings
Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a commit to branch release-1.3.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 06fd19f3e5309cd64e60eb233a71d9e0aa7ae70a
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Tue Feb 2 13:30:35 2021 +0100
Fix #1986: use properties instead of URL encoding for Kamelets in bindings
---
pkg/controller/kameletbinding/common.go | 19 +++++++++++++++++++
pkg/util/bindings/api.go | 2 ++
pkg/util/bindings/bindings_test.go | 29 +++++++++++++++++++++++++++--
pkg/util/bindings/kamelet.go | 24 ++++++++++++++++++------
script/gen_release_notes.sh | 4 ++--
5 files changed, 68 insertions(+), 10 deletions(-)
diff --git a/pkg/controller/kameletbinding/common.go b/pkg/controller/kameletbinding/common.go
index a50b202..1fc8dc6 100644
--- a/pkg/controller/kameletbinding/common.go
+++ b/pkg/controller/kameletbinding/common.go
@@ -20,6 +20,8 @@ package kameletbinding
import (
"context"
"encoding/json"
+ "fmt"
+ "sort"
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
@@ -90,6 +92,23 @@ func createIntegrationFor(ctx context.Context, c client.Client, kameletbinding *
}
}
+ if len(from.ApplicationProperties) > 0 || len(to.ApplicationProperties) > 0 {
+ propList := make([]string, 0, len(from.ApplicationProperties)+len(to.ApplicationProperties))
+ for k, v := range from.ApplicationProperties {
+ propList = append(propList, fmt.Sprintf("%s=%s", k, v))
+ }
+ for k, v := range to.ApplicationProperties {
+ propList = append(propList, fmt.Sprintf("%s=%s", k, v))
+ }
+ sort.Strings(propList)
+ for _, p := range propList {
+ it.Spec.Configuration = append(it.Spec.Configuration, v1.ConfigurationSpec{
+ Type: "property",
+ Value: p,
+ })
+ }
+ }
+
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": from.URI,
diff --git a/pkg/util/bindings/api.go b/pkg/util/bindings/api.go
index 05ea123..f5debd3 100644
--- a/pkg/util/bindings/api.go
+++ b/pkg/util/bindings/api.go
@@ -38,6 +38,8 @@ type Binding struct {
URI string
// Traits is a partial trait specification that should be merged into the integration
Traits map[string]v1.TraitSpec
+ // ApplicationProperties contain properties that should be set on the integration for the binding to work
+ ApplicationProperties map[string]string
}
// BindingProvider maps a KameletBinding endpoint into Camel K resources
diff --git a/pkg/util/bindings/bindings_test.go b/pkg/util/bindings/bindings_test.go
index 55d005f..6108af1 100644
--- a/pkg/util/bindings/bindings_test.go
+++ b/pkg/util/bindings/bindings_test.go
@@ -39,6 +39,7 @@ func TestBindings(t *testing.T) {
profile camelv1.TraitProfile
uri string
traits map[string]camelv1.TraitSpec
+ props map[string]string
}{
{
endpointType: v1alpha1.EndpointTypeSink,
@@ -113,6 +114,7 @@ func TestBindings(t *testing.T) {
uri: "knative:event/myeventtype?apiVersion=eventing.knative.dev%2Fv1beta1&kind=Broker",
},
{
+ endpointType: v1alpha1.EndpointTypeSource,
endpoint: v1alpha1.Endpoint{
Ref: &corev1.ObjectReference{
Kind: "Kamelet",
@@ -120,9 +122,10 @@ func TestBindings(t *testing.T) {
Name: "mykamelet",
},
},
- uri: "kamelet:mykamelet",
+ uri: "kamelet:mykamelet/source",
},
{
+ endpointType: v1alpha1.EndpointTypeSink,
endpoint: v1alpha1.Endpoint{
Ref: &corev1.ObjectReference{
Kind: "Kamelet",
@@ -134,7 +137,28 @@ func TestBindings(t *testing.T) {
"encodedkey?": "encoded=val",
}),
},
- uri: "kamelet:mykamelet?encodedkey%3F=encoded%3Dval&mymessage=myval",
+ uri: "kamelet:mykamelet/sink",
+ props: map[string]string{
+ "camel.kamelet.mykamelet.sink.encodedkey?": "encoded=val",
+ "camel.kamelet.mykamelet.sink.mymessage": "myval",
+ },
+ },
+ {
+ endpoint: v1alpha1.Endpoint{
+ Ref: &corev1.ObjectReference{
+ Kind: "Kamelet",
+ APIVersion: "camel.apache.org/v1any1",
+ Name: "mykamelet",
+ },
+ Properties: asEndpointProperties(map[string]string{
+ "id": "myid?",
+ "mymessage": "myval",
+ }),
+ },
+ uri: "kamelet:mykamelet/myid%3F",
+ props: map[string]string{
+ "camel.kamelet.mykamelet.myid?.mymessage": "myval",
+ },
},
{
endpoint: v1alpha1.Endpoint{
@@ -206,6 +230,7 @@ func TestBindings(t *testing.T) {
assert.NotNil(t, binding)
assert.Equal(t, tc.uri, binding.URI)
assert.Equal(t, tc.traits, binding.Traits)
+ assert.Equal(t, tc.props, binding.ApplicationProperties)
})
}
}
diff --git a/pkg/util/bindings/kamelet.go b/pkg/util/bindings/kamelet.go
index 089a7d4..ca83252 100644
--- a/pkg/util/bindings/kamelet.go
+++ b/pkg/util/bindings/kamelet.go
@@ -22,7 +22,6 @@ import (
"net/url"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
- "github.com/apache/camel-k/pkg/util/uri"
"k8s.io/apimachinery/pkg/runtime/schema"
)
@@ -44,22 +43,35 @@ func (k KameletBindingProvider) Translate(ctx BindingContext, endpointType v1alp
}
// it translates only Kamelet refs
if e.Ref.Kind == v1alpha1.KameletKind && gv.Group == v1alpha1.SchemeGroupVersion.Group {
- kameletURI := fmt.Sprintf("kamelet:%s", url.PathEscape(e.Ref.Name))
+ kameletName := url.PathEscape(e.Ref.Name)
+ kameletURI := fmt.Sprintf("kamelet:%s", kameletName)
props, err := e.Properties.GetPropertyMap()
if err != nil {
return nil, err
}
- if id, ok := props[v1alpha1.KameletIDProperty]; ok && id != "" {
+ id, idPresent := props[v1alpha1.KameletIDProperty]
+ if idPresent {
delete(props, v1alpha1.KameletIDProperty)
- kameletURI = fmt.Sprintf("%s/%s", kameletURI, url.PathEscape(id))
+ } else {
+ // Let's use literal "source" or "sink" as ID for the Kamelet
+ id = string(endpointType)
}
+ kameletURI = fmt.Sprintf("%s/%s", kameletURI, url.PathEscape(id))
- kameletURI = uri.AppendParameters(kameletURI, props)
+ var applicationProperties map[string]string
+ if len(props) > 0 {
+ applicationProperties = make(map[string]string, len(props))
+ for k, v := range props {
+ propKey := fmt.Sprintf("camel.kamelet.%s.%s.%s", kameletName, id, k)
+ applicationProperties[propKey] = v
+ }
+ }
return &Binding{
- URI: kameletURI,
+ URI: kameletURI,
+ ApplicationProperties: applicationProperties,
}, nil
}
return nil, nil
diff --git a/script/gen_release_notes.sh b/script/gen_release_notes.sh
index 4caea9f..070e08d 100755
--- a/script/gen_release_notes.sh
+++ b/script/gen_release_notes.sh
@@ -23,8 +23,8 @@ if [ "$#" -ne 2 ]; then
fi
location=$(dirname $0)
-last_tag=$1
-new_tag=$2
+last_tag=v$1
+new_tag=v$2
echo "Generating release notes for version $new_tag starting from tag $last_tag"