Skip to content

Commit 41068d9

Browse files
NickLarsenNZrazvan
andauthored
fix(docs): Update getting-started script pre-26.3.0 (#667)
* docs(getting_started): Sleep until CRD is installed * wait for job to finish and remove doc references to the driver pod --------- Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com>
1 parent e561046 commit 41068d9

File tree

4 files changed

+50
-25
lines changed

4 files changed

+50
-25
lines changed

docs/modules/spark-k8s/examples/getting_started/getting_started.sh

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ exit 1
4545
;;
4646
esac
4747

48+
# TODO: Remove once https://github.com/stackabletech/issues/issues/828 has been
49+
# implemented (see that issue for details).
50+
until kubectl get crd sparkapplications.spark.stackable.tech >/dev/null 2>&1; do
51+
echo "Waiting for CRDs to be installed"
52+
sleep 1
53+
done
54+
until kubectl get crd sparkhistoryservers.spark.stackable.tech >/dev/null 2>&1; do
55+
echo "Waiting for CRDs to be installed"
56+
sleep 1
57+
done
58+
until kubectl get crd sparkconnectservers.spark.stackable.tech >/dev/null 2>&1; do
59+
echo "Waiting for CRDs to be installed"
60+
sleep 1
61+
done
62+
until kubectl get crd sparkapptemplates.spark.stackable.tech >/dev/null 2>&1; do
63+
echo "Waiting for CRDs to be installed"
64+
sleep 1
65+
done
66+
4867
echo "Creating a Spark Application..."
4968
# tag::install-sparkapp[]
5069
kubectl apply -f application.yaml
@@ -54,16 +73,12 @@ sleep 15
5473

5574
echo "Waiting for job to complete ..."
5675
# tag::wait-for-job[]
57-
kubectl wait pods -l 'job-name=pyspark-pi' \
76+
if kubectl wait pods -l 'job-name=pyspark-pi' \
5877
--for jsonpath='{.status.phase}'=Succeeded \
59-
--timeout 300s
60-
# end::wait-for-job[]
61-
62-
result=$(kubectl logs -l 'spark-role=driver' --tail=-1 | grep "Pi is roughly")
63-
64-
if [ "$result" == "" ]; then
65-
echo "Log result was not found!"
66-
exit 1
78+
--timeout 300s; then
79+
echo "job succeeded"
6780
else
68-
echo "Job result:" "$result"
81+
echo "job failed"
82+
exit 1
6983
fi
84+
# end::wait-for-job[]

docs/modules/spark-k8s/examples/getting_started/getting_started.sh.j2

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ exit 1
4545
;;
4646
esac
4747

48+
# TODO: Remove once https://github.com/stackabletech/issues/issues/828 has been
49+
# implemented (see that issue for details).
50+
until kubectl get crd sparkapplications.spark.stackable.tech >/dev/null 2>&1; do
51+
echo "Waiting for CRDs to be installed"
52+
sleep 1
53+
done
54+
until kubectl get crd sparkhistoryservers.spark.stackable.tech >/dev/null 2>&1; do
55+
echo "Waiting for CRDs to be installed"
56+
sleep 1
57+
done
58+
until kubectl get crd sparkconnectservers.spark.stackable.tech >/dev/null 2>&1; do
59+
echo "Waiting for CRDs to be installed"
60+
sleep 1
61+
done
62+
until kubectl get crd sparkapptemplates.spark.stackable.tech >/dev/null 2>&1; do
63+
echo "Waiting for CRDs to be installed"
64+
sleep 1
65+
done
66+
4867
echo "Creating a Spark Application..."
4968
# tag::install-sparkapp[]
5069
kubectl apply -f application.yaml
@@ -54,16 +73,12 @@ sleep 15
5473

5574
echo "Waiting for job to complete ..."
5675
# tag::wait-for-job[]
57-
kubectl wait pods -l 'job-name=pyspark-pi' \
76+
if kubectl wait pods -l 'job-name=pyspark-pi' \
5877
--for jsonpath='{.status.phase}'=Succeeded \
59-
--timeout 300s
60-
# end::wait-for-job[]
61-
62-
result=$(kubectl logs -l 'spark-role=driver' --tail=-1 | grep "Pi is roughly")
63-
64-
if [ "$result" == "" ]; then
65-
echo "Log result was not found!"
66-
exit 1
78+
--timeout 300s; then
79+
echo "job succeeded"
6780
else
68-
echo "Job result:" "$result"
81+
echo "job failed"
82+
exit 1
6983
fi
84+
# end::wait-for-job[]
-709 KB
Binary file not shown.

docs/modules/spark-k8s/pages/getting_started/first_steps.adoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,3 @@ The initial job is persisted for several minutes before being removed.
5656
The completed state looks like this:
5757

5858
image::getting_started/spark_complete.png[Completed job]
59-
60-
The driver logs can be inspected for more information about the results of the job.
61-
In this case the result of our (approximate!) pi calculation can be found:
62-
63-
image::getting_started/spark_log.png[Driver log]

0 commit comments

Comments
 (0)