deployment.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. {{- if .Values.nodeExtraCaCerts }}
  43. - name: NODE_EXTRA_CA_CERTS
  44. value: {{ .Values.nodeExtraCaCerts }}
  45. {{- end }}
  46. - name: DB_TYPE
  47. value: postgres
  48. {{- if (.Values.externalPostgresql).databaseURL }}
  49. - name: DATABASE_URL
  50. value: {{ .Values.externalPostgresql.databaseURL }}
  51. - name: NODE_TLS_REJECT_UNAUTHORIZED
  52. value: {{ default "1" .Values.externalPostgresql.NODE_TLS_REJECT_UNAUTHORIZED | quote }}
  53. {{- else }}
  54. - name: DB_HOST
  55. value: {{ template "wiki.postgresql.host" . }}
  56. - name: DB_PORT
  57. value: "{{ default "5432" .Values.postgresql.postgresqlPort }}"
  58. - name: DB_NAME
  59. value: {{ default "wiki" .Values.postgresql.postgresqlDatabase }}
  60. - name: DB_USER
  61. value: {{ default "wiki" .Values.postgresql.postgresqlUser }}
  62. - name: DB_SSL
  63. value: "{{ default "false" .Values.postgresql.ssl }}"
  64. - name: DB_SSL_CA
  65. value: "{{ default "" .Values.postgresql.ca }}"
  66. - name: DB_PASS
  67. valueFrom:
  68. secretKeyRef:
  69. {{- if .Values.postgresql.existingSecret }}
  70. name: {{ .Values.postgresql.existingSecret }}
  71. {{- else }}
  72. name: {{ template "wiki.postgresql.secret" . }}
  73. {{- end }}
  74. key: {{ template "wiki.postgresql.secretKey" . }}
  75. {{- end }}
  76. - name: HA_ACTIVE
  77. value: {{ .Values.replicaCount | int | le 2 | quote }}
  78. {{- with .Values.volumeMounts }}
  79. volumeMounts:
  80. {{- toYaml . | nindent 12 }}
  81. {{- end }}
  82. ports:
  83. - name: http
  84. containerPort: 3000
  85. protocol: TCP
  86. livenessProbe:
  87. {{- toYaml .Values.livenessProbe | nindent 12 }}
  88. readinessProbe:
  89. {{- toYaml .Values.readinessProbe | nindent 12 }}
  90. startupProbe:
  91. {{- toYaml .Values.startupProbe | nindent 12 }}
  92. resources:
  93. {{- toYaml .Values.resources | nindent 12 }}
  94. {{- with .Values.nodeSelector }}
  95. nodeSelector:
  96. {{- toYaml . | nindent 8 }}
  97. {{- end }}
  98. {{- with .Values.affinity }}
  99. affinity:
  100. {{- toYaml . | nindent 8 }}
  101. {{- end }}
  102. {{- with .Values.tolerations }}
  103. tolerations:
  104. {{- toYaml . | nindent 8 }}
  105. {{- end }}
  106. {{- with .Values.volumes }}
  107. volumes:
  108. {{- toYaml . | nindent 8 }}
  109. {{- end }}