-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
chore(addon): move strimzi into core
Ref #5787
Showing
38 changed files
with
666 additions
and
145 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# --------------------------------------------------------------------------- | ||
# 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. | ||
# --------------------------------------------------------------------------- | ||
|
||
name: kafka | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- "release-*" | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'java/**' | ||
- 'proposals/**' | ||
- '**.adoc' | ||
- '**.md' | ||
- 'KEYS' | ||
- 'LICENSE' | ||
- 'NOTICE' | ||
push: | ||
branches: | ||
- main | ||
- "release-*" | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'java/**' | ||
- 'proposals/**' | ||
- '**.adoc' | ||
- '**.md' | ||
- 'KEYS' | ||
- 'LICENSE' | ||
- 'NOTICE' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
kafka-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
submodules: recursive | ||
|
||
- name: Infra setting | ||
uses: ./.github/actions/infra-setting | ||
|
||
- name: Install Kafka | ||
shell: bash | ||
run: | | ||
./e2e/kafka/setup/setup.sh | ||
- name: Install operator | ||
shell: bash | ||
run: | | ||
kubectl create ns camel-k | ||
make install-k8s-global | ||
kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=60s | ||
- name: Run test | ||
shell: bash | ||
run: | | ||
DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-kafka |
This file was deleted.
Oops, something went wrong.
45 changes: 18 additions & 27 deletions
45
script/gen_client_strimzi.sh → e2e/kafka/files/kafka-to-log.yaml
100755 → 100644
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 |
---|---|---|
@@ -1,40 +1,31 @@ | ||
#!/bin/sh | ||
|
||
# --------------------------------------------------------------------------- | ||
# 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 | ||
# 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. | ||
|
||
set -e | ||
|
||
location=$(dirname $0) | ||
rootdir=$location/.. | ||
|
||
GO111MODULE=on | ||
|
||
echo "Generating Go client code for Strimzi addon..." | ||
|
||
cd $rootdir | ||
|
||
$(go env GOPATH)/bin/client-gen \ | ||
-h script/headers/default.txt \ | ||
--input duck/v1beta2 \ | ||
--input-base=github.com/apache/camel-k/v2/addons/strimzi \ | ||
--output-base=. \ | ||
--output-package=github.com/apache/camel-k/v2/addons/strimzi/duck/client | ||
|
||
rm -r ./addons/strimzi/duck/client || true | ||
|
||
mv github.com/apache/camel-k/v2/addons/strimzi/duck/client ./addons/strimzi/duck/ | ||
|
||
rm -r ./github.com | ||
# --------------------------------------------------------------------------- | ||
apiVersion: camel.apache.org/v1 | ||
kind: Pipe | ||
metadata: | ||
name: kafka-to-log | ||
namespace: kafka | ||
spec: | ||
sink: | ||
uri: log:info | ||
source: | ||
ref: | ||
kind: Kafka | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
name: my-cluster | ||
properties: | ||
topic: my-topic-autogen |
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,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. | ||
# --------------------------------------------------------------------------- | ||
apiVersion: camel.apache.org/v1 | ||
kind: Pipe | ||
metadata: | ||
name: kafkatopic-to-log | ||
namespace: kafka | ||
spec: | ||
sink: | ||
uri: log:info | ||
source: | ||
ref: | ||
kind: KafkaTopic | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
name: my-topic |
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,31 @@ | ||
# --------------------------------------------------------------------------- | ||
# 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/v1 | ||
kind: Pipe | ||
metadata: | ||
name: timer-to-kafka | ||
namespace: kafka | ||
spec: | ||
source: | ||
uri: timer:foo | ||
sink: | ||
ref: | ||
kind: Kafka | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
name: my-cluster | ||
properties: | ||
topic: my-topic-autogen |
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,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. | ||
# --------------------------------------------------------------------------- | ||
apiVersion: camel.apache.org/v1 | ||
kind: Pipe | ||
metadata: | ||
name: timer-to-kafkatopic | ||
namespace: kafka | ||
spec: | ||
source: | ||
uri: timer:foo | ||
sink: | ||
ref: | ||
kind: KafkaTopic | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
name: my-topic |
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,66 @@ | ||
//go:build integration | ||
// +build integration | ||
|
||
// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" | ||
|
||
/* | ||
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. | ||
*/ | ||
|
||
package kafka | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
. "github.com/onsi/gomega" | ||
corev1 "k8s.io/api/core/v1" | ||
|
||
. "github.com/apache/camel-k/v2/e2e/support" | ||
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" | ||
) | ||
|
||
func TestKafka(t *testing.T) { | ||
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { | ||
// NOTE: all resources are local to kafka namespace | ||
t.Run("Strimzi Kafka resource", func(t *testing.T) { | ||
ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/timer-to-kafka.yaml")) | ||
// Wait for the readiness of the Integration | ||
g.Eventually(IntegrationConditionStatus(t, ctx, "kafka", "timer-to-kafka", v1.IntegrationConditionReady), TestTimeoutMedium). | ||
Should(Equal(corev1.ConditionTrue)) | ||
ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/kafka-to-log.yaml")) | ||
g.Eventually(IntegrationConditionStatus(t, ctx, "kafka", "kafka-to-log", v1.IntegrationConditionReady), TestTimeoutMedium). | ||
Should(Equal(corev1.ConditionTrue)) | ||
// Verify we are consuming some record (the body is null as the timer is pushing nothing) | ||
g.Eventually(IntegrationLogs(t, ctx, "kafka", "kafka-to-log")).Should(ContainSubstring("Body is null")) | ||
}) | ||
|
||
t.Run("Strimzi KafkaTopic resource", func(t *testing.T) { | ||
ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/timer-to-kafkatopic.yaml")) | ||
// Wait for the readiness of the Integration | ||
g.Eventually(IntegrationConditionStatus(t, ctx, "kafka", "timer-to-kafkatopic", v1.IntegrationConditionReady), TestTimeoutMedium). | ||
Should(Equal(corev1.ConditionTrue)) | ||
ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/kafkatopic-to-log.yaml")) | ||
g.Eventually(IntegrationConditionStatus(t, ctx, "kafka", "kafkatopic-to-log", v1.IntegrationConditionReady), TestTimeoutMedium). | ||
Should(Equal(corev1.ConditionTrue)) | ||
// Verify we are consuming some record (the body is null as the timer is pushing nothing) | ||
g.Eventually(IntegrationLogs(t, ctx, "kafka", "kafkatopic-to-log")).Should(ContainSubstring("Body is null")) | ||
}) | ||
|
||
// Clean Kafka namespace, where all reasource are statically set | ||
ExpectExecSucceed(t, g, Kubectl("delete", "namespace", "kafka")) | ||
}) | ||
} |
Oops, something went wrong.