From 9a4120c4be4cfad262b1c1d0f492d2206fa6b633 Mon Sep 17 00:00:00 2001 From: titver968 Date: Tue, 4 Mar 2025 13:13:27 +0100 Subject: [PATCH] copy from wekan --- tatort/templates/deployment.bak | 68 ++++++++++++++++ tatort/templates/deployment.yaml | 130 +++++++++++++++++++++---------- tatort/templates/service.bak | 15 ++++ tatort/templates/service.yaml | 17 +++- 4 files changed, 185 insertions(+), 45 deletions(-) create mode 100644 tatort/templates/deployment.bak create mode 100644 tatort/templates/service.bak diff --git a/tatort/templates/deployment.bak b/tatort/templates/deployment.bak new file mode 100644 index 0000000..b995db1 --- /dev/null +++ b/tatort/templates/deployment.bak @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "tatort.fullname" . }} + labels: + {{- include "tatort.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "tatort,selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "tatort,labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "tatort,serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/tatort/templates/deployment.yaml b/tatort/templates/deployment.yaml index b995db1..ab23196 100644 --- a/tatort/templates/deployment.yaml +++ b/tatort/templates/deployment.yaml @@ -1,68 +1,114 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "tatort.fullname" . }} + name: {{ template "tatort.fullname" . }} labels: - {{- include "tatort.labels" . | nindent 4 }} + app: {{ template "tatort.name" . }} + chart: {{ template "tatort.chart" . }} + component: tatort + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- if .Values.deploymentLabels }} + {{- toYaml .Values.deploymentLabels | nindent 4 }} + {{- end }} spec: - {{- if not .Values.autoscaling.enabled }} + strategy: + {{ toYaml .Values.updateStrategy | nindent 4 }} replicas: {{ .Values.replicaCount }} - {{- end }} selector: matchLabels: - {{- include "tatort,selectorLabels" . | nindent 6 }} + app: {{ template "tatort.name" . }} + component: tatort + release: {{ .Release.Name }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} labels: - {{- include "tatort,labels" . | nindent 8 }} - {{- with .Values.podLabels }} - {{- toYaml . | nindent 8 }} + app: {{ template "tatort.name" . }} + component: tatort + release: {{ .Release.Name }} + {{- if .Values.podLabels }} + {{- toYaml .Values.podLabels | nindent 8 }} {{- end }} spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "tatort,serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + serviceAccountName: {{ template "tatort.serviceAccountName" . }} + automountServiceAccountToken: {{ .Values.serviceAccounts.automount }} + {{- if ne .Values.platform "openshift" }} + initContainers: + - name: volume-permissions + image: "{{ .Values.init.image.repository }}:{{ .Values.init.image.tag }}" + imagePullPolicy: {{ .Values.init.image.pullPolicy }} + command: ['sh', '-c', 'chown -R 999:999 /data'] + volumeMounts: + - name: shared-data-volume + mountPath: /data + resources: + {{- toYaml .Values.init.resources | nindent 12 }} + securityContext: + {{- toYaml .Values.init.podSecurityContext | nindent 12 }} + {{- end }} containers: - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + terminationMessagePolicy: FallbackToLogsOnError ports: - name: http containerPort: {{ .Values.service.port }} - protocol: TCP - livenessProbe: - {{- toYaml .Values.livenessProbe | nindent 12 }} - readinessProbe: - {{- toYaml .Values.readinessProbe | nindent 12 }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.volumeMounts }} - volumeMounts: - {{- toYaml . | nindent 12 }} + env: + {{- if .value }} + - name: {{ .name }} + value: {{ .value | quote }} {{- end }} - {{- with .Values.volumes }} - volumes: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.nodeSelector }} + {{- end }} + {{- range $key := .Values.secretEnv }} + - name: {{ .name }} + valueFrom: + secretKeyRef: + name: {{ template "tatort.fullname" $ }}-secret + key: {{ .name }} + {{- end }} + envFrom: + {{- with .Values.extraEnvFrom }} + {{- tpl . $ | nindent 10 }} + {{- end }} + readinessProbe: + httpGet: + path: / + port: {{ .Values.service.port }} + initialDelaySeconds: 20 + livenessProbe: + httpGet: + path: / + port: {{ .Values.service.port }} + initialDelaySeconds: 60 + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + {{ if .Values.sharedDataFolder.enabled }} + volumeMounts: + - name: shared-data-volume + mountPath: /data + {{ end }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- with .Values.nodeSelector }} nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} +{{ toYaml . | indent 8 }} + {{- end }} +{{- if .Values.affinity }} affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} +{{ toYaml .Values.affinity | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} +{{ toYaml . | indent 8 }} + {{- end }} + {{ if .Values.sharedDataFolder.enabled }} + volumes: + - name: shared-data-volume + persistentVolumeClaim: + claimName: {{ template "tatort.fullname" . }}-shared-data + {{ end }} + diff --git a/tatort/templates/service.bak b/tatort/templates/service.bak new file mode 100644 index 0000000..ee9577c --- /dev/null +++ b/tatort/templates/service.bak @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "tatort.fullname" . }} + labels: + {{- include "tatort.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "tatort.selectorLabels" . | nindent 4 }} diff --git a/tatort/templates/service.yaml b/tatort/templates/service.yaml index ee9577c..1f586d6 100644 --- a/tatort/templates/service.yaml +++ b/tatort/templates/service.yaml @@ -1,9 +1,17 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "tatort.fullname" . }} + {{- if .Values.service.annotations }} + annotations: +{{ toYaml .Values.service.annotations | indent 4 }} + {{- end }} + name: {{ template "tatort.fullname" . }} labels: - {{- include "tatort.labels" . | nindent 4 }} + app: {{ template "tatort.name" . }} + chart: {{ template "tatort.chart" . }} + component: tatort + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} spec: type: {{ .Values.service.type }} ports: @@ -12,4 +20,7 @@ spec: protocol: TCP name: http selector: - {{- include "tatort.selectorLabels" . | nindent 4 }} + app: {{ template "tatort.name" . }} + component: tatort + release: {{ .Release.Name }} +