Skip to content

Commit

Permalink
Replace presto with trino (#1130)
Browse files Browse the repository at this point in the history
* Replace presto with trino

* Run sql-worker pod with root user

* Remove internal addr of node

* Add header of health check

* Change internal addr to pod ip of health check

(cherry picked from commit d4c6a55)
  • Loading branch information
yaalsn authored and ericsyh committed Dec 4, 2023
1 parent e9c975b commit 9fe0526
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ data:
{{- if .Values.presto.security.authentication.jwt.enabled }}
# JWT Authentication
http-server.authentication.type=JWT
http-server.authentication.jwt.key-file={{ template "pulsar.home" . }}/conf/presto/{{ .Values.presto.security.authentication.jwt.publicKeyFileName }}
http-server.authentication.jwt.key-file={{ template "pulsar.home" . }}/trino/conf/{{ .Values.presto.security.authentication.jwt.publicKeyFileName }}
{{- end }}

log.properties: |
Expand Down Expand Up @@ -270,13 +270,13 @@ data:
access-control.properties: |
# access-control.properties
access-control.name=file
security.config-file={{ template "pulsar.home" . }}/conf/presto/rules.json
security.config-file={{ template "pulsar.home" . }}/trino/conf/rules.json
security.refresh-period=60s
{{- end}}
{{- if .Values.presto.security.authentication.password.enabled }}
password-authenticator.properties: |
password-authenticator.name=file
file.password-file={{ template "pulsar.home" . }}/presto/{{ .Values.presto.security.authentication.password.passwordFileName }}
file.password-file={{ template "pulsar.home" . }}/trino/{{ .Values.presto.security.authentication.password.passwordFileName }}
file.refresh-period=60s
{{- end}}
{{- end }}
30 changes: 15 additions & 15 deletions charts/pulsar/templates/presto/presto-coordinator-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,10 @@ spec:
{{- end }}
{{- else }}
- >-
cp {{ template "pulsar.home" . }}/conf/presto/node.properties.template {{ template "pulsar.home" . }}/conf/presto/node.properties;
echo "node.id=${HOSTNAME}" >> {{ template "pulsar.home" . }}/conf/presto/node.properties ;
echo "node.internal-address=${HOSTNAME}.{{ template "presto.service" . }}.{{ template "pulsar.namespace" . }}.svc.cluster.local" >> {{ template "pulsar.home" . }}/conf/presto/node.properties ;
ln -s {{ template "pulsar.home" . }}/conf/presto {{ template "pulsar.home" . }}/lib/presto/etc;
cp {{ template "pulsar.home" . }}/trino/conf/node.properties.template {{ template "pulsar.home" . }}/trino/conf/node.properties;
echo "node.id=${HOSTNAME}" >> {{ template "pulsar.home" . }}/trino/conf/node.properties ;
bin/pulsar sql-worker run \
--etc-dir={{ template "pulsar.home" . }}/conf/presto \
--etc-dir={{ template "pulsar.home" . }}/trino/conf \
--data-dir={{ template "pulsar.home" . }}/data;
{{- end }}
env:
Expand All @@ -160,39 +158,41 @@ spec:
name: {{ .Values.broker.offload.s3.secret }}
key: AWS_SECRET_ACCESS_KEY
{{- end }}
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: {{ template "pulsar.home" . }}/conf/presto/node.properties.template
- mountPath: {{ template "pulsar.home" . }}/trino/conf/node.properties.template
name: config-volume
subPath: node.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/log.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/log.properties
name: config-volume
subPath: log.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/jvm.config
- mountPath: {{ template "pulsar.home" . }}/trino/conf/jvm.config
name: config-volume
subPath: jvm.config
- mountPath: {{ template "pulsar.home" . }}/conf/presto/config.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/config.properties
name: config-volume
subPath: config.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/catalog/pulsar.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/catalog/pulsar.properties
name: config-volume
subPath: pulsar.properties
{{- if or .Values.presto.security.authentication.jwt.enabled .Values.presto.security.authentication.password.enabled }}
- mountPath: {{ template "pulsar.home" . }}/conf/presto/rules.json
- mountPath: {{ template "pulsar.home" . }}/trino/conf/rules.json
name: config-volume
subPath: rules.json
{{- end}}
{{- if .Values.presto.security.authentication.password.enabled }}
- mountPath: {{ template "pulsar.home" . }}/conf/presto/password-authenticator.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/password-authenticator.properties
name: config-volume
subPath: password-authenticator.properties
- mountPath: {{ template "pulsar.home" . }}/presto
- mountPath: {{ template "pulsar.home" . }}/trino
name: password-file-volume
{{- end}}
{{- if .Values.presto.security.authentication.jwt.enabled }}
- mountPath: {{ template "pulsar.home" . }}/conf/presto/access-control.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/access-control.properties
name: config-volume
subPath: access-control.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/{{ .Values.presto.security.authentication.jwt.publicKeyFileName }}
- mountPath: {{ template "pulsar.home" . }}/trino/conf/{{ .Values.presto.security.authentication.jwt.publicKeyFileName }}
name: public-key-volume
subPath: {{ .Values.presto.security.authentication.jwt.publicKeyConfigMapKey }}
{{- end}}
Expand Down
20 changes: 10 additions & 10 deletions charts/pulsar/templates/presto/presto-worker-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,10 @@ spec:
{{- end }}
{{- else }}
- >-
cp {{ template "pulsar.home" . }}/conf/presto/node.properties.template {{ template "pulsar.home" . }}/conf/presto/node.properties;
echo "node.id=${HOSTNAME}" >> {{ template "pulsar.home" . }}/conf/presto/node.properties ;
echo "node.internal-address=${HOSTNAME}.{{ template "presto.worker.service" . }}.{{ template "pulsar.namespace" . }}.svc.cluster.local" >> {{ template "pulsar.home" . }}/conf/presto/node.properties ;
ln -s {{ template "pulsar.home" . }}/conf/presto {{ template "pulsar.home" . }}/lib/presto/etc;
cp {{ template "pulsar.home" . }}/trino/conf/node.properties.template {{ template "pulsar.home" . }}/trino/conf/node.properties;
echo "node.id=${HOSTNAME}" >> {{ template "pulsar.home" . }}/trino/conf/node.properties ;
bin/pulsar sql-worker run \
--etc-dir={{ template "pulsar.home" . }}/conf/presto \
--etc-dir={{ template "pulsar.home" . }}/trino/conf \
--data-dir={{ template "pulsar.home" . }}/data;
{{- end }}
env:
Expand All @@ -165,20 +163,22 @@ spec:
name: {{ .Values.broker.offload.s3.secret }}
key: AWS_SECRET_ACCESS_KEY
{{- end }}
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: {{ template "pulsar.home" . }}/conf/presto/node.properties.template
- mountPath: {{ template "pulsar.home" . }}/trino/conf/node.properties.template
name: config-volume
subPath: node.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/log.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/log.properties
name: config-volume
subPath: log.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/jvm.config
- mountPath: {{ template "pulsar.home" . }}/trino/conf/jvm.config
name: config-volume
subPath: jvm.config
- mountPath: {{ template "pulsar.home" . }}/conf/presto/config.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/config.properties
name: config-volume
subPath: config.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/catalog/pulsar.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/catalog/pulsar.properties
name: config-volume
subPath: pulsar.properties
- mountPath: /presto/health_check.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ data:
{{- if .Values.presto.security.authentication.jwt.enabled }}
# JWT Authentication
http-server.authentication.type=JWT
http-server.authentication.jwt.key-file={{ template "pulsar.home" . }}/conf/presto/{{ .Values.presto.security.authentication.jwt.publicKeyFileName }}
http-server.authentication.jwt.key-file={{ template "pulsar.home" . }}/trino/conf/{{ .Values.presto.security.authentication.jwt.publicKeyFileName }}
{{- end }}
{{- if .Values.presto.coordinator.config.custom }}
{{- range $k, $v := .Values.presto.coordinator.config.custom }}
Expand Down Expand Up @@ -279,13 +279,13 @@ data:
access-control.properties: |
# access-control.properties
access-control.name=file
security.config-file={{ template "pulsar.home" . }}/conf/presto/rules.json
security.config-file={{ template "pulsar.home" . }}/trino/conf/rules.json
security.refresh-period=60s
{{- end}}
{{- if .Values.presto.security.authentication.password.enabled }}
password-authenticator.properties: |
password-authenticator.name=file
file.password-file={{ template "pulsar.home" . }}/presto/{{ .Values.presto.security.authentication.password.passwordFileName }}
file.password-file={{ template "pulsar.home" . }}/trino/{{ .Values.presto.security.authentication.password.passwordFileName }}
file.refresh-period=60s
{{- end}}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ spec:
command: ["sh", "-c"]
args:
- >-
cp {{ template "pulsar.home" . }}/conf/presto/node.properties.template {{ template "pulsar.home" . }}/conf/presto/node.properties;
echo "node.id=${HOSTNAME}" >> {{ template "pulsar.home" . }}/conf/presto/node.properties ;
echo "node.internal-address=$(echo ${POD_IP} | tr "." "-").{{ template "presto.service" . }}.{{ template "pulsar.namespace" . }}.svc.cluster.local" >> {{ template "pulsar.home" . }}/conf/presto/node.properties ;
ln -s {{ template "pulsar.home" . }}/conf/presto {{ template "pulsar.home" . }}/lib/presto/etc;
cp {{ template "pulsar.home" . }}/trino/conf/node.properties.template {{ template "pulsar.home" . }}/trino/conf/node.properties;
echo "node.id=${HOSTNAME}" >> {{ template "pulsar.home" . }}/trino/conf/node.properties ;
{{- if .Values.tls.presto.enabled }}
set -ex;
mkdir -p /pulsar/jks;
Expand All @@ -132,7 +130,7 @@ spec:
{{- end }}
{{- end }}
bin/pulsar sql-worker run \
--etc-dir={{ template "pulsar.home" . }}/conf/presto \
--etc-dir={{ template "pulsar.home" . }}/trino/conf \
--data-dir={{ template "pulsar.home" . }}/data;
env:
- name: POD_IP
Expand All @@ -151,39 +149,41 @@ spec:
name: {{ .Values.broker.offload.s3.secret }}
key: AWS_SECRET_ACCESS_KEY
{{- end }}
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: {{ template "pulsar.home" . }}/conf/presto/node.properties.template
- mountPath: {{ template "pulsar.home" . }}/trino/conf/node.properties.template
name: config-volume
subPath: node.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/log.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/log.properties
name: config-volume
subPath: log.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/jvm.config
- mountPath: {{ template "pulsar.home" . }}/trino/conf/jvm.config
name: config-volume
subPath: jvm.config
- mountPath: {{ template "pulsar.home" . }}/conf/presto/config.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/config.properties
name: config-volume
subPath: config.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/catalog/pulsar.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/catalog/pulsar.properties
name: config-volume
subPath: pulsar.properties
{{- if or .Values.presto.security.authentication.jwt.enabled .Values.presto.security.authentication.password.enabled }}
- mountPath: {{ template "pulsar.home" . }}/conf/presto/rules.json
- mountPath: {{ template "pulsar.home" . }}/trino/conf/rules.json
name: config-volume
subPath: rules.json
{{- end}}
{{- if .Values.presto.security.authentication.password.enabled }}
- mountPath: {{ template "pulsar.home" . }}/conf/presto/password-authenticator.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/password-authenticator.properties
name: config-volume
subPath: password-authenticator.properties
- mountPath: {{ template "pulsar.home" . }}/presto
- mountPath: {{ template "pulsar.home" . }}/trino
name: password-file-volume
{{- end}}
{{- if .Values.presto.security.authentication.jwt.enabled }}
- mountPath: {{ template "pulsar.home" . }}/conf/presto/access-control.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/access-control.properties
name: config-volume
subPath: access-control.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/{{ .Values.presto.security.authentication.jwt.publicKeyFileName }}
- mountPath: {{ template "pulsar.home" . }}/trino/conf/{{ .Values.presto.security.authentication.jwt.publicKeyFileName }}
name: public-key-volume
subPath: {{ .Values.presto.security.authentication.jwt.publicKeyConfigMapKey }}
{{- end}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ data:
health_check.sh: |
#!/bin/bash
{{- if .Values.tls.presto.enabled }}
curl --silent https://{{ template "presto.service" . }}:{{ .Values.presto.coordinator.ports.https }}/v1/node -k | tr "," "\n" | grep --silent $(echo ${POD_IP} | tr "." "-")
curl --header "X-Trino-User: test-user" --silent https://{{ template "presto.service" . }}:{{ .Values.presto.coordinator.ports.https }}/v1/node -k | tr "," "\n" | grep ${POD_IP}
{{- else }}
curl --silent http://{{ template "presto.service" . }}:{{ .Values.presto.coordinator.ports.http }}/v1/node | tr "," "\n" | grep --silent $(echo ${POD_IP} | tr "." "-")
curl --header "X-Trino-User: test-user" --silent http://{{ template "presto.service" . }}:{{ .Values.presto.coordinator.ports.http }}/v1/node | tr "," "\n" | grep ${POD_IP}
{{- end }}
{{- end }}
{{- end }}
22 changes: 11 additions & 11 deletions charts/sn-platform/templates/presto/presto-worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,19 @@ spec:
command: ["sh", "-c"]
args:
- >-
cp {{ template "pulsar.home" . }}/conf/presto/node.properties.template {{ template "pulsar.home" . }}/conf/presto/node.properties;
echo "node.id=${HOSTNAME}" >> {{ template "pulsar.home" . }}/conf/presto/node.properties ;
echo "node.internal-address=$(echo ${POD_IP} | tr "." "-").{{ template "presto.worker.service" . }}.{{ template "pulsar.namespace" . }}.svc.cluster.local" >> {{ template "pulsar.home" . }}/conf/presto/node.properties ;
ln -s {{ template "pulsar.home" . }}/conf/presto {{ template "pulsar.home" . }}/lib/presto/etc;
cp {{ template "pulsar.home" . }}/trino/conf/node.properties.template {{ template "pulsar.home" . }}/trino/conf/node.properties;
echo "node.id=${HOSTNAME}" >> {{ template "pulsar.home" . }}/trino/conf/node.properties ;
{{- if .Values.tls.presto.enabled }}
set -ex;
mkdir -p /pulsar/jks;
openssl pkcs12 -export -in /pulsar/certs/presto/tls.crt -inkey /pulsar/certs/presto/tls.key -out /pulsar/jks/server-cert.p12 -name presto-coordinator -passout "pass:{{ template "pulsar.presto.jks.password" . }}";
keytool -importkeystore -srckeystore /pulsar/jks/server-cert.p12 -srcstoretype PKCS12 -srcstorepass {{ template "pulsar.presto.jks.password" . }} -alias presto-coordinator -destkeystore /pulsar/jks/presto.keystore.jks -deststorepass {{ template "pulsar.presto.jks.password" . }};
{{- if .Values.tls.presto.trustCertsEnabled }}
echo "y" | keytool -import -alias selfsigned -file /pulsar/certs/presto/ca.crt -keystore /pulsar/jks/trust.jks -trustcacerts -storepass {{ template "pulsar.presto.jks.password" . }};
echo "y" | keytool -import -alias selfsigned -file /pulsar/certs/presto/ca.crt -keystore /pulsar/jks/trust.jks -trustcacerts -storepass {{ template "pulsar.presto.jks.password" . }};
{{- end }}
{{- end }}
bin/pulsar sql-worker run \
--etc-dir={{ template "pulsar.home" . }}/conf/presto \
--etc-dir={{ template "pulsar.home" . }}/trino/conf \
--data-dir={{ template "pulsar.home" . }}/data;
env:
- name: POD_IP
Expand All @@ -142,20 +140,22 @@ spec:
name: {{ .Values.broker.offload.s3.secret }}
key: AWS_SECRET_ACCESS_KEY
{{- end }}
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: {{ template "pulsar.home" . }}/conf/presto/node.properties.template
- mountPath: {{ template "pulsar.home" . }}/trino/conf/node.properties.template
name: config-volume
subPath: node.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/log.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/log.properties
name: config-volume
subPath: log.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/jvm.config
- mountPath: {{ template "pulsar.home" . }}/trino/conf/jvm.config
name: config-volume
subPath: jvm.config
- mountPath: {{ template "pulsar.home" . }}/conf/presto/config.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/config.properties
name: config-volume
subPath: config.properties
- mountPath: {{ template "pulsar.home" . }}/conf/presto/catalog/pulsar.properties
- mountPath: {{ template "pulsar.home" . }}/trino/conf/catalog/pulsar.properties
name: config-volume
subPath: pulsar.properties
- mountPath: /presto/health_check.sh
Expand Down

0 comments on commit 9fe0526

Please sign in to comment.