You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
4.0 KiB

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ include "wiki.fullname" . }}
  5. labels:
  6. {{- include "wiki.labels" . | nindent 4 }}
  7. spec:
  8. replicas: {{ .Values.replicaCount }}
  9. revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
  10. selector:
  11. matchLabels:
  12. {{- include "wiki.selectorLabels" . | nindent 6 }}
  13. template:
  14. metadata:
  15. labels:
  16. {{- include "wiki.selectorLabels" . | nindent 8 }}
  17. spec:
  18. {{- with .Values.imagePullSecrets }}
  19. imagePullSecrets:
  20. {{- toYaml . | nindent 8 }}
  21. {{- end }}
  22. serviceAccountName: {{ include "wiki.serviceAccountName" . }}
  23. securityContext:
  24. {{- toYaml .Values.podSecurityContext | nindent 8 }}
  25. {{- if .Values.sideload.enabled }}
  26. initContainers:
  27. - name: {{ .Chart.Name }}-sideload
  28. image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
  29. imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
  30. env:
  31. {{- toYaml .Values.sideload.env | nindent 12 }}
  32. command: [ "sh", "-c" ]
  33. args: [ "mkdir -p /wiki/data/sideload && git clone --depth=1 {{ .Values.sideload.repoURL }} /wiki/data/sideload/" ]
  34. {{- end }}
  35. containers:
  36. - name: {{ .Chart.Name }}
  37. securityContext:
  38. {{- toYaml .Values.securityContext | nindent 12 }}
  39. image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
  40. imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
  41. env:
  42. - name: DB_TYPE
  43. value: postgres
  44. {{- if (.Values.externalPostgresql).databaseURL }}
  45. - name: DATABASE_URL
  46. value: {{ .Values.externalPostgresql.databaseURL }}
  47. - name: NODE_TLS_REJECT_UNAUTHORIZED
  48. value: {{ default "1" .Values.externalPostgresql.NODE_TLS_REJECT_UNAUTHORIZED | quote }}
  49. {{- else }}
  50. - name: DB_HOST
  51. value: {{ template "wiki.postgresql.host" . }}
  52. - name: DB_PORT
  53. value: "{{ default "5432" .Values.postgresql.postgresqlPort }}"
  54. - name: DB_NAME
  55. value: {{ default "wiki" .Values.postgresql.postgresqlDatabase }}
  56. - name: DB_USER
  57. value: {{ default "wiki" .Values.postgresql.postgresqlUser }}
  58. - name: DB_SSL
  59. value: "{{ default "false" .Values.postgresql.ssl }}"
  60. - name: DB_SSL_CA
  61. value: "{{ default "" .Values.postgresql.ca }}"
  62. - name: DB_PASS
  63. valueFrom:
  64. secretKeyRef:
  65. {{- if .Values.postgresql.existingSecret }}
  66. name: {{ .Values.postgresql.existingSecret }}
  67. {{- else }}
  68. name: {{ template "wiki.postgresql.secret" . }}
  69. {{- end }}
  70. key: {{ template "wiki.postgresql.secretKey" . }}
  71. {{- end }}
  72. - name: HA_ACTIVE
  73. value: {{ .Values.replicaCount | int | le 2 | quote }}
  74. {{- with .Values.volumeMounts }}
  75. volumeMounts:
  76. {{- toYaml . | nindent 12 }}
  77. {{- end }}
  78. ports:
  79. - name: http
  80. containerPort: 3000
  81. protocol: TCP
  82. livenessProbe:
  83. {{- toYaml .Values.livenessProbe | nindent 12 }}
  84. readinessProbe:
  85. {{- toYaml .Values.readinessProbe | nindent 12 }}
  86. startupProbe:
  87. {{- toYaml .Values.startupProbe | nindent 12 }}
  88. resources:
  89. {{- toYaml .Values.resources | nindent 12 }}
  90. {{- with .Values.nodeSelector }}
  91. nodeSelector:
  92. {{- toYaml . | nindent 8 }}
  93. {{- end }}
  94. {{- with .Values.affinity }}
  95. affinity:
  96. {{- toYaml . | nindent 8 }}
  97. {{- end }}
  98. {{- with .Values.tolerations }}
  99. tolerations:
  100. {{- toYaml . | nindent 8 }}
  101. {{- end }}
  102. {{- with .Values.volumes }}
  103. volumes:
  104. {{- toYaml . | nindent 8 }}
  105. {{- end }}