deployment.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {{ $postgres_values := (. | mustDeepCopy) }}
  2. {{ $_ := set $postgres_values "common" (dict "nameSuffix" "postgres") }}
  3. {{ include "common.deployment.common_config" . | nindent 0 }}
  4. spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
  5. template: {{ include "common.deployment.pod.metadata" . | nindent 4 }}
  6. spec:
  7. initContainers:
  8. - name: init-postgresdb
  9. image: {{ template "postgres.imageName" . }}
  10. command: ['sh', '-c', "until pg_isready -h {{ template "common.names.fullname" $postgres_values }}; do echo waiting for postgres; sleep 2; done"]
  11. imagePullPolicy: {{ .Values.image.pullPolicy }}
  12. containers:
  13. - name: {{ .Chart.Name }}
  14. {{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
  15. env: {{ include "postgres.envVariableConfiguration" $postgres_values | nindent 10 }}
  16. {{ $envList := list }}
  17. {{ $secretName := (include "common.names.fullname" .) }}
  18. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_HOST" "value" (printf "%s:5432" (include "common.names.fullname" $postgres_values))) }}
  19. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_DB" "value" (include "postgres.DatabaseName" .)) }}
  20. {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_DATA_DIR" "value" .Values.nextcloud.datadir) }}
  21. {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_TRUSTED_DOMAINS" "value" .Values.nextcloud.host) }}
  22. {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-username") }}
  23. {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-password") }}
  24. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
  25. ports:
  26. - name: http
  27. containerPort: 80
  28. protocol: TCP
  29. volumeMounts:
  30. - name: nextcloud-data
  31. mountPath: /var/www/
  32. subPath: "root"
  33. - name: nextcloud-data
  34. mountPath: /var/www/html
  35. subPath: "html"
  36. - name: nextcloud-data
  37. mountPath: {{ .Values.nextcloud.datadir }}
  38. subPath: "data"
  39. - name: nextcloud-data
  40. mountPath: /var/www/html/config
  41. subPath: "config"
  42. - name: nextcloud-data
  43. mountPath: /var/www/html/custom_apps
  44. subPath: "custom_apps"
  45. - name: nextcloud-data
  46. mountPath: /var/www/tmp
  47. subPath: "tmp"
  48. - name: nextcloud-data
  49. mountPath: /var/www/html/themes
  50. subPath: "themes"
  51. {{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
  52. # Will mount configuration files as www-data (id: 33) for nextcloud
  53. securityContext:
  54. fsGroup: 33