Skip to content

Commit

Permalink
Merge pull request #6 from cloudcheflabs/2
Browse files Browse the repository at this point in the history
2
  • Loading branch information
cloudcheflabs authored Jun 15, 2022
2 parents c84c55a + d830c2d commit 323e277
Show file tree
Hide file tree
Showing 72 changed files with 3,281 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,13 @@ public static String toJson(ObjectMapper mapper, Object obj)
throw new RuntimeException(e);
}
}

public static String toJson(Object obj)
{
try {
return new ObjectMapper().writeValueAsString(obj);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<module>components/hive/spark-thrift-server</module>
<module>operators/spark/spark-operator</module>
<module>operators/trino/trino-operator</module>
<module>trino-ecosystem/trino-gateway</module>
</modules>
<build>
<pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: dataroaster-trino-gateway-mysql
version: v1.0.0
appVersion: 5.7
description: dataroaster mysql for trino gateway.


Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
apiVersion: v1
kind: Secret
metadata:
name: mysql-secrets
namespace: {{ .Values.namespace }}
type: Opaque
data:
ROOT_PASSWORD: {{ .Values.rootPassword | b64enc }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-data-disk
namespace: {{ .Values.namespace }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.storage.size }}
storageClassName: {{ .Values.storage.storageClass }}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql-statefulset
namespace: {{ .Values.namespace }}
labels:
app: mysql
spec:
serviceName: mysql-service
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:5.7
ports:
- containerPort: 3306
volumeMounts:
- mountPath: "/var/lib/mysql"
subPath: "mysql"
name: mysql-data
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secrets
key: ROOT_PASSWORD
volumes:
- name: mysql-data
persistentVolumeClaim:
claimName: mysql-data-disk
---
apiVersion: v1
kind: Service
metadata:
name: mysql-service
namespace: {{ .Values.namespace }}
spec:
selector:
app: mysql
ports:
- protocol: TCP
port: 3306
targetPort: 3306
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace: trino-gateway
storage:
storageClass: standard
size: 5Gi
rootPassword: mysqlpass123
6 changes: 6 additions & 0 deletions trino-ecosystem/trino-gateway/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

apiVersion: v2
name: dataroaster-trino-gateway
version: v1.0.3
appVersion: v1.0.1
description: dataroaster trino gateway
38 changes: 38 additions & 0 deletions trino-ecosystem/trino-gateway/chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: trino-gateway
namespace: {{ .Values.namespace }}
labels:
app: trino-gateway
data:
application.properties: |
[email protected]@
application-prod.yml: |
# spring boot server
server:
port: {{ .Values.server.port }}
servlet:
context-path: /
# trino proxy
trino:
proxy:
port: {{ .Values.trino.proxy.port }}
authentication: {{ .Values.trino.proxy.authentication }}
tls:
enabled: {{ .Values.trino.proxy.tls.enabled }}
keystorePath: {{ .Values.trino.proxy.tls.keystorePath }}
keystorePass: {{ .Values.trino.proxy.tls.keystorePass }}
trustStorePath: {{ .Values.trino.proxy.tls.trustStorePath }}
trustStorePass: {{ .Values.trino.proxy.tls.trustStorePass }}
# jdbc
jdbc:
driverClassName: com.mysql.jdbc.Driver
url: {{ .Values.jdbc.url }}
user: {{ .Values.jdbc.user }}
pass: {{ .Values.jdbc.pass }}
# hibernate
hibernate:
dialect: org.hibernate.dialect.MySQL5Dialect
show_sql: {{ .Values.hibernate.show_sql }}
globally_quoted_identifiers: {{ .Values.hibernate.globally_quoted_identifiers }}
56 changes: 56 additions & 0 deletions trino-ecosystem/trino-gateway/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: trino-gateway
labels:
app: trino-gateway
namespace: {{ .Values.namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: trino-gateway
template:
metadata:
labels:
app: trino-gateway
annotations:
{{- toYaml $.Values.tolerations | nindent 8 }}
spec:
affinity:
{{- toYaml $.Values.affinity | nindent 8 }}
tolerations:
{{- toYaml $.Values.tolerations | nindent 8 }}
nodeSelector:
{{- toYaml $.Values.nodeSelector | nindent 8 }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
hostNetwork: {{ .Values.hostNetwork }}
serviceAccountName: {{ .Values.serviceAccount }}
containers:
- name: trino-gateway
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
resources:
{{- toYaml $.Values.resources | nindent 12 }}
command:
- "./run-trino-gateway.sh"
volumeMounts:
- name: trino-gateway-volume
mountPath: /opt/trino-gateway/conf/application.properties
subPath: application.properties
- name: trino-gateway-volume
mountPath: /opt/trino-gateway/conf/application-prod.yml
subPath: application-prod.yml
ports:
- name: proxy
containerPort: {{ .Values.trino.proxy.port }}
protocol: TCP
- name: rest
containerPort: {{ .Values.server.port }}
protocol: TCP
volumes:
- name: trino-gateway-volume
configMap:
name: trino-gateway
24 changes: 24 additions & 0 deletions trino-ecosystem/trino-gateway/chart/templates/proxy-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: trino-gateway-proxy-ingress
namespace: {{ .Values.namespace }}
annotations:
cert-manager.io/cluster-issuer: {{ .Values.certManager.clusterIssue }}
spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
rules:
- host: {{ .Values.ingress.proxyHostName }}
http:
paths:
- backend:
service:
name: trino-gateway-proxy-service
port:
number: {{ .Values.trino.proxy.port }}
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- {{ .Values.ingress.proxyHostName }}
secretName: {{ .Values.ingress.proxyHostName }}-tls
24 changes: 24 additions & 0 deletions trino-ecosystem/trino-gateway/chart/templates/rest-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: trino-gateway-rest-ingress
namespace: {{ .Values.namespace }}
annotations:
cert-manager.io/cluster-issuer: {{ .Values.certManager.clusterIssue }}
spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
rules:
- host: {{ .Values.ingress.restHostName }}
http:
paths:
- backend:
service:
name: trino-gateway-rest-service
port:
number: {{ .Values.server.port }}
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- {{ .Values.ingress.restHostName }}
secretName: {{ .Values.ingress.restHostName }}-tls
34 changes: 34 additions & 0 deletions trino-ecosystem/trino-gateway/chart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v1
kind: Service
metadata:
name: trino-gateway-proxy-service
namespace: {{ .Values.namespace }}
labels:
app: trino-gateway
spec:
type: ClusterIP
ports:
- port: {{ .Values.trino.proxy.port }}
targetPort: proxy
protocol: TCP
name: trino-gateway-proxy
selector:
app: trino-gateway

---
apiVersion: v1
kind: Service
metadata:
name: trino-gateway-rest-service
namespace: {{ .Values.namespace }}
labels:
app: trino-gateway
spec:
type: ClusterIP
ports:
- port: {{ .Values.server.port }}
targetPort: rest
protocol: TCP
name: trino-gateway-rest
selector:
app: trino-gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount }}
namespace: {{ .Values.namespace }}
labels:
app.kubernetes.io/name: trino-gateway
52 changes: 52 additions & 0 deletions trino-ecosystem/trino-gateway/chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace: trino-gateway
serviceAccount: trino-gateway
image: cloudcheflabs/trino-gateway:v1.0.1
imagePullPolicy: Always
resources:
requests:
cpu: 200m
memory: 1Gi
limits:
cpu: 300m
memory: 1500Mi
priorityClassName: ""
annotations: null
affinity: null
tolerations: null
nodeSelector: null
hostNetwork: false

# ingress.
ingress:
ingressClassName: nginx
proxyHostName: trino-gateway-proxy-test.cloudchef-labs.com
restHostName: trino-gateway-rest-test.cloudchef-labs.com

# cert-manager.
certManager:
clusterIssue: letsencrypt-prod

# spring boot server
server:
port: 8099
# trino proxy
trino:
proxy:
port: 18080
authentication: true
tls:
enabled: false
keystorePath: /home/opc/keystore.jks
keystorePass: changeit
trustStorePath: /home/opc/.keystore
trustStorePass: changeit
# jdbc
jdbc:
url: jdbc:mysql://mysql-service.trino-gateway.svc:3306/trino_proxy?useSSL=false
user: trino
pass: Trino123!

# hibernate
hibernate:
show_sql: false
globally_quoted_identifiers: true
Loading

0 comments on commit 323e277

Please sign in to comment.