diff --git a/deploy/traits.yaml b/deploy/traits.yaml index 62288dc222..69abaf6b95 100755 --- a/deploy/traits.yaml +++ b/deploy/traits.yaml @@ -530,9 +530,8 @@ traits: - name: filter-source-channels type: bool description: Enables filtering on events based on the header "ce-knativehistory". - Since this is an experimental headerthat can be removed in a future version - of Knative, filtering is enabled only when the integration islistening from - more than 1 channel. + Since this header has been removed in newer versions ofKnative, filtering is + disabled by default. - name: camel-source-compat type: bool description: Enables Knative CamelSource pre 0.15 compatibility fixes (will be @@ -808,7 +807,7 @@ traits: property. - name: service-bindings type: '[]string' - description: List of Provisioned Services and ServiceBindings in the form KIND.VERSION.GROUP/NAME[/NAMESPACE] + description: List of Provisioned Services and ServiceBindings in the form [[apigroup/]version:]kind:[namespace/]name - name: service platform: false profiles: diff --git a/docs/modules/ROOT/assets/attachments/schema/integration-schema.json b/docs/modules/ROOT/assets/attachments/schema/integration-schema.json index 14b7051876..6e720176ac 100644 --- a/docs/modules/ROOT/assets/attachments/schema/integration-schema.json +++ b/docs/modules/ROOT/assets/attachments/schema/integration-schema.json @@ -1257,6 +1257,9 @@ }, { "properties": { + "break-on-shutdown": { + "type": "string" + }, "copy": { "type": "string" }, @@ -3129,7 +3132,7 @@ "include": { "type": "string" }, - "json-view": { + "json-view-type-name": { "type": "string" }, "module-class-names": { @@ -3272,7 +3275,7 @@ "include": { "type": "string" }, - "json-view": { + "json-view-type-name": { "type": "string" }, "library": { @@ -4500,15 +4503,22 @@ ] }, "org.apache.camel.model.loadbalancer.CustomLoadBalancerDefinition": { - "type": "object", - "properties": { - "id": { + "anyOf": [ + { "type": "string" }, - "ref": { - "type": "string" + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "ref": { + "type": "string" + } + } } - } + ] }, "org.apache.camel.model.loadbalancer.FailoverLoadBalancerDefinition": { "type": "object", diff --git a/docs/modules/ROOT/assets/attachments/schema/kamelet-schema.json b/docs/modules/ROOT/assets/attachments/schema/kamelet-schema.json index 3b2cb45911..3c5802b99a 100644 --- a/docs/modules/ROOT/assets/attachments/schema/kamelet-schema.json +++ b/docs/modules/ROOT/assets/attachments/schema/kamelet-schema.json @@ -1192,6 +1192,9 @@ }, { "properties": { + "break-on-shutdown": { + "type": "string" + }, "copy": { "type": "string" }, @@ -3064,7 +3067,7 @@ "include": { "type": "string" }, - "json-view": { + "json-view-type-name": { "type": "string" }, "module-class-names": { @@ -3207,7 +3210,7 @@ "include": { "type": "string" }, - "json-view": { + "json-view-type-name": { "type": "string" }, "library": { @@ -4435,15 +4438,22 @@ ] }, "org.apache.camel.model.loadbalancer.CustomLoadBalancerDefinition": { - "type": "object", - "properties": { - "id": { + "anyOf": [ + { "type": "string" }, - "ref": { - "type": "string" + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "ref": { + "type": "string" + } + } } - } + ] }, "org.apache.camel.model.loadbalancer.FailoverLoadBalancerDefinition": { "type": "object", diff --git a/docs/modules/traits/pages/knative.adoc b/docs/modules/traits/pages/knative.adoc index 4b23f308c6..5f54e1baf5 100755 --- a/docs/modules/traits/pages/knative.adoc +++ b/docs/modules/traits/pages/knative.adoc @@ -66,9 +66,8 @@ Can contain simple event types or full Camel URIs (to use a specific broker). | knative.filter-source-channels | bool -| Enables filtering on events based on the header "ce-knativehistory". Since this is an experimental header -that can be removed in a future version of Knative, filtering is enabled only when the integration is -listening from more than 1 channel. +| Enables filtering on events based on the header "ce-knativehistory". Since this header has been removed in newer versions of +Knative, filtering is disabled by default. | knative.camel-source-compat | bool diff --git a/docs/modules/traits/pages/service-binding.adoc b/docs/modules/traits/pages/service-binding.adoc index eafff8fc46..75c755c73c 100755 --- a/docs/modules/traits/pages/service-binding.adoc +++ b/docs/modules/traits/pages/service-binding.adoc @@ -28,7 +28,7 @@ The following configuration options are available: | service-binding.service-bindings | []string -| List of Provisioned Services and ServiceBindings in the form KIND.VERSION.GROUP/NAME[/NAMESPACE] +| List of Provisioned Services and ServiceBindings in the form [[apigroup/]version:]kind:[namespace/]name |=== diff --git a/pkg/util/reference/reference.go b/pkg/util/reference/reference.go index 0458a89392..dc79cd59cf 100644 --- a/pkg/util/reference/reference.go +++ b/pkg/util/reference/reference.go @@ -18,6 +18,7 @@ limitations under the License. package reference import ( + "errors" "fmt" "regexp" "unicode" @@ -124,5 +125,20 @@ func (c *Converter) simpleDecodeString(str string) (corev1.ObjectReference, erro } func (c *Converter) ToString(ref corev1.ObjectReference) (string, error) { - return "", nil + if ref.Kind == "" { + return "", errors.New(`object reference is missing the "kind" field`) + } + if ref.Name == "" { + return "", errors.New(`object reference is missing the "name" field`) + } + res := "" + if ref.APIVersion != "" { + res += ref.APIVersion + ":" + } + res += ref.Kind + ":" + if ref.Namespace != "" { + res += ref.Namespace + "/" + } + res += ref.Name + return res, nil } diff --git a/pkg/util/reference/reference_test.go b/pkg/util/reference/reference_test.go index 5539602951..f13c5d8469 100644 --- a/pkg/util/reference/reference_test.go +++ b/pkg/util/reference/reference_test.go @@ -32,6 +32,7 @@ func TestExpressions(t *testing.T) { name string error bool ref corev1.ObjectReference + stringRef string }{ { name: "lowercase:source", @@ -53,6 +54,7 @@ func TestExpressions(t *testing.T) { APIVersion: "camel.apache.org/v1alpha1", Name: "source", }, + stringRef: "camel.apache.org/v1alpha1:Kamelet:source", }, { name: "ns1/source", @@ -62,6 +64,17 @@ func TestExpressions(t *testing.T) { Namespace: "ns1", Name: "source", }, + stringRef: "camel.apache.org/v1alpha1:Kamelet:ns1/source", + }, + { + name: "v1:Secret:ns1/scr2", + ref: corev1.ObjectReference{ + Kind: "Secret", + APIVersion: "v1", + Namespace: "ns1", + Name: "scr2", + }, + stringRef: "v1:Secret:ns1/scr2", }, { name: "ksvc:service", @@ -70,6 +83,7 @@ func TestExpressions(t *testing.T) { APIVersion: "serving.knative.dev/v1", Name: "service", }, + stringRef: "serving.knative.dev/v1:Service:service", }, { name: "channel:ns3/ch2", @@ -79,6 +93,7 @@ func TestExpressions(t *testing.T) { Namespace: "ns3", Name: "ch2", }, + stringRef: "messaging.knative.dev/v1:Channel:ns3/ch2", }, { name: "broker:default", @@ -87,6 +102,7 @@ func TestExpressions(t *testing.T) { APIVersion: "eventing.knative.dev/v1", Name: "default", }, + stringRef: "eventing.knative.dev/v1:Broker:default", }, { name: "PostgreSQL:ns1/db", @@ -95,6 +111,7 @@ func TestExpressions(t *testing.T) { Namespace: "ns1", Name: "db", }, + stringRef: "PostgreSQL:ns1/db", }, { name: "postgres.org/v1alpha1:PostgreSQL:ns1/db", @@ -104,6 +121,7 @@ func TestExpressions(t *testing.T) { Namespace: "ns1", Name: "db", }, + stringRef: "postgres.org/v1alpha1:PostgreSQL:ns1/db", }, } @@ -122,8 +140,12 @@ func TestExpressions(t *testing.T) { if tc.error { assert.Error(t, err) } else { + asString, err2 := converter.ToString(ref) + assert.NoError(t, err2) + assert.NoError(t, err) assert.Equal(t, tc.ref, ref) + assert.Equal(t, tc.stringRef, asString) } }) }