deployment.yaml 3.5 KB

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