teableio/teable

View on GitHub
dockers/examples/helm/templates/deployment.yaml

Summary

Maintainability
Test Coverage
{{- $envVars := include "common.env.transformDict" .Values.envVars -}}
{{- $fullName := include "teable.nameBuilder" . -}}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ $fullName }}
  namespace: {{ include "common.namespace" . }}
  labels:
    {{- include "common.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
{{- end }}
  selector:
    matchLabels:
      {{- include "common.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      annotations:
        checksum/secrets: {{ include (print .Template.BasePath "/secret.yaml") . | sha256sum }}
    {{- with .Values.podAnnotations }}
        {{- toYaml . | nindent 8 }}
    {{- end }}
      labels:
        {{- include "common.selectorLabels" . | nindent 8 }}
    spec:
      serviceAccountName: {{ include "common.serviceAccountName" . }}
      {{- if .Values.image.pullSecrets }}
      imagePullSecrets:
        {{- toYaml .Values.image.pullSecrets | nindent 8 }}
      {{- end }}
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          env:
            {{- include "teable.env.backend" $ | nindent 12 }}
            {{- include "teable.env.database" $ | nindent 12 }}
            {{- include "teable.env.mail" $ | nindent 12 }}
            {{- include "teable.env.storage" $ | nindent 12 }}
            {{- $envVars | indent 12 }}
          ports:
            - name: http
              containerPort: {{ .Values.service.targetPort }}
              protocol: TCP
          {{- if .Values.probes.liveness }}
          livenessProbe:
            {{- include "common.probes.abstract" (merge .Values.probes.liveness (dict "targetPort" .Values.service.targetPort )) | nindent 12 }}
          {{- end }}
          {{- if .Values.probes.readiness }}
          readinessProbe:
            {{- include "common.probes.abstract" (merge .Values.probes.readiness (dict "targetPort" .Values.service.targetPort )) | nindent 12 }}
          {{- end }}
          {{- if .Values.probes.startup }}
          startupProbe:
            {{- include "common.probes.abstract" (merge .Values.probes.startup (dict "targetPort" .Values.service.targetPort )) | nindent 12 }}
          {{- end }}
          {{- if .Values.persistence }}
          volumeMounts:
            {{- range $name, $volume := .Values.persistence }}
            - name: "{{ $name }}"
              mountPath: "{{ $volume.mountPath }}"
            {{- end }}
          {{- 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 }}
      {{- if .Values.persistence }}
      volumes:
        {{- range $name, $volume := .Values.persistence }}
        - name: "{{ $name }}"
          persistentVolumeClaim:
            claimName: "{{ $fullName }}-{{ $name }}"
        {{- end }}
      {{- end }}
---
apiVersion: v1
kind: Service
metadata:
  name: {{ include "teable.nameBuilder" . }}
  namespace: {{ include "common.namespace" . }}
  labels:
    {{- include "common.labels" . | nindent 4 }}
  annotations:
    {{- toYaml .Values.service.annotations | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: {{ .Values.service.targetPort }}
      protocol: TCP
      name: teable-port
  selector:
    {{- include "common.selectorLabels" . | nindent 4 }}