deployment.yaml 4.2 KB

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