Skip to content

Commit 3c14d1e

Browse files
fix(docs): Update getting-started script pre-25.7.0 (#820)
* docs: Mark NiFi 2.4.0 as supported * docs(getting_started): Bump NiFi to 2.4.0 * fix(getting_started): Use "node-https" endpoint * docs(getting_started): Update guide to use the Listener address * Get rid of Zookeeper, simply url gathering, better waiting * Intendation * intendation 2 * chore(gett_started): Remove indentaion After adding indentation, I realised that this could affect the presentation of the script snippets in the rendered docs --------- Co-authored-by: Sebastian Bernauer <[email protected]>
1 parent ac3c244 commit 3c14d1e

File tree

5 files changed

+37
-298
lines changed

5 files changed

+37
-298
lines changed

docs/modules/nifi/examples/getting_started/getting_started.sh

Lines changed: 11 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# DO NOT EDIT THE SCRIPT
4+
# DO NOT EDIT THE RENDERED SCRIPT
55
# Instead, update the j2 template, and regenerate it for dev with `make render-docs`.
66

77
# The getting started guide script
@@ -29,7 +29,6 @@ echo "Installing Operators with Helm"
2929
helm install --wait commons-operator oci://oci.stackable.tech/sdp-charts/commons-operator --version 0.0.0-dev
3030
helm install --wait secret-operator oci://oci.stackable.tech/sdp-charts/secret-operator --version 0.0.0-dev
3131
helm install --wait listener-operator oci://oci.stackable.tech/sdp-charts/listener-operator --version 0.0.0-dev
32-
helm install --wait zookeeper-operator oci://oci.stackable.tech/sdp-charts/zookeeper-operator --version 0.0.0-dev
3332
helm install --wait nifi-operator oci://oci.stackable.tech/sdp-charts/nifi-operator --version 0.0.0-dev
3433
# end::helm-install-operators[]
3534
;;
@@ -40,7 +39,6 @@ stackablectl operator install \
4039
commons=0.0.0-dev \
4140
secret=0.0.0-dev \
4241
listener=0.0.0-dev \
43-
zookeeper=0.0.0-dev \
4442
nifi=0.0.0-dev
4543
# end::stackablectl-install-operators[]
4644
;;
@@ -50,62 +48,6 @@ exit 1
5048
;;
5149
esac
5250

53-
internal=true
54-
if [ $# -eq 2 ]
55-
then
56-
case "$2" in
57-
"InternalIP")
58-
internal=true
59-
;;
60-
"ExternalIP")
61-
internal=false
62-
;;
63-
*)
64-
echo "Need to provide 'InternalIP' or 'ExternalIP' as the connection type argument."
65-
exit 1
66-
;;
67-
esac
68-
fi
69-
70-
echo "Installing ZooKeeper"
71-
# tag::install-zookeeper[]
72-
kubectl apply -f - <<EOF
73-
---
74-
apiVersion: zookeeper.stackable.tech/v1alpha1
75-
kind: ZookeeperCluster
76-
metadata:
77-
name: simple-zk
78-
spec:
79-
image:
80-
productVersion: 3.9.3
81-
servers:
82-
roleGroups:
83-
default:
84-
replicas: 1
85-
EOF
86-
# end::install-zookeeper[]
87-
88-
echo "Create a ZNode"
89-
# tag::install-znode[]
90-
kubectl apply -f - <<EOF
91-
---
92-
apiVersion: zookeeper.stackable.tech/v1alpha1
93-
kind: ZookeeperZnode
94-
metadata:
95-
name: simple-nifi-znode
96-
spec:
97-
clusterRef:
98-
name: simple-zk
99-
EOF
100-
# end::install-znode[]
101-
102-
sleep 15
103-
104-
echo "Awaiting ZooKeeper rollout finish"
105-
# tag::watch-zookeeper-rollout[]
106-
kubectl rollout status --watch --timeout=5m statefulset/simple-zk-server-default
107-
# end::watch-zookeeper-rollout[]
108-
10951
echo "Create NiFi admin credentials"
11052
# tag::install-nifi-credentials[]
11153
kubectl apply -f - <<EOF
@@ -139,79 +81,42 @@ metadata:
13981
name: simple-nifi
14082
spec:
14183
image:
142-
productVersion: 1.28.1
84+
productVersion: 2.4.0
14385
clusterConfig:
14486
authentication:
14587
- authenticationClass: simple-nifi-users
14688
sensitiveProperties:
14789
keySecret: nifi-sensitive-property-key
14890
autoGenerate: true
149-
zookeeperConfigMapName: simple-nifi-znode
15091
nodes:
15192
roleConfig:
15293
listenerClass: external-unstable
15394
roleGroups:
15495
default:
15596
replicas: 1
156-
15797
EOF
15898
# end::install-nifi[]
15999

160-
sleep 5
161-
162100
echo "Awaiting NiFi rollout finish"
163101
# tag::wait-nifi-rollout[]
164-
kubectl wait -l statefulset.kubernetes.io/pod-name=simple-nifi-node-default-0 \
165-
--for=condition=ready pod --timeout=1200s
102+
kubectl wait --for=condition=available --timeout=20m nificluster/simple-nifi
166103
# end::wait-nifi-rollout[]
167104

168-
sleep 5
169-
170105
case "$1" in
171106
"helm")
107+
echo "Getting the NiFi URL with kubectl"
172108

173-
echo "Get a single node where a NiFi pod is running"
174-
# tag::get-nifi-node-name[]
175-
nifi_node_name=$(kubectl get endpoints simple-nifi --output=jsonpath='{.subsets[0].addresses[0].nodeName}') && \
176-
echo "NodeName: $nifi_node_name"
177-
# end::get-nifi-node-name[]
178-
179-
180-
if [ "$internal" = true ] ; then
181-
echo "List $nifi_node_name node internal ip"
182-
# tag::get-nifi-node-ip-internal[]
183-
nifi_node_ip=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name==\"$nifi_node_name\")].status.addresses[?(@.type==\"InternalIP\")].address}") && \
184-
echo "NodeIp: $nifi_node_ip"
185-
# end::get-nifi-node-ip-internal[]
186-
else
187-
echo "List $nifi_node_name node external ip"
188-
# tag::get-nifi-node-ip-external[]
189-
nifi_node_ip=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name==\"$nifi_node_name\")].status.addresses[?(@.type==\"ExternalIP\")].address}") && \
190-
echo "NodeIp: $nifi_node_ip"
191-
# end::get-nifi-node-ip-external[]
192-
fi
193-
194-
echo "Get node port from service"
195-
# tag::get-nifi-service-port[]
196-
nifi_service_port=$(kubectl get service -o jsonpath="{.items[?(@.metadata.name==\"simple-nifi\")].spec.ports[?(@.name==\"https\")].nodePort}") && \
197-
echo "NodePort: $nifi_service_port"
198-
# end::get-nifi-service-port[]
199-
200-
echo "Create NiFi url"
201-
# tag::create-nifi-url[]
202-
nifi_url="https://$nifi_node_ip:$nifi_service_port" && \
203-
echo "NiFi web interface: $nifi_url"
204-
# end::create-nifi-url[]
205-
109+
# tag::get-nifi-url[]
110+
nifi_url=$(kubectl get listener simple-nifi-node -o 'jsonpath=https://{.status.ingressAddresses[0].address}:{.status.ingressAddresses[0].ports.https}') && \
111+
echo "NiFi URL: $nifi_url"
112+
# end::get-nifi-url[]
206113
;;
207114
"stackablectl")
208-
209-
echo "Getting NiFi endpoint with stackablectl ..."
115+
echo "Getting NiFi URL with stackablectl ..."
210116
# tag::stackablectl-nifi-url[]
211-
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints.https')
117+
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints["node-https"]')
212118
# end::stackablectl-nifi-url[]
213-
echo "Endpoint: $nifi_url"
214-
119+
echo "NiFi URL: $nifi_url"
215120
;;
216121
*)
217122
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"

docs/modules/nifi/examples/getting_started/getting_started.sh.j2

Lines changed: 11 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# DO NOT EDIT THE SCRIPT
4+
# DO NOT EDIT THE RENDERED SCRIPT
55
# Instead, update the j2 template, and regenerate it for dev with `make render-docs`.
66

77
# The getting started guide script
@@ -29,7 +29,6 @@ echo "Installing Operators with Helm"
2929
helm install --wait commons-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/commons-operator --version {{ versions.commons }}
3030
helm install --wait secret-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/secret-operator --version {{ versions.secret }}
3131
helm install --wait listener-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/listener-operator --version {{ versions.listener }}
32-
helm install --wait zookeeper-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/zookeeper-operator --version {{ versions.zookeeper }}
3332
helm install --wait nifi-operator oci://{{ helm.repo_url }}/{{ helm.repo_name }}/nifi-operator --version {{ versions.nifi }}
3433
# end::helm-install-operators[]
3534
;;
@@ -40,7 +39,6 @@ stackablectl operator install \
4039
commons={{ versions.commons }} \
4140
secret={{ versions.secret }} \
4241
listener={{ versions.listener }} \
43-
zookeeper={{ versions.zookeeper }} \
4442
nifi={{ versions.nifi }}
4543
# end::stackablectl-install-operators[]
4644
;;
@@ -50,62 +48,6 @@ exit 1
5048
;;
5149
esac
5250

53-
internal=true
54-
if [ $# -eq 2 ]
55-
then
56-
case "$2" in
57-
"InternalIP")
58-
internal=true
59-
;;
60-
"ExternalIP")
61-
internal=false
62-
;;
63-
*)
64-
echo "Need to provide 'InternalIP' or 'ExternalIP' as the connection type argument."
65-
exit 1
66-
;;
67-
esac
68-
fi
69-
70-
echo "Installing ZooKeeper"
71-
# tag::install-zookeeper[]
72-
kubectl apply -f - <<EOF
73-
---
74-
apiVersion: zookeeper.stackable.tech/v1alpha1
75-
kind: ZookeeperCluster
76-
metadata:
77-
name: simple-zk
78-
spec:
79-
image:
80-
productVersion: 3.9.3
81-
servers:
82-
roleGroups:
83-
default:
84-
replicas: 1
85-
EOF
86-
# end::install-zookeeper[]
87-
88-
echo "Create a ZNode"
89-
# tag::install-znode[]
90-
kubectl apply -f - <<EOF
91-
---
92-
apiVersion: zookeeper.stackable.tech/v1alpha1
93-
kind: ZookeeperZnode
94-
metadata:
95-
name: simple-nifi-znode
96-
spec:
97-
clusterRef:
98-
name: simple-zk
99-
EOF
100-
# end::install-znode[]
101-
102-
sleep 15
103-
104-
echo "Awaiting ZooKeeper rollout finish"
105-
# tag::watch-zookeeper-rollout[]
106-
kubectl rollout status --watch --timeout=5m statefulset/simple-zk-server-default
107-
# end::watch-zookeeper-rollout[]
108-
10951
echo "Create NiFi admin credentials"
11052
# tag::install-nifi-credentials[]
11153
kubectl apply -f - <<EOF
@@ -139,14 +81,13 @@ metadata:
13981
name: simple-nifi
14082
spec:
14183
image:
142-
productVersion: 1.28.1
84+
productVersion: 2.4.0
14385
clusterConfig:
14486
authentication:
14587
- authenticationClass: simple-nifi-users
14688
sensitiveProperties:
14789
keySecret: nifi-sensitive-property-key
14890
autoGenerate: true
149-
zookeeperConfigMapName: simple-nifi-znode
15091
nodes:
15192
roleConfig:
15293
listenerClass: external-unstable
@@ -156,61 +97,26 @@ spec:
15697
EOF
15798
# end::install-nifi[]
15899

159-
sleep 5
160-
161100
echo "Awaiting NiFi rollout finish"
162101
# tag::wait-nifi-rollout[]
163-
kubectl wait -l statefulset.kubernetes.io/pod-name=simple-nifi-node-default-0 \
164-
--for=condition=ready pod --timeout=1200s
102+
kubectl wait --for=condition=available --timeout=20m nificluster/simple-nifi
165103
# end::wait-nifi-rollout[]
166104

167-
sleep 5
168-
169105
case "$1" in
170106
"helm")
107+
echo "Getting the NiFi URL with kubectl"
171108

172-
echo "Get a single node where a NiFi pod is running"
173-
# tag::get-nifi-node-name[]
174-
nifi_node_name=$(kubectl get endpoints simple-nifi --output=jsonpath='{.subsets[0].addresses[0].nodeName}') && \
175-
echo "NodeName: $nifi_node_name"
176-
# end::get-nifi-node-name[]
177-
178-
179-
if [ "$internal" = true ] ; then
180-
echo "List $nifi_node_name node internal ip"
181-
# tag::get-nifi-node-ip-internal[]
182-
nifi_node_ip=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name==\"$nifi_node_name\")].status.addresses[?(@.type==\"InternalIP\")].address}") && \
183-
echo "NodeIp: $nifi_node_ip"
184-
# end::get-nifi-node-ip-internal[]
185-
else
186-
echo "List $nifi_node_name node external ip"
187-
# tag::get-nifi-node-ip-external[]
188-
nifi_node_ip=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name==\"$nifi_node_name\")].status.addresses[?(@.type==\"ExternalIP\")].address}") && \
189-
echo "NodeIp: $nifi_node_ip"
190-
# end::get-nifi-node-ip-external[]
191-
fi
192-
193-
echo "Get node port from service"
194-
# tag::get-nifi-service-port[]
195-
nifi_service_port=$(kubectl get service -o jsonpath="{.items[?(@.metadata.name==\"simple-nifi\")].spec.ports[?(@.name==\"https\")].nodePort}") && \
196-
echo "NodePort: $nifi_service_port"
197-
# end::get-nifi-service-port[]
198-
199-
echo "Create NiFi url"
200-
# tag::create-nifi-url[]
201-
nifi_url="https://$nifi_node_ip:$nifi_service_port" && \
202-
echo "NiFi web interface: $nifi_url"
203-
# end::create-nifi-url[]
204-
109+
# tag::get-nifi-url[]
110+
nifi_url=$(kubectl get listener simple-nifi-node -o 'jsonpath=https://{.status.ingressAddresses[0].address}:{.status.ingressAddresses[0].ports.https}') && \
111+
echo "NiFi URL: $nifi_url"
112+
# end::get-nifi-url[]
205113
;;
206114
"stackablectl")
207-
208-
echo "Getting NiFi endpoint with stackablectl ..."
115+
echo "Getting NiFi URL with stackablectl ..."
209116
# tag::stackablectl-nifi-url[]
210-
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints.https')
117+
nifi_url=$(stackablectl stacklet ls -o json | jq --raw-output '.[] | select(.name == "simple-nifi") | .endpoints["node-https"]')
211118
# end::stackablectl-nifi-url[]
212-
echo "Endpoint: $nifi_url"
213-
119+
echo "NiFi URL: $nifi_url"
214120
;;
215121
*)
216122
echo "Need to provide 'helm' or 'stackablectl' as an argument for which installation method to use!"

0 commit comments

Comments
 (0)