deployment.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ template "nextcloud.fullname" . }}
  5. labels:
  6. app.kubernetes.io/name: {{ include "nextcloud.name" . }}
  7. helm.sh/chart: {{ include "nextcloud.chart" . }}
  8. app.kubernetes.io/instance: {{ .Release.Name }}
  9. app.kubernetes.io/managed-by: {{ .Release.Service }}
  10. app.kubernetes.io/component: app
  11. {{- if .Values.deploymentAnnotations }}
  12. annotations:
  13. {{ toYaml .Values.deploymentAnnotations | indent 4 }}
  14. {{- end }}
  15. spec:
  16. replicas: 1
  17. strategy:
  18. type: {{ .Values.nextcloud.strategy }}
  19. selector:
  20. matchLabels:
  21. app.kubernetes.io/name: {{ include "nextcloud.name" . }}
  22. app.kubernetes.io/instance: {{ .Release.Name }}
  23. app.kubernetes.io/component: app
  24. template:
  25. metadata:
  26. labels:
  27. app.kubernetes.io/name: {{ include "nextcloud.name" . }}
  28. app.kubernetes.io/instance: {{ .Release.Name }}
  29. app.kubernetes.io/component: app
  30. annotations:
  31. rollme: {{ randAlphaNum 5 | quote }}
  32. spec:
  33. {{- if .Values.image.pullSecrets }}
  34. imagePullSecrets:
  35. {{- range .Values.image.pullSecrets }}
  36. - name: {{ . }}
  37. {{- end}}
  38. {{- end }}
  39. initContainers:
  40. - name: init-postgresdb
  41. image: busybox:latest
  42. command: ['sh', '-c', "until nslookup {{ template "nextcloud.fullname" . }}-postgres; do echo waiting for postgres; sleep 2; done"]
  43. imagePullPolicy: {{ .Values.image.pullPolicy }}
  44. containers:
  45. - name: {{ .Chart.Name }}
  46. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  47. imagePullPolicy: {{ .Values.image.pullPolicy }}
  48. env:
  49. - name: POSTGRES_HOST
  50. value: {{ template "nextcloud.fullname" . }}-postgres:5432
  51. - name: POSTGRES_DB
  52. value: "nextcloud"
  53. - name: POSTGRES_USER
  54. valueFrom:
  55. secretKeyRef:
  56. name: db-details
  57. key: db-user
  58. - name: POSTGRES_PASSWORD
  59. valueFrom:
  60. secretKeyRef:
  61. name: db-details
  62. key: db-password
  63. - name: NEXTCLOUD_ADMIN_USER
  64. valueFrom:
  65. secretKeyRef:
  66. name: {{ template "nextcloud.fullname" . }}
  67. key: nextcloud-username
  68. - name: NEXTCLOUD_ADMIN_PASSWORD
  69. valueFrom:
  70. secretKeyRef:
  71. name: {{ template "nextcloud.fullname" . }}
  72. key: nextcloud-password
  73. - name: NEXTCLOUD_TRUSTED_DOMAINS
  74. value: {{ .Values.nextcloud.host }}
  75. - name: NEXTCLOUD_DATA_DIR
  76. value: {{ .Values.nextcloud.datadir | quote }}
  77. ports:
  78. - name: http
  79. containerPort: 80
  80. protocol: TCP
  81. volumeMounts:
  82. - name: nextcloud-data
  83. mountPath: /var/www/
  84. subPath: "root"
  85. - name: nextcloud-data
  86. mountPath: /var/www/html
  87. subPath: "html"
  88. - name: nextcloud-data
  89. mountPath: {{ .Values.nextcloud.datadir }}
  90. subPath: "data"
  91. - name: nextcloud-data
  92. mountPath: /var/www/html/config
  93. subPath: "config"
  94. - name: nextcloud-data
  95. mountPath: /var/www/html/custom_apps
  96. subPath: "custom_apps"
  97. - name: nextcloud-data
  98. mountPath: /var/www/tmp
  99. subPath: "tmp"
  100. - name: nextcloud-data
  101. mountPath: /var/www/html/themes
  102. subPath: "themes"
  103. volumes:
  104. - name: nextcloud-data
  105. {{- if ne (include "configuredHostPath" .) "" }}
  106. hostPath:
  107. path: {{ template "configuredHostPath" . }}
  108. {{- else }}
  109. emptyDir: {}
  110. {{- end }}
  111. # Will mount configuration files as www-data (id: 33) for nextcloud
  112. securityContext:
  113. fsGroup: 33