-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1778: allow pushing to broker via KameletBinding
- Loading branch information
1 parent
5d5bd11
commit d063a49
Showing
11 changed files
with
237 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Feature: Camel K can bind Kamelets to the broker | ||
|
||
Scenario: Sending event to the broker with KameletBinding | ||
Given integration logger-sink-binding is running | ||
Then integration logger-sink-binding should print message: Hello Custom Event |
34 changes: 34 additions & 0 deletions
34
e2e/yaks/common/kamelet-binding-broker/logger-sink-binding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# --------------------------------------------------------------------------- | ||
# 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: KameletBinding | ||
metadata: | ||
name: logger-sink-binding | ||
spec: | ||
source: | ||
ref: | ||
kind: Broker | ||
apiVersion: eventing.knative.dev/v1beta1 | ||
name: default | ||
properties: | ||
type: custom-type | ||
sink: | ||
ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1alpha1 | ||
name: logger-sink |
43 changes: 43 additions & 0 deletions
43
e2e/yaks/common/kamelet-binding-broker/logger-sink.kamelet.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# --------------------------------------------------------------------------- | ||
# 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: logger-sink | ||
label: | ||
camel.apache.org/kamelet.type: "sink" | ||
spec: | ||
definition: | ||
title: "Logger" | ||
description: "Logs the received payload of each incoming event" | ||
properties: | ||
prefix: | ||
title: Prefix | ||
description: The prefix to prepend to the logged message | ||
type: string | ||
default: "message: " | ||
types: | ||
in: | ||
mediaType: text/plain | ||
out: | ||
mediaType: text/plain | ||
flow: | ||
from: | ||
uri: "kamelet:source" | ||
steps: | ||
- log: "{{prefix}}${body}" |
37 changes: 37 additions & 0 deletions
37
e2e/yaks/common/kamelet-binding-broker/timer-source-binding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# --------------------------------------------------------------------------- | ||
# 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: KameletBinding | ||
metadata: | ||
name: timer-source-binding | ||
spec: | ||
source: | ||
ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1alpha1 | ||
name: timer-source | ||
properties: | ||
message: Hello Custom Event | ||
period: 1000 | ||
sink: | ||
ref: | ||
kind: Broker | ||
apiVersion: eventing.knative.dev/v1beta1 | ||
name: default | ||
properties: | ||
type: custom-type |
54 changes: 54 additions & 0 deletions
54
e2e/yaks/common/kamelet-binding-broker/timer-source.kamelet.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# --------------------------------------------------------------------------- | ||
# 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 | ||
label: | ||
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 | ||
types: | ||
out: | ||
mediaType: application/json | ||
schema: | ||
id: text.camel.apache.org | ||
type: string | ||
flow: | ||
from: | ||
uri: timer:tick | ||
parameters: | ||
period: "{{period}}" | ||
steps: | ||
- set-body: | ||
constant: "{{message}}" | ||
- to: "kamelet:sink" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# --------------------------------------------------------------------------- | ||
# 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: | | ||
# One of the two labels should work | ||
oc label namespace $YAKS_NAMESPACE eventing.knative.dev/injection=enabled | ||
oc label namespace $YAKS_NAMESPACE knative-eventing-injection=enabled | ||
kamel install -n $YAKS_NAMESPACE | ||
kubectl apply -f timer-source.kamelet.yaml -n $YAKS_NAMESPACE | ||
kubectl apply -f logger-sink.kamelet.yaml -n $YAKS_NAMESPACE | ||
kubectl apply -f timer-source-binding.yaml -n $YAKS_NAMESPACE | ||
kubectl apply -f logger-sink-binding.yaml -n $YAKS_NAMESPACE | ||
kubectl wait kameletbinding timer-source-binding --for=condition=Ready --timeout=10m -n $YAKS_NAMESPACE | ||
kubectl wait kameletbinding logger-sink-binding --for=condition=Ready --timeout=10m -n $YAKS_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters