All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 26s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 7s
159 lines
4.5 KiB
YAML
159 lines
4.5 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: django
|
|
namespace: labhelper
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: django
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: django
|
|
spec:
|
|
securityContext:
|
|
fsGroup: 99
|
|
fsGroupChangePolicy: "OnRootMismatch"
|
|
initContainers:
|
|
- name: loader
|
|
image: git.baumann.gr/adebaumann/labhelper-data-loader:0.014
|
|
securityContext:
|
|
runAsUser: 0
|
|
command: [ "sh","-c","if [ ! -f /data/db.sqlite3 ] || [ ! -s /data/db.sqlite3 ]; then cp preload/preload.sqlite3 /data/db.sqlite3 && echo 'Database copied from preload'; else echo 'Existing database preserved'; fi" ]
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data
|
|
containers:
|
|
- name: web
|
|
image: git.baumann.gr/adebaumann/labhelper:0.071
|
|
imagePullPolicy: Always
|
|
ports:
|
|
- containerPort: 8000
|
|
env:
|
|
- name: DJANGO_SECRET_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: django-secret
|
|
key: secret-key
|
|
- name: DEBUG
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: DEBUG
|
|
- name: ALLOWED_HOSTS
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: ALLOWED_HOSTS
|
|
- name: ALLOWED_CIDR_NETS
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: ALLOWED_CIDR_NETS
|
|
- name: LANGUAGE_CODE
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: LANGUAGE_CODE
|
|
- name: TIME_ZONE
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: TIME_ZONE
|
|
- name: USE_I18N
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: USE_I18N
|
|
- name: USE_TZ
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: USE_TZ
|
|
- name: STATIC_URL
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: STATIC_URL
|
|
- name: MEDIA_URL
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: MEDIA_URL
|
|
- name: CSRF_TRUSTED_ORIGINS
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: CSRF_TRUSTED_ORIGINS
|
|
- name: LOGIN_URL
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: LOGIN_URL
|
|
- name: LOGIN_REDIRECT_URL
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: LOGIN_REDIRECT_URL
|
|
- name: LOGOUT_REDIRECT_URL
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: LOGOUT_REDIRECT_URL
|
|
- name: TRUSTED_PROXIES
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: TRUSTED_PROXIES
|
|
- name: GUNICORN_OPTS
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: GUNICORN_OPTS
|
|
- name: IMAGE_TAG
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: django-config
|
|
key: IMAGE_TAG
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /app/data
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 8000
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
timeoutSeconds: 2
|
|
failureThreshold: 6
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 8000
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 20
|
|
timeoutSeconds: 2
|
|
failureThreshold: 3
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: labhelper-data-pvc
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: django
|
|
namespace: labhelper
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: django
|
|
ports:
|
|
- name: http
|
|
protocol: TCP
|
|
port: 8000
|
|
targetPort: 8000
|
|
|