Skip to content

Commit 1f97d6c

Browse files
authored
feat: onboard directus (#639)
* feat: onboard directus * fix: fix pr review * feat: add postgres as backend using postgres-operator
1 parent 93c9973 commit 1f97d6c

37 files changed

+701
-0
lines changed

directus/Pluralfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
REPO directus
2+
ATTRIBUTES Plural repository.yaml
3+
4+
TF terraform/*
5+
HELM helm/*
6+
RECIPE plural/recipes/*
7+
TAG plural/tags/**/*

directus/helm/directus/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

directus/helm/directus/Chart.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: postgres
3+
repository: https://pluralsh.github.io/module-library
4+
version: 0.1.16
5+
digest: sha256:5f04a1841874c3d989726de1b37e36f64403eb56fd509307296abe18f2ffaaf8
6+
generated: "2023-04-13T19:33:27.264488+02:00"

directus/helm/directus/Chart.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v2
2+
name: directus
3+
description: helm chart for directus
4+
type: application
5+
version: 0.1.0
6+
appVersion: 9.25.0
7+
dependencies:
8+
- name: postgres
9+
version: 0.1.16
10+
repository: https://pluralsh.github.io/module-library
11+
condition: postgres.enabled

directus/helm/directus/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A helm chart for directus
5.38 KB
Binary file not shown.

directus/helm/directus/deps.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: plural.sh/v1alpha1
2+
kind: Dependencies
3+
metadata:
4+
application: true
5+
description: Deploys directus crafted for the target cloud
6+
spec:
7+
dependencies:
8+
- type: helm
9+
name: bootstrap
10+
repo: bootstrap
11+
version: '>= 0.5.1'
12+
- type: helm
13+
name: ingress-nginx
14+
repo: ingress-nginx
15+
version: ">= 0.1.2"
16+
- type: terraform
17+
name: aws
18+
repo: directus
19+
version: '>= 0.1.0'
20+
optional: true
21+
- type: terraform
22+
name: azure
23+
repo: directus
24+
version: '>= 0.1.0'
25+
optional: true
26+
- type: terraform
27+
name: gcp
28+
repo: directus
29+
version: '>= 0.1.0'
30+
optional: true
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "directus-plural.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "directus-plural.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "directus-plural.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "directus-plural.labels" -}}
37+
helm.sh/chart: {{ include "directus-plural.chart" . }}
38+
{{ include "directus-plural.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "directus-plural.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "directus-plural.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "directus-plural.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "directus-plural.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
{{- define "directus-plural.secretName" -}}
65+
{{- printf "%s-secret" (include "directus-plural.fullname" .) }}
66+
{{- end }}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "directus-plural.fullname" . }}
5+
labels:
6+
{{- include "directus-plural.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
selector:
12+
matchLabels:
13+
{{- include "directus-plural.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "directus-plural.selectorLabels" . | nindent 8 }}
22+
spec:
23+
{{- with .Values.imagePullSecrets }}
24+
imagePullSecrets:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
serviceAccountName: {{ include "directus-plural.serviceAccountName" . }}
28+
securityContext:
29+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
30+
containers:
31+
- name: {{ .Chart.Name }}
32+
securityContext:
33+
{{- toYaml .Values.securityContext | nindent 12 }}
34+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
35+
imagePullPolicy: {{ .Values.image.pullPolicy }}
36+
env:
37+
{{- range $key, $value := .Values.env }}
38+
- name: {{ $key }}
39+
value: {{ $value | quote }}
40+
{{- end }}
41+
- name: DB_CONNECTION_STRING
42+
valueFrom:
43+
secretKeyRef:
44+
name: directus.plural-postgres-directus.credentials.postgresql.acid.zalan.do
45+
key: dsn
46+
- name: KEY
47+
valueFrom:
48+
secretKeyRef:
49+
name: {{ include "directus-plural.secretName" . }}
50+
key: key
51+
- name: SECRET
52+
valueFrom:
53+
secretKeyRef:
54+
name: {{ include "directus-plural.secretName" . }}
55+
key: secret
56+
ports:
57+
- name: http
58+
containerPort: 8055
59+
protocol: TCP
60+
livenessProbe:
61+
httpGet:
62+
path: /
63+
port: http
64+
readinessProbe:
65+
httpGet:
66+
path: /
67+
port: http
68+
resources:
69+
{{- toYaml .Values.resources | nindent 12 }}
70+
{{- with .Values.nodeSelector }}
71+
nodeSelector:
72+
{{- toYaml . | nindent 8 }}
73+
{{- end }}
74+
{{- with .Values.affinity }}
75+
affinity:
76+
{{- toYaml . | nindent 8 }}
77+
{{- end }}
78+
{{- with .Values.tolerations }}
79+
tolerations:
80+
{{- toYaml . | nindent 8 }}
81+
{{- end }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2beta1
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "directus-plural.fullname" . }}
6+
labels:
7+
{{- include "directus-plural.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "directus-plural.fullname" . }}
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
21+
{{- end }}
22+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
23+
- type: Resource
24+
resource:
25+
name: memory
26+
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
27+
{{- end }}
28+
{{- end }}

0 commit comments

Comments
 (0)