diff --git a/modules/tutorials/examples/ldap-auth/10-install-base.sh b/modules/tutorials/examples/ldap-auth/10-install-base.sh index e9a1b4e38..46c0b144e 100755 --- a/modules/tutorials/examples/ldap-auth/10-install-base.sh +++ b/modules/tutorials/examples/ldap-auth/10-install-base.sh @@ -3,5 +3,5 @@ set -euo pipefail echo "Installing the base stack" # tag::stackablectl-install[] -stackablectl stack install trino-superset-s3 -# end::stackablectl-install[] \ No newline at end of file +stackablectl stack install trino-superset-s3 -n trino-superset-s3 +# end::stackablectl-install[] diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index a69bc4cbd..6c0d6ba94 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -2,10 +2,13 @@ set -euo pipefail shopt -s lastpipe -source "./utils.sh" +# shellcheck disable=1091 +source utils.sh + +sleep 5 echo "Waiting for superset StatefulSet ..." -kubectl rollout status --watch statefulset/superset-node-default +kubectl -n trino-superset-s3 rollout status --watch statefulset/superset-node-default sleep 5 diff --git a/modules/tutorials/examples/ldap-auth/30-install-openldap.sh b/modules/tutorials/examples/ldap-auth/30-install-openldap.sh index c2a5b84c1..648aa8b59 100755 --- a/modules/tutorials/examples/ldap-auth/30-install-openldap.sh +++ b/modules/tutorials/examples/ldap-auth/30-install-openldap.sh @@ -3,13 +3,13 @@ set -euo pipefail echo "Installing tutorial-openldap stack" # tag::install-openldap[] -stackablectl stack install tutorial-openldap +stackablectl stack install tutorial-openldap -n tutorial-openldap # end::install-openldap[] echo "Applying yamls" # tag::apply-bind-credentials-secret[] -kubectl apply -f bind-credentials-secret.yaml +kubectl -n trino-superset-s3 apply -f bind-credentials-secret.yaml # end::apply-bind-credentials-secret[] # tag::apply-bind-credentials-secretclass[] diff --git a/modules/tutorials/examples/ldap-auth/40-modify-superset.sh b/modules/tutorials/examples/ldap-auth/40-modify-superset.sh index aece8a986..28fde81fb 100755 --- a/modules/tutorials/examples/ldap-auth/40-modify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/40-modify-superset.sh @@ -8,16 +8,16 @@ trap 'rm superset.yaml' EXIT echo "Fetching SupersetCluster definition from k8s" # tag::get-superset-yaml[] -kubectl get superset superset -o yaml > superset.yaml +kubectl -n trino-superset-s3 get superset superset -o yaml > superset.yaml # end::get-superset-yaml[] echo "Deleting SupersetCluster" # tag::delete-superset[] -kubectl delete superset superset +kubectl -n trino-superset-s3 delete superset superset # end::delete-superset[] echo "Waiting for deletion to complete ..." -kubectl wait --for=delete statefulset/superset-node-default --timeout=60s +kubectl -n trino-superset-s3 wait --for=delete statefulset/superset-node-default --timeout=60s sleep 2 @@ -26,12 +26,12 @@ yq -i '. *= load("superset-auth-snippet.yaml")' superset.yaml echo "Applying updated configuration" # tag::apply-superset-cluster[] -kubectl apply -f superset.yaml +kubectl -n trino-superset-s3 apply -f superset.yaml # end::apply-superset-cluster[] sleep 1 # it takes time before the statefulset is recreated echo "Waiting for superset StatefulSet ..." -kubectl rollout status --watch statefulset/superset-node-default +kubectl -n trino-superset-s3 rollout status --watch statefulset/superset-node-default sleep 2 # just to be sure we're up and running diff --git a/modules/tutorials/examples/ldap-auth/50-verify.superset.sh b/modules/tutorials/examples/ldap-auth/50-verify.superset.sh index 5e5158932..23da147a5 100755 --- a/modules/tutorials/examples/ldap-auth/50-verify.superset.sh +++ b/modules/tutorials/examples/ldap-auth/50-verify.superset.sh @@ -2,7 +2,8 @@ set -euo pipefail shopt -s lastpipe -source "./utils.sh" +# shellcheck disable=1091 +source utils.sh username="admin" password="admin" diff --git a/modules/tutorials/examples/ldap-auth/60-modify-trino.sh b/modules/tutorials/examples/ldap-auth/60-modify-trino.sh index 230c971e7..318fbb1cc 100755 --- a/modules/tutorials/examples/ldap-auth/60-modify-trino.sh +++ b/modules/tutorials/examples/ldap-auth/60-modify-trino.sh @@ -8,33 +8,33 @@ trap 'rm trino.yaml' EXIT echo "Fetching TrinoCluster definition from k8s" # tag::get-yaml[] -kubectl get trino trino -o yaml > trino.yaml +kubectl -n trino-superset-s3 get trino trino -o yaml > trino.yaml # end::get-yaml[] echo "Deleting TrinoCluster" # tag::delete[] -kubectl delete trino trino +kubectl -n trino-superset-s3 delete trino trino # end::delete[] echo "Waiting for deletion to complete ..." -kubectl wait --for=delete statefulset/trino-coordinator-default --timeout=60s -kubectl wait --for=delete statefulset/trino-worker-default --timeout=60s +kubectl -n trino-superset-s3 wait --for=delete statefulset/trino-coordinator-default --timeout=60s +kubectl -n trino-superset-s3 wait --for=delete statefulset/trino-worker-default --timeout=60s sleep 2 -echo "Updating superset.yaml in-place with authentication LDAP snippet" +echo "Updating trino.yaml in-place with authentication LDAP snippet" yq -i 'del(.spec.authentication.method.multiUser)' trino.yaml yq -i '. *= load("trino-auth-snippet.yaml")' trino.yaml echo "Applying updated configuration" # tag::apply[] -kubectl apply -f trino.yaml +kubectl -n trino-superset-s3 apply -f trino.yaml # end::apply[] sleep 1 # it takes time before the statefulset is recreated echo "Waiting for Trino StatefulSets rollout ..." -kubectl rollout status --watch statefulset/trino-coordinator-default -kubectl rollout status --watch statefulset/trino-worker-default +kubectl -n trino-superset-s3 rollout status --watch statefulset/trino-coordinator-default +kubectl -n trino-superset-s3 rollout status --watch statefulset/trino-worker-default sleep 2 diff --git a/modules/tutorials/examples/ldap-auth/70-modify-trino-opa-bundle.sh b/modules/tutorials/examples/ldap-auth/70-modify-trino-opa-bundle.sh index b533461ec..1cfac1c9c 100755 --- a/modules/tutorials/examples/ldap-auth/70-modify-trino-opa-bundle.sh +++ b/modules/tutorials/examples/ldap-auth/70-modify-trino-opa-bundle.sh @@ -8,7 +8,7 @@ trap 'rm trino-opa-bundle.yaml' EXIT echo "Fetching Trino OPA Bundle definition from k8s" # tag::get-yaml[] -kubectl get cm trino-opa-bundle -o yaml > trino-opa-bundle.yaml +kubectl -n trino-superset-s3 get cm trino-opa-bundle -o yaml > trino-opa-bundle.yaml # end::get-yaml[] sleep 2 @@ -18,7 +18,9 @@ yq -i '. *= load("trino-opa-bundle-snippet.yaml")' trino-opa-bundle.yaml echo "Applying updated configuration" # tag::apply[] -kubectl apply -f trino-opa-bundle.yaml +kubectl -n trino-superset-s3 apply -f trino-opa-bundle.yaml # end::apply[] -sleep 2 \ No newline at end of file +# The OpaCluster needs to reload the OPA bundle. We need to wait for that, otherwise Alice is +# missing the required permissions. +sleep 20 diff --git a/modules/tutorials/examples/ldap-auth/80-verify-trino.sh b/modules/tutorials/examples/ldap-auth/80-verify-trino.sh index 886050989..a36a80144 100755 --- a/modules/tutorials/examples/ldap-auth/80-verify-trino.sh +++ b/modules/tutorials/examples/ldap-auth/80-verify-trino.sh @@ -18,9 +18,9 @@ trino_login() { chmod +x "$trino_binary" fi - trino_addr=$(stackablectl stacklet list -o json | jq --raw-output '.[] | select(.name == "trino") | .endpoints | .["coordinator-https"]') + trino_addr=$(stackablectl stacklet list -n trino-superset-s3 -o json | jq --raw-output '.[] | select(.name == "trino") | .endpoints | .["coordinator-https"]') - output=$(echo "$password" | "$trino_binary" --insecure --output-format=CSV_UNQUOTED --server "$trino_addr" --user "$username" --execute "SHOW CATALOGS" --password) + output=$(TRINO_PASSWORD="$password" "$trino_binary" --insecure --output-format=CSV_UNQUOTED --server "$trino_addr" --user "$username" --execute "SHOW CATALOGS" --password) if [[ "$output" =~ .*system.* ]]; then return 0 diff --git a/modules/tutorials/examples/ldap-auth/bind-credentials-secretclass.yaml b/modules/tutorials/examples/ldap-auth/bind-credentials-secretclass.yaml index e2fbcb608..1fca44e8a 100644 --- a/modules/tutorials/examples/ldap-auth/bind-credentials-secretclass.yaml +++ b/modules/tutorials/examples/ldap-auth/bind-credentials-secretclass.yaml @@ -7,4 +7,4 @@ spec: backend: k8sSearch: searchNamespace: - pod: {} # <2> \ No newline at end of file + pod: {} # <2> diff --git a/modules/tutorials/examples/ldap-auth/ldap-authenticationclass.yaml b/modules/tutorials/examples/ldap-auth/ldap-authenticationclass.yaml index 1b13a854e..20f1ce08e 100644 --- a/modules/tutorials/examples/ldap-auth/ldap-authenticationclass.yaml +++ b/modules/tutorials/examples/ldap-auth/ldap-authenticationclass.yaml @@ -6,7 +6,7 @@ metadata: spec: provider: ldap: - hostname: openldap.default.svc.cluster.local # <2> + hostname: openldap.tutorial-openldap.svc.cluster.local # <2> searchBase: ou=users,dc=example,dc=org bindCredentials: secretClass: openldap-bind-credentials # <3> diff --git a/modules/tutorials/examples/ldap-auth/main.sh b/modules/tutorials/examples/ldap-auth/main.sh index e8e6231fa..c25340b7e 100755 --- a/modules/tutorials/examples/ldap-auth/main.sh +++ b/modules/tutorials/examples/ldap-auth/main.sh @@ -7,4 +7,6 @@ do printf '# %-38s#\n' "$script" printf "##########################################\n" bash "$script" -done \ No newline at end of file +done + +echo "All steps successfully ran, tutorial completed" diff --git a/modules/tutorials/examples/ldap-auth/superset-auth-snippet.yaml b/modules/tutorials/examples/ldap-auth/superset-auth-snippet.yaml index 9c8f31510..6bd3cb92f 100644 --- a/modules/tutorials/examples/ldap-auth/superset-auth-snippet.yaml +++ b/modules/tutorials/examples/ldap-auth/superset-auth-snippet.yaml @@ -5,4 +5,4 @@ spec: authentication: # <1> - authenticationClass: openldap # <2> userRegistrationRole: Admin # <3> -# end::snippet[] \ No newline at end of file +# end::snippet[] diff --git a/modules/tutorials/examples/ldap-auth/utils.sh b/modules/tutorials/examples/ldap-auth/utils.sh index bd203ae9c..df92f030f 100644 --- a/modules/tutorials/examples/ldap-auth/utils.sh +++ b/modules/tutorials/examples/ldap-auth/utils.sh @@ -9,7 +9,7 @@ superset_login() { request_data=$(printf '{"provider": "%s", "username": "%s", "password": "%s", "refresh": false}' "$provider" "$username" "$password") local superset_addr - superset_addr=$(stackablectl stacklet list -o json | jq --raw-output '.[] | select(.name == "superset") | .endpoints | .["node-http"]') + superset_addr=$(stackablectl stacklet list -n trino-superset-s3 -o json | jq --raw-output '.[] | select(.name == "superset") | .endpoints | .["node-http"]') local superset_endpoint="$superset_addr"/api/v1/security/login json_header='Content-Type: application/json' diff --git a/modules/tutorials/pages/authentication_with_openldap.adoc b/modules/tutorials/pages/authentication_with_openldap.adoc index 7804b8c25..c88a9c10c 100644 --- a/modules/tutorials/pages/authentication_with_openldap.adoc +++ b/modules/tutorials/pages/authentication_with_openldap.adoc @@ -42,7 +42,7 @@ to learn more. Before starting to add configuration to your Stackable cluster, inspect what the command above has set up in your Kubernetes cluster. -Use `stackablectl stacklet list` to find the endpoints of Superset and Trino and open their web interfaces in the +Use `stackablectl stacklet list -n trino-superset-s3` to find the endpoints of Superset and Trino and open their web interfaces in the browser. You can log into both Superset and Trino with user `admin` and password `adminadmin`. @@ -118,7 +118,7 @@ Now you can create the AuthenticationClass `openldap` which references the Secre include::example$ldap-auth/ldap-authenticationclass.yaml[] <1> The name of the AuthenticationClass, which needs to be referenced later -<2> The hostname in this case is the Service at which the OpenLDAP is running, inside of Kubernetes. +<2> The hostname in this case is the Service at which the OpenLDAP is running, inside of Kubernetes. You might need to update the namespace accordingly. <3> Here the SecretClass name is referenced <4> A SecretClass used to verify the LDAP server's TLS certificate, see below.