Skip to content

Instantly share code, notes, and snippets.

@gmaliar
Created October 5, 2021 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmaliar/dd8758e3d6341c6c55e4ff295bcd065a to your computer and use it in GitHub Desktop.
Save gmaliar/dd8758e3d6341c6c55e4ff295bcd065a to your computer and use it in GitHub Desktop.
# Should go into templates/bootstrap-job.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: initdb.sql
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
data:
initdb.sql: |
-- create pgcrypto extension, required for Hasura UUID
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE EXTENSION IF NOT EXISTS "pg_trgm";
SET TIME ZONE 'UTC';
---
apiVersion: batch/v1
kind: Job
metadata:
name: initdb
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "5"
spec:
template:
metadata:
name: initdb
namespace: {{ .Release.Namespace }}
labels:
app: init-postgresdb
spec:
containers:
- image: "docker.io/bitnami/postgresql:latest"
name: init-db
command: ["bin/sh", "-c", "psql -a -f /initdb.sql"]
volumeMounts:
- name: initdb
mountPath: /initdb.sql
subPath: initdb.sql
env:
- name: PGHOST
value: {{ index .Values "prefect-server" "postgresql" "externalHostname" }}
- name: PGDATABASE
value: {{ index .Values "prefect-server" "postgresql" "postgresqlDatabase" }}
- name: PGUSER
value: {{ index .Values "prefect-server" "postgresql" "postgresqlUsername" }}
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ index .Values "prefect-server" "postgresql" "existingSecret" }}
key: postgresql-password
volumes:
- name: initdb
configMap:
name: initdb.sql
restartPolicy: OnFailure
description: A Helm chart for Prefect
name: prefect
version: 0.1.0
appVersion: "latest"
type: application
dependencies:
- name: prefect-server
repository: "https://prefecthq.github.io/server"
version: 2021.07.06
# Should go into templates/ingress.yaml
{{- $ingressUrl := .Values.ingress.url -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: prefect
namespace: {{ .Release.Namespace }}
spec:
rules:
{{- range .Values.ingress.paths }}
- host: {{ $ingressUrl }}
http:
paths:
- path: {{ .path | quote }}
pathType: ImplementationSpecific
backend:
service:
name: {{ .name | quote }}
port:
number: {{ .port }}
{{ end }}
tls:
- secretName: {{ .Values.tlsSecretName }}
hosts:
- {{ $ingressUrl }}
ingress:
url: ""
paths:
- path: /
name: prefect-ui
port: 8080
- path: /graphql
name: prefect-apollo
port: 4200
tlsSecretName: ""
prefect-server:
agent:
enabled: true
jobs:
createTenant:
enabled: true
ui:
service:
type: ClusterIP
apolloApiUrl: ""
apollo:
service:
type: ClusterIP
postgresql:
useSubChart: false
externalHostname: cloudsqlproxy.cloudsqlproxy
postgresqlDatabase: prefect
postgresqlUsername: postgres
existingSecret: prefect-db-secret
servicePort: 5432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment