Skip to content
Snippets Groups Projects
onlyoffice-deployment.yaml 6.92 KiB
Newer Older
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "onlyoffice-documentserver.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "onlyoffice-documentserver.name" . }}
    helm.sh/chart: {{ include "onlyoffice-documentserver.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    {{- if .Values.onlyoffice.deploymentLabels }}
    {{- toYaml .Values.onlyoffice.deploymentLabels | nindent 4 }}
    {{- end }}
  replicas: {{ .Values.onlyoffice.replicaCount }}
    type: {{ .Values.onlyoffice.strategy }}
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ include "onlyoffice-documentserver.name" . }}
      app.kubernetes.io/instance: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app.kubernetes.io/name: {{ include "onlyoffice-documentserver.name" . }}
        app.kubernetes.io/instance: {{ .Release.Name }}
        {{- if .Values.onlyoffice.podLabels }}
        {{- toYaml .Values.onlyoffice.podLabels | nindent 8 }}
        {{- end }}
      annotations: {{ toYaml .Values.onlyoffice.podAnnotations | nindent 8 }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          lifecycle:
            preStop:
              exec:
                command:
                  - "documentserver-prepare4shutdown.sh"
          image: "{{ .Values.onlyoffice.image.repository }}:{{ .Values.onlyoffice.image.tag }}"
          imagePullPolicy: {{ .Values.onlyoffice.image.pullPolicy }}
          {{- if .Values.onlyoffice.livenessProbe.enabled }}
          livenessProbe:
            exec:
              command:
                - "/bin/bash"
                - "-c"
                - "output=$(curl -s http://localhost:{{ .Values.onlyoffice.containerPort }}/healthcheck); if [ $? -ne 0 ]; then exit 1; fi; if [ \"$output\" == \"true\" ]; then exit 0; else exit 2; fi"
            initialDelaySeconds: {{ .Values.onlyoffice.livenessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.onlyoffice.livenessProbe.periodSeconds }}
            timeoutSeconds: {{ .Values.onlyoffice.livenessProbe.timeoutSeconds }}
            successThreshold: {{ .Values.onlyoffice.livenessProbe.successThreshold }}
            failureThreshold: {{ .Values.onlyoffice.livenessProbe.failureThreshold }}
          {{- end }}
Arie Peterson's avatar
Arie Peterson committed
          {{- if .Values.onlyoffice.readinessProbe.enabled }}
          readinessProbe:
            exec:
              command:
                - "/bin/bash"
                - "-c"
                - "output=$(curl -s http://localhost:{{ .Values.onlyoffice.containerPort }}/healthcheck); if [ $? -ne 0 ]; then exit 1; fi; if [ \"$output\" == \"true\" ]; then exit 0; else exit 2; fi"
            initialDelaySeconds: {{ .Values.onlyoffice.readinessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.onlyoffice.readinessProbe.periodSeconds }}
            timeoutSeconds: {{ .Values.onlyoffice.readinessProbe.timeoutSeconds }}
            successThreshold: {{ .Values.onlyoffice.readinessProbe.successThreshold }}
            failureThreshold: {{ .Values.onlyoffice.readinessProbe.failureThreshold }}
          {{- end }}
          {{- if .Values.onlyoffice.startupProbe.enabled }}
          startupProbe:
            exec:
              command:
                - "/bin/bash"
                - "-c"
                - "output=$(curl -s http://localhost:{{ .Values.onlyoffice.containerPort }}/healthcheck); if [ $? -ne 0 ]; then exit 1; fi; if [ \"$output\" == \"true\" ]; then exit 0; else exit 2; fi"
            periodSeconds: {{ .Values.onlyoffice.startupProbe.periodSeconds }}
            timeoutSeconds: {{ .Values.onlyoffice.startupProbe.timeoutSeconds }}
            successThreshold: {{ .Values.onlyoffice.startupProbe.successThreshold }}
            failureThreshold: {{ .Values.onlyoffice.startupProbe.failureThreshold }}
          {{- end }}
            - name: AMQP_URI
              value: "amqp://user:{{ .Values.rabbitmq.auth.password }}@{{ .Release.Name }}-rabbitmq:{{ .Values.rabbitmq.service.ports.amqp }}"
            - name: JWT_ENABLED
              value: "true"
            - name: JWT_SECRET
              value: "{{ .Values.onlyoffice.jwtSecret }}"
            - name: DB_TYPE
              value: "mariadb"
            - name: DB_USER
              value: "{{ .Values.global.onlyofficeDb.user }}"
            - name: DB_PWD
              valueFrom:
                secretKeyRef:
                  name: "{{ .Release.Name }}-onlyoffice-database"
                  key: "database-password"
            - name: DB_HOST
              value: {{ .Values.global.onlyofficeDb.host | default (printf "%s-mariadb" .Release.Name) }}
            - name: DB_PORT
              value: "{{ .Values.global.onlyofficeDb.port }}"
            - name: DB_NAME
              value: "{{ .Values.global.onlyofficeDb.name }}"
            {{- if .Values.nextcloud.redis.enabled }}
            - name: REDIS_SERVER_HOST
              value: "{{ .Release.Name }}-redis-master"
            - name: REDIS_SERVER_PORT
Varac's avatar
Varac committed
              value: "{{ .Values.nextcloud.redis.master.service.ports.redis }}"
            - name: GENERATE_FONTS
              value: "{{ .Values.onlyoffice.generateFonts }}"
            {{- if .Values.nextcloud.redis.auth.enabled }}
            - name: REDIS_SERVER_PASS
              valueFrom:
                secretKeyRef:
                  name: "{{ .Release.Name }}-redis"
Varac's avatar
Varac committed
                  key: "redis-password"
            {{- end }}
            {{- end }}
            - name: USE_UNAUTHORIZED_STORAGE
              value: "{{ .Values.onlyoffice.unauthorizedStorage }}"
            - name: ONLYOFFICE_HTTPS_HSTS_ENABLED
              value: "{{ .Values.onlyoffice.httpsHstsEnabled }}"
          ports:
            - name: http
              containerPort: {{ .Values.onlyoffice.containerPort }}
              protocol: TCP
            - name: spellchecker
              containerPort: 8080
              protocol: TCP
            {{- toYaml .Values.onlyoffice.resources | nindent 12 }}
          securityContext:
            {{- toYaml .Values.onlyoffice.securityContext | nindent 12 }}
          volumeMounts:
            - name: onlyoffice-data
              mountPath: /var/lib/onlyoffice
      volumes:
        - name: onlyoffice-data
        {{- if .Values.onlyoffice.persistence.enabled }}
            claimName: {{ if .Values.onlyoffice.persistence.existingClaim }}{{ .Values.onlyoffice.persistence.existingClaim }}{{- else }}{{ template "onlyoffice-documentserver.fullname" . }}-onlyoffice{{- end }}
      {{- with .Values.onlyoffice.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
    {{- with .Values.onlyoffice.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
    {{- end }}
    {{- with .Values.onlyoffice.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
    {{- end }}