-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #881 from wcmitchell/kafka_multibroker
Support for multiple kafka brokers
- Loading branch information
Showing
8 changed files
with
282 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: test-kafka-managed-multibroker | ||
spec: | ||
finalizers: | ||
- kubernetes |
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,19 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: puptoo | ||
namespace: test-kafka-managed-multibroker | ||
labels: | ||
app: puptoo | ||
ownerReferences: | ||
- apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdApp | ||
name: puptoo | ||
type: Opaque | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: puptoo-processor | ||
namespace: test-kafka-managed-multibroker |
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,70 @@ | ||
--- | ||
apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdEnvironment | ||
metadata: | ||
name: test-kafka-managed-multibroker | ||
spec: | ||
targetNamespace: test-kafka-managed-multibroker | ||
providers: | ||
web: | ||
port: 8000 | ||
mode: operator | ||
metrics: | ||
port: 9000 | ||
mode: operator | ||
path: "/metrics" | ||
kafka: | ||
mode: managed | ||
managedSecretRef: | ||
name: managed-secret | ||
namespace: test-kafka-managed-multibroker | ||
managedPrefix: "" | ||
db: | ||
mode: none | ||
logging: | ||
mode: none | ||
objectStore: | ||
mode: none | ||
inMemoryDb: | ||
mode: none | ||
featureFlags: | ||
mode: none | ||
resourceDefaults: | ||
limits: | ||
cpu: 400m | ||
memory: 1024Mi | ||
requests: | ||
cpu: 30m | ||
memory: 512Mi | ||
--- | ||
apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdApp | ||
metadata: | ||
name: puptoo | ||
namespace: test-kafka-managed-multibroker | ||
spec: | ||
envName: test-kafka-managed-multibroker | ||
deployments: | ||
- name: processor | ||
podSpec: | ||
image: quay.io/psav/clowder-hello | ||
kafkaTopics: | ||
- replicas: 3 | ||
partitions: 64 | ||
topicName: topicOne | ||
- replicas: 5 | ||
partitions: 32 | ||
topicName: topicTwo | ||
--- | ||
apiVersion: v1 | ||
data: | ||
hostnames: a2Fma2EtaG9zdC1uYW1lLTAsa2Fma2EtaG9zdC1uYW1lLTEsa2Fma2EtaG9zdC1uYW1lLTI= # kafka-host-name-0,kafka-host-name-1,kafka-host-name-2 | ||
port: MjcwMTU= # 27015 | ||
username: a2Fma2EtdXNlcm5hbWU= # kafka-username | ||
password: a2Fma2EtcGFzc3dvcmQ= # kafka-password | ||
cacert: c29tZS1wZW0= | ||
kind: Secret | ||
metadata: | ||
name: managed-secret | ||
namespace: test-kafka-managed-multibroker | ||
type: Opaque |
21 changes: 21 additions & 0 deletions
21
tests/kuttl/test-kafka-managed-multibroker/02-json-asserts.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,21 @@ | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: sleep 10 | ||
- script: kubectl get secret --namespace=test-kafka-managed-multibroker puptoo -o json > /tmp/test-kafka-managed-multibroker | ||
- script: jq -r '.data["cdappconfig.json"]' < /tmp/test-kafka-managed-multibroker | base64 -d > /tmp/test-kafka-managed-multibroker-json | ||
|
||
- script: jq -r '.kafka.topics[] | select(.requestedName == "topicOne") | .name == "topicOne"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.topics[] | select(.requestedName == "topicTwo") | .name == "topicTwo"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers | length == 3' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].hostname == "kafka-host-name-0"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[1].hostname == "kafka-host-name-1"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[2].hostname == "kafka-host-name-2"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].cacert == "some-pem"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].port == 27015' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].sasl.username == "kafka-username"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].sasl.password == "kafka-password"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].sasl.securityProtocol == "SASL_SSL"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].sasl.saslMechanism == "PLAIN"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].securityProtocol == "SASL_SSL"' -e < /tmp/test-kafka-managed-multibroker-json |
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,38 @@ | ||
--- | ||
apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdEnvironment | ||
metadata: | ||
name: test-kafka-managed-multibroker | ||
spec: | ||
targetNamespace: test-kafka-managed-multibroker | ||
providers: | ||
web: | ||
port: 8000 | ||
mode: operator | ||
metrics: | ||
port: 9000 | ||
mode: operator | ||
path: "/metrics" | ||
kafka: | ||
mode: managed | ||
managedPrefix: test-kafka- | ||
managedSecretRef: | ||
name: managed-secret | ||
namespace: test-kafka-managed-multibroker | ||
db: | ||
mode: none | ||
logging: | ||
mode: none | ||
objectStore: | ||
mode: none | ||
inMemoryDb: | ||
mode: none | ||
featureFlags: | ||
mode: none | ||
resourceDefaults: | ||
limits: | ||
cpu: 400m | ||
memory: 1024Mi | ||
requests: | ||
cpu: 30m | ||
memory: 512Mi |
19 changes: 19 additions & 0 deletions
19
tests/kuttl/test-kafka-managed-multibroker/04-json-asserts.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,19 @@ | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: sleep 10 | ||
- script: kubectl get secret --namespace=test-kafka-managed-multibroker puptoo -o json > /tmp/test-kafka-managed-multibroker | ||
- script: jq -r '.data["cdappconfig.json"]' < /tmp/test-kafka-managed-multibroker | base64 -d > /tmp/test-kafka-managed-multibroker-json | ||
|
||
- script: jq -r '.kafka.topics[] | select(.requestedName == "topicOne") | .name == "test-kafka-topicOne"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.topics[] | select(.requestedName == "topicTwo") | .name == "test-kafka-topicTwo"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers | length == 3' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].hostname == "kafka-host-name-0"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[1].hostname == "kafka-host-name-1"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[2].hostname == "kafka-host-name-2"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].port == 27015' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].sasl.username == "kafka-username"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].sasl.password == "kafka-password"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].sasl.securityProtocol == "SASL_SSL"' -e < /tmp/test-kafka-managed-multibroker-json | ||
- script: jq -r '.kafka.brokers[0].sasl.saslMechanism == "PLAIN"' -e < /tmp/test-kafka-managed-multibroker-json |
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,10 @@ | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
delete: | ||
- apiVersion: v1 | ||
kind: Namespace | ||
name: test-kafka-managed-multibroker | ||
- apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdEnvironment | ||
name: test-kafka-managed-multibroker |