Files
stonks-oracle/infra/helm/stonks-oracle/templates/trino.yaml
T

113 lines
3.5 KiB
YAML

{{- if .Values.trino.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: trino
namespace: {{ .Release.Namespace }}
labels:
app: trino
{{- include "stonks.labels" . | nindent 4 }}
stonks-oracle/tier: analytics
spec:
replicas: 1
selector:
matchLabels:
app: trino
template:
metadata:
labels:
app: trino
stonks-oracle/tier: analytics
spec:
automountServiceAccountToken: false
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- include "stonks.podSecurityContext" . | nindent 8 }}
initContainers:
- name: catalog-init
image: busybox:1.36
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
command: ["sh", "-c"]
args:
- |
cat > /catalog/iceberg.properties <<EOF
connector.name=iceberg
iceberg.catalog.type=hive_metastore
hive.metastore.uri=thrift://hive-metastore.{{ $.Release.Namespace }}.svc.cluster.local:9083
hive.s3.endpoint=http://{{ index $.Values.config "MINIO_ENDPOINT" }}
hive.s3.path-style-access=true
hive.s3.aws-access-key=${MINIO_ACCESS_KEY}
hive.s3.aws-secret-key=${MINIO_SECRET_KEY}
fs.native-s3.enabled=true
s3.endpoint=http://{{ index $.Values.config "MINIO_ENDPOINT" }}
s3.path-style-access=true
s3.aws-access-key=${MINIO_ACCESS_KEY}
s3.aws-secret-key=${MINIO_SECRET_KEY}
EOF
cat > /catalog/lakehouse.properties <<EOF
connector.name=hive
hive.metastore.uri=thrift://hive-metastore.{{ $.Release.Namespace }}.svc.cluster.local:9083
hive.s3.endpoint=http://{{ index $.Values.config "MINIO_ENDPOINT" }}
hive.s3.path-style-access=true
hive.s3.aws-access-key=${MINIO_ACCESS_KEY}
hive.s3.aws-secret-key=${MINIO_SECRET_KEY}
hive.non-managed-table-writes-enabled=true
hive.s3select-pushdown.enabled=true
EOF
env:
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: stonks-core-secrets
key: MINIO_ACCESS_KEY
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: stonks-core-secrets
key: MINIO_SECRET_KEY
volumeMounts:
- name: catalog-config
mountPath: /catalog
containers:
- name: trino
image: trinodb/trino:latest
ports:
- containerPort: 8080
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumeMounts:
- name: catalog-config
mountPath: /etc/trino/catalog
resources:
{{- toYaml .Values.trino.resources | nindent 12 }}
readinessProbe:
httpGet:
path: /v1/info
port: 8080
initialDelaySeconds: 15
periodSeconds: 10
volumes:
- name: catalog-config
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: trino
namespace: {{ .Release.Namespace }}
spec:
selector:
app: trino
ports:
- port: 8080
targetPort: 8080
{{- end }}