mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-09 13:17:46 +02:00
add k8s deployment, improved Dockerfiles and docker-compose.yaml files
This commit is contained in:
62
charts/templates/_helpers.tpl
Normal file
62
charts/templates/_helpers.tpl
Normal file
@@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "htwkalender.name" -}}
|
||||
{{- default .Release.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "htwkalender.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "htwkalender.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "htwkalender.labels" -}}
|
||||
helm.sh/chart: {{ include "htwkalender.chart" . }}
|
||||
{{ include "htwkalender.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "htwkalender.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "htwkalender.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "htwkalender.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "htwkalender.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
50
charts/templates/deployment-data-manager.yaml
Normal file
50
charts/templates/deployment-data-manager.yaml
Normal file
@@ -0,0 +1,50 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "htwkalender.name" . }}-data-manager
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 4 }}
|
||||
component: data-manager
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: {{ .Values.dataManager.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "htwkalender.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 8 }}
|
||||
component: data-manager
|
||||
spec:
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}-data-manager
|
||||
image: "{{ .Values.dataManager.image.name }}"
|
||||
imagePullPolicy: {{ .Values.dataManager.image.pullPolicy }}
|
||||
ports:
|
||||
- name: data-manager
|
||||
containerPort: {{ .Values.dataManager.service.targetPort }}
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
{{- if .Values.persistence.enabled }}
|
||||
- name: {{ include "htwkalender.name" . }}-storage
|
||||
mountPath: /htwkalender-data-manager/data
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.persistence.enabled }}
|
||||
- name: {{ include "htwkalender.name" . }}-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "htwkalender.name" . }}-storage
|
||||
{{- end }}
|
49
charts/templates/deployment-frontend.yaml
Normal file
49
charts/templates/deployment-frontend.yaml
Normal file
@@ -0,0 +1,49 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "htwkalender.name" . }}-frontend
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 4 }}
|
||||
component: frontend
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: {{ .Values.frontend.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "htwkalender.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 8 }}
|
||||
component: frontend
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}-frontend
|
||||
image: "{{ .Values.frontend.image.name }}"
|
||||
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
|
||||
ports:
|
||||
- name: frontend
|
||||
containerPort: {{ .Values.frontend.service.targetPort }}
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
{{- if .Values.production }}
|
||||
- name: configmap-google
|
||||
mountPath: /{{ .Values.frontend.googleSiteVerification }}.html
|
||||
subPath: {{ .Values.frontend.googleSiteVerification }}.html
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.production }}
|
||||
volumes:
|
||||
- name: configmap-google
|
||||
configMap:
|
||||
name: configmap-google
|
||||
{{- end }}
|
||||
|
38
charts/templates/deployment-ical.yaml
Normal file
38
charts/templates/deployment-ical.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "htwkalender.name" . }}-ical
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 4 }}
|
||||
component: ical
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: {{ .Values.ical.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "htwkalender.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 8 }}
|
||||
component: ical
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}-ical
|
||||
image: "{{ .Values.ical.image.name }}"
|
||||
imagePullPolicy: {{ .Values.ical.image.pullPolicy }}
|
||||
ports:
|
||||
- name: ical
|
||||
containerPort: {{ .Values.ical.service.targetPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: DATA_MANAGER_URL
|
||||
value: {{ .Values.dataManager.service.name }}
|
16
charts/templates/pvc-data-manager.yaml
Normal file
16
charts/templates/pvc-data-manager.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
{{- if .Values.persistence.enabled }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "htwkalender.name" . }}-storage
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
{{- with .Values.persistence.accessModes }}
|
||||
accessModes:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
storageClassName: {{ .Values.persistence.storageClassName }}
|
||||
{{- end }}
|
17
charts/templates/service-data-manager.yaml
Normal file
17
charts/templates/service-data-manager.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.dataManager.service.name }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 4 }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
{{- include "htwkalender.selectorLabels" . | nindent 4 }}
|
||||
component: data-manager
|
||||
ports:
|
||||
- port: {{ .Values.dataManager.service.port }}
|
||||
targetPort: {{ .Values.dataManager.service.targetPort }}
|
||||
protocol: TCP
|
||||
name: data-manager
|
17
charts/templates/service-frontend.yaml
Normal file
17
charts/templates/service-frontend.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.frontend.service.name }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 4 }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
{{- include "htwkalender.selectorLabels" . | nindent 4 }}
|
||||
component: frontend
|
||||
ports:
|
||||
- port: {{ .Values.frontend.service.port }}
|
||||
targetPort: {{ .Values.frontend.service.targetPort }}
|
||||
protocol: TCP
|
||||
name: frontend
|
17
charts/templates/service-ical.yaml
Normal file
17
charts/templates/service-ical.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.ical.service.name }}
|
||||
labels:
|
||||
{{- include "htwkalender.labels" . | nindent 4 }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
{{- include "htwkalender.selectorLabels" . | nindent 4 }}
|
||||
component: ical
|
||||
ports:
|
||||
- port: {{ .Values.ical.service.port }}
|
||||
targetPort: {{ .Values.ical.service.targetPort }}
|
||||
protocol: TCP
|
||||
name: ical
|
Reference in New Issue
Block a user