Deployment: add Helm chart
All checks were successful
/ test (push) Successful in 30s

This commit is contained in:
phil 2024-12-27 02:07:36 +01:00
parent 12d57f0de9
commit 3a84d920c1
7 changed files with 284 additions and 0 deletions

View file

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View file

@ -0,0 +1,6 @@
apiVersion: v2
name: gisaf
description: Gisaf Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "0.15.0-alpha"

View file

@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
namespace: gisaf
data:
GISAF__MAP__LNG: "{{ .Values.map.lng }}"
GISAF__MAP__LAT: "{{ .Values.map.lat }}"
GISAF__MAP__ZOOM: "{{ .Values.map.zoom }}"
GISAF__MAP__PITCH: "{{ .Values.map.pitch }}"

View file

@ -0,0 +1,135 @@
---
apiVersion: v1
kind: Service
metadata:
name: gisaf-database
namespace: gisaf
labels:
app: gisaf-database
spec:
ports:
- name: psql
port: 5432
- name: redis
port: 6379
selector:
app: gisaf-database
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gisaf-database-deployment
namespace: gisaf
labels:
app: gisaf-database
spec:
replicas: 1
selector:
matchLabels:
app: gisaf-database
template:
metadata:
namespace: gisaf
labels:
app: gisaf-database
spec:
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "gisaf-redis"
- "gisaf-database"
containers:
- name: gisaf-database
image: code.philo.ydns.eu/philorg/gisaf-database:latest
imagePullPolicy: Always
args:
- postgres
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: gisaf-pgdata
ports:
- containerPort: 5432
name: psql
- image: docker.io/library/redis:alpine
imagePullPolicy: Always
name: gisaf-redis
args:
- redis-server
volumeMounts:
- mountPath: /data
name: gisaf-redis
ports:
- containerPort: 6379
name: redis
volumes:
- name: gisaf-pgdata
persistentVolumeClaim:
claimName: gisaf-pgdata-pvc
- name: gisaf-redis
persistentVolumeClaim:
claimName: gisaf-redis-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gisaf-pgdata-pvc
namespace: gisaf
spec:
storageClassName: local-path
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gisaf-redis-pvc
namespace: gisaf
spec:
storageClassName: local-path
accessModes:
- ReadWriteMany
resources:
requests:
storage: 200Mi
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: gisaf-pgdata-pv
namespace: gisaf
labels:
type: local
app: gisaf-postgres
spec:
storageClassName: local-path
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
hostPath:
path: /data/gisaf/postgresql
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: gisaf-redis-pv
namespace: gisaf
labels:
type: local
app: gisaf-redis
spec:
storageClassName: local-path
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
hostPath:
path: /data/gisaf/redis

View file

@ -0,0 +1,28 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: gisaf
namespace: gisaf
#annotations:
# kubernetes.io/ingress.class: traefik
# #traefik.ingress.kubernetes.io/router.middlewares: default-strip-prefix@kubernetescrd
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gisaf-server
port:
number: 80
- path: /api
pathType: Prefix
backend:
service:
name: gisaf-server
port:
number: 8081

View file

@ -0,0 +1,69 @@
---
apiVersion: v1
kind: Service
metadata:
name: gisaf-server
namespace: gisaf
labels:
app: gisaf-server
spec:
ports:
- port: 80
targetPort: 80
selector:
app: gisaf-server
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gisaf-server-deployment
namespace: gisaf
labels:
app: gisaf-server
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: gisaf-server
template:
metadata:
namespace: gisaf
labels:
app: gisaf-server
spec:
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "gisaf-frontend"
- "gisaf-backend"
initContainers:
- name: gisaf-backend-initdb
image: "code.philo.ydns.eu/philorg/gisaf-backend:{{ .Values.version.backend }}"
imagePullPolicy: Always
command: ["gisaf", "create-db"]
env:
- name: GISAF__DB__HOST
value: gisaf-database
containers:
- name: gisaf-backend
image: "code.philo.ydns.eu/philorg/gisaf-backend:{{ .Values.version.backend }}"
imagePullPolicy: Always
env:
- name: GISAF__GISAF_LIVE__REDIS
value: redis://gisaf-database
- name: GISAF__DB__HOST
value: gisaf-database
envFrom:
- configMapRef:
name: gisaf-config
- name: gisaf-frontend
image: "code.philo.ydns.eu/philorg/gisaf-frontend:{{ .Values.version.frontend }}"
imagePullPolicy: Always
args:
- nginx
- -g
- daemon off;
ports:
- containerPort: 80

View file

@ -0,0 +1,13 @@
# Replicaset count for the server (2 pods: frontend and backend)
replicaCount: 2
version:
backend: 0.5.0-alpha.10
frontend: 0.5.0-alpha.13
# Map config
map:
lng: "6.178"
lat: "45.8818"
zoom: "14"
pitch: "40"