deployment.yaml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. securityContext:
  41. capabilities:
  42. {{ if .Values.hostNetwork }}
  43. {{/* This is needed to be able to bind 53(DNS) and 67(DHCP) ports */}}
  44. add: ["NET_ADMIN"]
  45. {{ else }}
  46. add: []
  47. {{ end }}
  48. ports:
  49. - name: web
  50. containerPort: {{ .Values.web_port }}
  51. - name: dns-tcp
  52. containerPort: 53
  53. protocol: TCP
  54. - name: dns-udp
  55. containerPort: 53
  56. protocol: UDP
  57. {{ if .Values.dhcp }}
  58. - name: dhcp
  59. containerPort: 67
  60. protocol: UDP
  61. {{ end }}
  62. readinessProbe:
  63. httpGet:
  64. path: /admin/login.php
  65. port: {{ .Values.web_port }}
  66. initialDelaySeconds: 10
  67. periodSeconds: 10
  68. timeoutSeconds: 5
  69. failureThreshold: 5
  70. successThreshold: 2
  71. livenessProbe:
  72. httpGet:
  73. path: /admin/login.php
  74. port: {{ .Values.web_port }}
  75. initialDelaySeconds: 10
  76. periodSeconds: 10
  77. timeoutSeconds: 5
  78. failureThreshold: 5
  79. successThreshold: 1
  80. startupProbe:
  81. httpGet:
  82. path: /admin/login.php
  83. port: {{ .Values.web_port }}
  84. initialDelaySeconds: 10
  85. periodSeconds: 5
  86. timeoutSeconds: 2
  87. failureThreshold: 60
  88. successThreshold: 1
  89. env:
  90. {{ $secretName := (include "common.names.fullname" .) }}
  91. {{ $envList := (default list .Values.environmentVariables) }}
  92. {{ $envList = mustAppend $envList (dict "name" "WEBPASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "password") }}
  93. {{ $envList = mustAppend $envList (dict "name" "TZ" "value" (printf "%s" .Values.timezone)) }}
  94. {{ $envList = mustAppend $envList (dict "name" "WEB_PORT" "value" .Values.web_port) }}
  95. {{ if .Values.dhcp }}
  96. {{ $envList = mustAppend $envList (dict "name" "DHCP_ACTIVE" "value" "true") }}
  97. {{ $envList = mustAppend $envList (dict "name" "DHCP_START" "value" .Values.dhcp_start) }}
  98. {{ $envList = mustAppend $envList (dict "name" "DHCP_END" "value" .Values.dhcp_end) }}
  99. {{ $envList = mustAppend $envList (dict "name" "DHCP_ROUTER" "value" .Values.dhcp_gateway) }}
  100. {{ end }}
  101. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
  102. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  103. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  104. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  105. - name: extrappvolume-{{ $index }}
  106. hostPath:
  107. path: {{ $hostPathConfiguration.hostPath }}
  108. {{ end }}