Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/tutorials/examples/ldap-auth/10-install-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -euo pipefail

echo "Installing the base stack"
# tag::stackablectl-install[]
stackablectl stack install trino-superset-s3
# end::stackablectl-install[]
stackablectl stack install trino-superset-s3 -n trino-superset-s3
# end::stackablectl-install[]
7 changes: 5 additions & 2 deletions modules/tutorials/examples/ldap-auth/20-verify-superset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions modules/tutorials/examples/ldap-auth/30-install-openldap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down
10 changes: 5 additions & 5 deletions modules/tutorials/examples/ldap-auth/40-modify-superset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
3 changes: 2 additions & 1 deletion modules/tutorials/examples/ldap-auth/50-verify.superset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
set -euo pipefail
shopt -s lastpipe

source "./utils.sh"
# shellcheck disable=1091
Comment thread
Techassi marked this conversation as resolved.
Resolved
source utils.sh

username="admin"
password="admin"
Expand Down
16 changes: 8 additions & 8 deletions modules/tutorials/examples/ldap-auth/60-modify-trino.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
# The OpaCluster needs to reload the OPA bundle. We need to wait for that, otherwise Alice is
# missing the required permissions.
sleep 20
Comment thread
NickLarsenNZ marked this conversation as resolved.
Resolved
4 changes: 2 additions & 2 deletions modules/tutorials/examples/ldap-auth/80-verify-trino.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ spec:
backend:
k8sSearch:
searchNamespace:
pod: {} # <2>
pod: {} # <2>
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 3 additions & 1 deletion modules/tutorials/examples/ldap-auth/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ do
printf '# %-38s#\n' "$script"
printf "##########################################\n"
bash "$script"
done
done

echo "All steps successfully ran, tutorial completed"
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ spec:
authentication: # <1>
- authenticationClass: openldap # <2>
userRegistrationRole: Admin # <3>
# end::snippet[]
# end::snippet[]
2 changes: 1 addition & 1 deletion modules/tutorials/examples/ldap-auth/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions modules/tutorials/pages/authentication_with_openldap.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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.

Expand Down
Loading