deployment.yaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. {{ if eq (include "nginx.certAvailable" .) "true" }}
  14. - name: nginx
  15. {{ include "common.containers.imageConfig" .Values.nginx.image | nindent 8 }}
  16. volumeMounts:
  17. - name: nginx-configuration
  18. mountPath: /etc/nginx/nginx.conf
  19. subPath: nginx.conf
  20. {{ include "nginx.tlsKeysVolumeMount" . | nindent 10 }}
  21. ports:
  22. - name: nginx-http
  23. containerPort: 8000
  24. protocol: TCP
  25. - name: nginx-https
  26. containerPort: 443
  27. protocol: TCP
  28. {{ end }}
  29. - name: {{ .Chart.Name }}
  30. {{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
  31. env: {{ include "postgres.envVariableConfiguration" $postgres_values | nindent 10 }}
  32. {{ $envList := list }}
  33. {{ $secretName := (include "common.names.fullname" .) }}
  34. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_HOST" "value" (printf "%s:5432" (include "common.names.fullname" $postgres_values))) }}
  35. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_DB" "value" (include "postgres.DatabaseName" .)) }}
  36. {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_DATA_DIR" "value" .Values.nextcloud.datadir) }}
  37. {{ if eq (include "nginx.certAvailable" .) "true" }}
  38. {{ $envList = mustAppend $envList (dict "name" "APACHE_DISABLE_REWRITE_IP" "value" "1") }}
  39. {{ $envList = mustAppend $envList (dict "name" "OVERWRITEHOST" "value" (printf "%v:%v" .Values.nextcloud.host .Values.service.nodePort)) }}
  40. {{ $envList = mustAppend $envList (dict "name" "OVERWRITEPROTOCOL" "value" "https") }}
  41. {{ end }}
  42. {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_TRUSTED_DOMAINS" "value" .Values.nextcloud.host) }}
  43. {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-username") }}
  44. {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-password") }}
  45. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
  46. ports:
  47. - name: http
  48. containerPort: 80
  49. protocol: TCP
  50. volumeMounts:
  51. - name: nextcloud-data
  52. mountPath: /var/www/
  53. subPath: "root"
  54. - name: nextcloud-data
  55. mountPath: /var/www/html
  56. subPath: "html"
  57. - name: nextcloud-data
  58. mountPath: {{ .Values.nextcloud.datadir }}
  59. subPath: "data"
  60. - name: nextcloud-data
  61. mountPath: /var/www/html/config
  62. subPath: "config"
  63. - name: nextcloud-data
  64. mountPath: /var/www/html/custom_apps
  65. subPath: "custom_apps"
  66. - name: nextcloud-data
  67. mountPath: /var/www/tmp
  68. subPath: "tmp"
  69. - name: nextcloud-data
  70. mountPath: /var/www/html/themes
  71. subPath: "themes"
  72. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  73. - name: extrappvolume-{{ $index }}
  74. mountPath: {{ $hostPathConfiguration.mountPath }}
  75. {{ end }}
  76. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  77. volumes:
  78. - name: nginx-configuration
  79. configMap:
  80. defaultMode: 0700
  81. name: "nginx-configuration"
  82. {{ include "nginx.tlsKeysVolume" . | nindent 8 }}
  83. {{ if .Values.appVolumeMounts }}
  84. {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  85. {{ end }}
  86. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  87. - name: extrappvolume-{{ $index }}
  88. hostPath:
  89. path: {{ $hostPathConfiguration.hostPath }}
  90. {{ end }}
  91. # Will mount configuration files as www-data (id: 33) for nextcloud
  92. securityContext:
  93. fsGroup: 33