Skip to content

Commit 1d99b7e

Browse files
committed
Getting started guide (#452)
# Description fixes #447 Co-authored-by: Malte Sander <[email protected]>
1 parent 3cea550 commit 1d99b7e

17 files changed

+478
-109
lines changed

docs/antora.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ name: kafka
22
version: "nightly"
33
title: Stackable Operator for Apache Kafka
44
nav:
5+
- modules/getting_started/nav.adoc
56
- modules/ROOT/nav.adoc
67
prerelease: true

docs/modules/ROOT/nav.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
* xref:dependencies.adoc[]
2-
* xref:installation.adoc[]
32
* xref:configuration.adoc[]
43
* xref:usage.adoc[]
54
* Concepts

docs/modules/ROOT/pages/installation.adoc

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# The getting started guide script
5+
# It uses tagged regions which are included in the documentation
6+
# https://docs.asciidoctor.org/asciidoc/latest/directives/include-tagged-regions/
7+
#
8+
# There are two variants to go through the guide - using stackablectl or helm
9+
# The script takes either 'stackablectl' or 'helm' as an argument
10+
#
11+
# The script can be run as a test as well, to make sure that the tutorial works
12+
# It includes some assertions throughout, and at the end especially.
13+
14+
if [ $# -eq 0 ]
15+
then
16+
echo "Installation method argument ('helm' or 'stackablectl') required."
17+
exit 1
18+
fi
19+
20+
case "$1" in
21+
"helm")
22+
echo "Adding 'stackable-dev' Helm Chart repository"
23+
# tag::helm-add-repo[]
24+
helm repo add stackable-dev https://repo.stackable.tech/repository/helm-dev/
25+
# end::helm-add-repo[]
26+
echo "Installing Operators with Helm"
27+
# tag::helm-install-operators[]
28+
helm install --wait commons-operator stackable-dev/commons-operator --version 0.3.0-nightly
29+
helm install --wait secret-operator stackable-dev/secret-operator --version 0.6.0-nightly
30+
helm install --wait zookeeper-operator stackable-dev/zookeeper-operator --version 0.11.0-nightly
31+
helm install --wait kafka-operator stackable-dev/kafka-operator --version 0.7.0-nightly
32+
# end::helm-install-operators[]
33+
;;
34+
"stackablectl")
35+
echo "installing Operators with stackablectl"
36+
# tag::stackablectl-install-operators[]
37+
stackablectl operator install \
38+
commons=0.3.0-nightly \
39+
secret=0.6.0-nightly \
40+
zookeeper=0.11.0-nightly \
41+
kafka=0.7.0-nightly
42+
# end::stackablectl-install-operators[]
43+
;;
44+
*)
45+
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"
46+
exit 1
47+
;;
48+
esac
49+
50+
echo "Installing ZooKeeper from zookeeper.yaml"
51+
# tag::install-zookeeper[]
52+
kubectl apply -f zookeeper.yaml
53+
# end::install-zookeeper[]
54+
55+
echo "Installing ZNode from kafka-znode.yaml"
56+
# tag::install-znode[]
57+
kubectl apply -f kafka-znode.yaml
58+
# end::install-znode[]
59+
60+
sleep 5
61+
62+
echo "Awaiting ZooKeeper rollout finish"
63+
# tag::watch-zookeeper-rollout[]
64+
kubectl rollout status --watch statefulset/simple-zk-server-default
65+
# end::watch-zookeeper-rollout[]
66+
67+
echo "Install KafkaCluster from kafka.yaml"
68+
# tag::install-kafka[]
69+
kubectl apply -f kafka.yaml
70+
# end::install-kafka[]
71+
72+
sleep 5
73+
74+
echo "Awaiting Kafka rollout finish"
75+
# tag::watch-kafka-rollout[]
76+
kubectl rollout status --watch statefulset/simple-kafka-broker-default
77+
# end::watch-kafka-rollout[]
78+
79+
echo "Starting port-forwarding of port 9092"
80+
# tag::port-forwarding[]
81+
kubectl port-forward svc/simple-kafka 9092 2>&1 >/dev/null &
82+
# end::port-forwarding[]
83+
PORT_FORWARD_PID=$!
84+
trap "kill $PORT_FORWARD_PID" EXIT
85+
86+
sleep 5
87+
88+
echo "Creating test data"
89+
# tag::kcat-create-data[]
90+
echo "some test data" > data
91+
# end::kcat-create-data[]
92+
93+
echo "Writing test data"
94+
# tag::kcat-write-data[]
95+
kafkacat -b localhost:9092 -t test-data-topic -P data
96+
# end::kcat-write-data[]
97+
98+
echo "Reading test data"
99+
# tag::kcat-read-data[]
100+
kafkacat -b localhost:9092 -t test-data-topic -C -e > read-data
101+
# end::kcat-read-data[]
102+
103+
echo "Check contents"
104+
# tag::kcat-check-data[]
105+
cat read-data | grep "some test data"
106+
# end::kcat-check-data[]
107+
108+
echo "Cleanup"
109+
# tag::kcat-cleanup-data[]
110+
rm data
111+
rm read-data
112+
# end::kcat-cleanup-data[]
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# The getting started guide script
5+
# It uses tagged regions which are included in the documentation
6+
# https://docs.asciidoctor.org/asciidoc/latest/directives/include-tagged-regions/
7+
#
8+
# There are two variants to go through the guide - using stackablectl or helm
9+
# The script takes either 'stackablectl' or 'helm' as an argument
10+
#
11+
# The script can be run as a test as well, to make sure that the tutorial works
12+
# It includes some assertions throughout, and at the end especially.
13+
14+
if [ $# -eq 0 ]
15+
then
16+
echo "Installation method argument ('helm' or 'stackablectl') required."
17+
exit 1
18+
fi
19+
20+
case "$1" in
21+
"helm")
22+
echo "Adding '{{ helm.repo_name }}' Helm Chart repository"
23+
# tag::helm-add-repo[]
24+
helm repo add {{ helm.repo_name }} {{ helm.repo_url }}
25+
# end::helm-add-repo[]
26+
echo "Installing Operators with Helm"
27+
# tag::helm-install-operators[]
28+
helm install --wait commons-operator {{ helm.repo_name }}/commons-operator --version {{ versions.commons }}
29+
helm install --wait secret-operator {{ helm.repo_name }}/secret-operator --version {{ versions.secret }}
30+
helm install --wait zookeeper-operator {{ helm.repo_name }}/zookeeper-operator --version {{ versions.zookeeper }}
31+
helm install --wait kafka-operator {{ helm.repo_name }}/kafka-operator --version {{ versions.kafka }}
32+
# end::helm-install-operators[]
33+
;;
34+
"stackablectl")
35+
echo "installing Operators with stackablectl"
36+
# tag::stackablectl-install-operators[]
37+
stackablectl operator install \
38+
commons={{ versions.commons }} \
39+
secret={{ versions.secret }} \
40+
zookeeper={{ versions.zookeeper }} \
41+
kafka={{ versions.kafka }}
42+
# end::stackablectl-install-operators[]
43+
;;
44+
*)
45+
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"
46+
exit 1
47+
;;
48+
esac
49+
50+
echo "Installing ZooKeeper from zookeeper.yaml"
51+
# tag::install-zookeeper[]
52+
kubectl apply -f zookeeper.yaml
53+
# end::install-zookeeper[]
54+
55+
echo "Installing ZNode from kafka-znode.yaml"
56+
# tag::install-znode[]
57+
kubectl apply -f kafka-znode.yaml
58+
# end::install-znode[]
59+
60+
sleep 5
61+
62+
echo "Awaiting ZooKeeper rollout finish"
63+
# tag::watch-zookeeper-rollout[]
64+
kubectl rollout status --watch statefulset/simple-zk-server-default
65+
# end::watch-zookeeper-rollout[]
66+
67+
echo "Install KafkaCluster from kafka.yaml"
68+
# tag::install-kafka[]
69+
kubectl apply -f kafka.yaml
70+
# end::install-kafka[]
71+
72+
sleep 5
73+
74+
echo "Awaiting Kafka rollout finish"
75+
# tag::watch-kafka-rollout[]
76+
kubectl rollout status --watch statefulset/simple-kafka-broker-default
77+
# end::watch-kafka-rollout[]
78+
79+
echo "Starting port-forwarding of port 9092"
80+
# tag::port-forwarding[]
81+
kubectl port-forward svc/simple-kafka 9092 2>&1 >/dev/null &
82+
# end::port-forwarding[]
83+
PORT_FORWARD_PID=$!
84+
trap "kill $PORT_FORWARD_PID" EXIT
85+
86+
sleep 5
87+
88+
echo "Creating test data"
89+
# tag::kcat-create-data[]
90+
echo "some test data" > data
91+
# end::kcat-create-data[]
92+
93+
echo "Writing test data"
94+
# tag::kcat-write-data[]
95+
kafkacat -b localhost:9092 -t test-data-topic -P data
96+
# end::kcat-write-data[]
97+
98+
echo "Reading test data"
99+
# tag::kcat-read-data[]
100+
kafkacat -b localhost:9092 -t test-data-topic -C -e > read-data
101+
# end::kcat-read-data[]
102+
103+
echo "Check contents"
104+
# tag::kcat-check-data[]
105+
cat read-data | grep "some test data"
106+
# end::kcat-check-data[]
107+
108+
echo "Cleanup"
109+
# tag::kcat-cleanup-data[]
110+
rm data
111+
rm read-data
112+
# end::kcat-cleanup-data[]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# tag::stackablectl-install-operators-output[]
2+
[INFO ] Installing commons operator in version 0.3.0-nightly
3+
[INFO ] Installing secret operator in version 0.6.0-nightly
4+
[INFO ] Installing zookeeper operator in version 0.11.0-nightly
5+
[INFO ] Installing kafka operator in version 0.7.0-nightly
6+
# end::stackablectl-install-operators-output[]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# tag::stackablectl-install-operators-output[]
2+
[INFO ] Installing commons operator in version {{ versions.commons }}
3+
[INFO ] Installing secret operator in version {{ versions.secret }}
4+
[INFO ] Installing zookeeper operator in version {{ versions.zookeeper }}
5+
[INFO ] Installing kafka operator in version {{ versions.kafka }}
6+
# end::stackablectl-install-operators-output[]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
apiVersion: zookeeper.stackable.tech/v1alpha1
3+
kind: ZookeeperZnode
4+
metadata:
5+
name: simple-kafka-znode
6+
spec:
7+
clusterRef:
8+
name: simple-zk
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kafka.stackable.tech/v1alpha1
3+
kind: KafkaCluster
4+
metadata:
5+
name: simple-kafka
6+
spec:
7+
version: 3.2.0-stackable0.1.0
8+
zookeeperConfigMapName: simple-kafka-znode
9+
config:
10+
tls: null
11+
brokers:
12+
roleGroups:
13+
default:
14+
replicas: 3
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: zookeeper.stackable.tech/v1alpha1
3+
kind: ZookeeperCluster
4+
metadata:
5+
name: simple-zk
6+
spec:
7+
version: 3.8.0-stackable0.7.1
8+
servers:
9+
roleGroups:
10+
default:
11+
replicas: 3

docs/modules/getting_started/nav.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* xref:index.adoc[]
2+
** xref:installation.adoc[]
3+
** xref:first_steps.adoc[]

0 commit comments

Comments
 (0)