feat(hasura-engine) add graphql server chart

This commit is contained in:
Tommy 2023-12-19 17:47:53 +01:00
parent 038366081b
commit b37e0d6d7c
No known key found for this signature in database
6 changed files with 133 additions and 0 deletions

View file

@ -0,0 +1,5 @@
apiVersion: v2
name: hasura-engine
description: GraphQL Engine to make data accessible over a GraphQL API
type: application
version: 0.1.2

View file

@ -0,0 +1,3 @@
https://cloudnative-pg.io/blog/hasura-graphql/

View file

@ -0,0 +1,25 @@
{{- define "hasura.fullname" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end }}
# Define a template for standard labels.
{{/*
Common labels
*/}}
{{- define "hasura.labels" -}}
helm.sh/chart: {{ include "hasura.chart" . }}
app.kubernetes.io/name: {{ include "hasura.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.Version | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
# Define a template for the chart name and version.
{{/*
Generate basic labels
*/}}
{{- define "hasura.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" -}}
{{- end }}
# Optionally, add more helper templates as needed.

View file

@ -0,0 +1,53 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "hasura.fullname" . }}
labels:
{{- include "hasura.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "hasura.fullname" . }}
template:
metadata:
labels:
app: {{ include "hasura.fullname" . }}
spec:
initContainers:
- name: db-init
image: "{{ .Values.initContainers.dbInit.image.repository }}:{{ .Values.initContainers.dbInit.image.tag }}"
envFrom:
- secretRef:
name: {{ .Values.envFromSecret }}
containers:
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: hasura
env:
- name: HASURA_GRAPHQL_ADMIN_INTERNAL_ERRORS
value: "false"
- name: HASURA_GRAPHQL_ENABLE_MAINTENANCE_MODE
value: "false"
- name: HASURA_GRAPHQL_CORS_DOMAIN
value: "{{ .Values.corsDomains }}"
- name: HASURA_GRAPHQL_ENABLE_CONSOLE
value: "{{ .Values.features.console }}"
- name: HASURA_GRAPHQL_DEV_MODE
value: "{{ .Values.features.devMode }}"
envFrom:
- secretRef:
name: {{ .Values.envFromSecret }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: http
readinessProbe:
httpGet:
path: /healthz
port: http
resources: {}

View file

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "hasura.fullname" . }}
labels:
{{- include "hasura.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 8080
protocol: TCP
selector:
app: {{ include "hasura.fullname" . }}

View file

@ -0,0 +1,33 @@
image:
repository: hasura/graphql-engine
tag: v2.36.0
pullPolicy: IfNotPresent
initContainers:
dbInit:
image:
repository: ghcr.io/onedr0p/postgres-init
tag: "16"
envFrom:
- secretRef:
name: dispatch-secret
replicas: "1"
service:
type: ClusterIP
port: 80
features:
devMode: true
console: true
corsDomains: "*"
envFromSecret: hasura-secret
admin:
secretKey: HASURA_GRAPHQL_ADMIN_SECRET
jwt:
secretKey: HASURA_GRAPHQL_JWT_SECRET
postgres:
secretKey: HASURA_GRAPHQL_DATABASE_URL