deployment.yaml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {{ include "common.storage.hostPathValidate" .Values }}
  2. apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
  3. kind: Deployment
  4. metadata:
  5. name: {{ template "common.names.fullname" . }}
  6. labels:
  7. app: {{ template "common.names.name" . }}
  8. chart: {{ template "common.names.chart" . }}
  9. release: {{ .Release.Name }}
  10. heritage: {{ .Release.Service }}
  11. annotations:
  12. rollme: {{ randAlphaNum 5 | quote }}
  13. spec:
  14. replicas: {{ (default 1 .Values.replicas) }}
  15. strategy:
  16. type: "Recreate"
  17. selector:
  18. matchLabels:
  19. app: {{ template "common.names.name" . }}
  20. release: {{ .Release.Name }}
  21. template:
  22. metadata:
  23. name: {{ template "common.names.fullname" . }}
  24. labels:
  25. app: {{ template "common.names.name" . }}
  26. release: {{ .Release.Name }}
  27. {{- include "common.labels.selectorLabels" . | nindent 8 }}
  28. annotations: {{ include "common.annotations" . | nindent 8 }}
  29. spec:
  30. hostNetwork: {{ .Values.hostNetwork }}
  31. containers:
  32. - name: {{ .Chart.Name }}
  33. {{ include "common.resources.limitation" . | nindent 10 }}
  34. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  35. volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
  36. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  37. - name: extrappvolume-{{ $index }}
  38. mountPath: {{ $hostPathConfiguration.mountPath }}
  39. {{ end }}
  40. ports:
  41. - name: web
  42. containerPort: 80
  43. - name: dns-tcp
  44. containerPort: 53
  45. protocol: TCP
  46. - name: dns-udp
  47. containerPort: 53
  48. protocol: UDP
  49. {{ if .Values.dhcp }}
  50. - name: dhcp
  51. containerPort: 67
  52. protocol: UDP
  53. {{ end }}
  54. env:
  55. {{ $secretName := (include "common.names.fullname" .) }}
  56. {{ $envList := (default list .Values.environmentVariables) }}
  57. {{ $envList = mustAppend $envList (dict "name" "WEBPASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "password") }}
  58. {{ $envList = mustAppend $envList (dict "name" "TZ" "value" (printf "%s" .Values.timezone)) }}
  59. {{ if .Values.dhcp }}
  60. {{ $envList = mustAppend $envList (dict "name" "DHCP_ACTIVE" "value" "true") }}
  61. {{ end }}
  62. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
  63. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  64. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  65. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  66. - name: extrappvolume-{{ $index }}
  67. hostPath:
  68. path: {{ $hostPathConfiguration.hostPath }}
  69. {{ end }}