Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test with dynamic catalogs #178

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion charts/trino/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Get the application URL by running these commands:
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} --selector "app.kubernetes.io/name={{ template "trino.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=coordinator" --output name)
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:8080
kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME 8080:8080
{{- end }}
6 changes: 5 additions & 1 deletion charts/trino/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ spec:
{{- end }}
- --debug
- --network-logging=BODY
- --execute=SELECT 1
{{- if has "catalog.management=dynamic" .Values.additionalConfigProperties }}
- --execute=CREATE CATALOG dynamic USING tpch; SELECT name FROM dynamic.tiny.nation WHERE nationkey = 12
{{- else }}
- --execute=SELECT name FROM tpch.tiny.nation WHERE nationkey = 12
{{- end }}
{{- if eq .Values.server.config.authenticationType "PASSWORD" }}
env:
- name: TRINO_PASSWORD
Expand Down
17 changes: 17 additions & 0 deletions dyncat-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
additionalConfigProperties:
- catalog.management=dynamic

server:
coordinatorExtraConfig: |
catalog.config-dir=/etc/trino/dynamic-catalog

coordinator:
additionalVolumes:
- name: catalogs
persistentVolumeClaim:
claimName: catalogs-pvc

additionalVolumeMounts:
- name: catalogs
mountPath: /etc/trino/dynamic-catalog
readOnly: false
26 changes: 21 additions & 5 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare -A testCases=(
[single_node]="--set server.workers=0"
[complete_values]="--values test-values.yaml"
[overrides]="--set coordinatorNameOverride=coordinator-overridden,workerNameOverride=worker-overridden,nameOverride=overridden"
[dynamic_catalogs]="--values dyncat-values.yaml"
)

function join_by {
Expand Down Expand Up @@ -65,14 +66,29 @@ shift $((OPTIND - 1))
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
cd "${SCRIPT_DIR}" || exit 2

echo 1>&2 "Generating a self-signed TLS certificate"
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
-subj "/O=Trino Software Foundation" \
-addext "subjectAltName=DNS:localhost,DNS:*.$NAMESPACE,DNS:*.$NAMESPACE.svc,DNS:*.$NAMESPACE.svc.cluster.local,IP:127.0.0.1" \
-keyout cert.key -out cert.crt
if [ ! -f cert.key ] || [ ! -f cert.crt ]; then
echo 1>&2 "Generating a self-signed TLS certificate"
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
-subj "/O=Trino Software Foundation" \
-addext "subjectAltName=DNS:localhost,DNS:*.$NAMESPACE,DNS:*.$NAMESPACE.svc,DNS:*.$NAMESPACE.svc.cluster.local,IP:127.0.0.1" \
-keyout cert.key -out cert.crt
fi

kubectl create namespace "$NAMESPACE"
kubectl -n "$NAMESPACE" create secret tls certificates --cert=cert.crt --key=cert.key
cat <<YAML | kubectl -n "$NAMESPACE" create -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: catalogs-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: standard
resources:
requests:
storage: 30Mi
YAML

CT_ARGS+=(--namespace "$NAMESPACE")

Expand Down