deployment.yaml 3.5 KB

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