deployment.yaml 4.4 KB

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