vminsert-deployment.yaml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. {{- $app := .Values.vminsert -}}
  2. {{- if $app.enabled -}}
  3. {{- $ctx := dict "helm" . "appKey" "vminsert" }}
  4. {{- $fullname := include "vm.plain.fullname" $ctx }}
  5. {{- $sa := include "vm.fullname" $ctx }}
  6. {{- $ns := include "vm.namespace" $ctx }}
  7. apiVersion: apps/v1
  8. kind: Deployment
  9. metadata:
  10. {{- with $app.annotations }}
  11. annotations: {{ toYaml . | nindent 4 }}
  12. {{- end }}
  13. {{- $_ := set $ctx "extraLabels" $app.extraLabels }}
  14. labels: {{ include "vm.labels" $ctx | nindent 4 }}
  15. {{- $_ := unset $ctx "extraLabels" }}
  16. name: {{ $fullname }}
  17. namespace: {{ $ns }}
  18. spec:
  19. selector:
  20. matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
  21. {{- if not $app.horizontalPodAutoscaler.enabled }}
  22. replicas: {{ $app.replicaCount }}
  23. {{- end }}
  24. {{- with $app.strategy }}
  25. strategy: {{ toYaml . | nindent 4 }}
  26. {{- end }}
  27. template:
  28. metadata:
  29. {{- with $app.podAnnotations }}
  30. annotations: {{ toYaml . | nindent 8 }}
  31. {{- end }}
  32. {{- $_ := set $ctx "extraLabels" $app.podLabels }}
  33. labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
  34. spec:
  35. {{- with $app.priorityClassName }}
  36. priorityClassName: {{ . }}
  37. {{- end }}
  38. {{- with $app.initContainers }}
  39. initContainers: {{ toYaml . | nindent 8 }}
  40. {{- end }}
  41. {{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
  42. imagePullSecrets: {{ toYaml . | nindent 8 }}
  43. {{- end }}
  44. containers:
  45. - name: vminsert
  46. {{- $_ := set $ctx "app" $app }}
  47. image: {{ include "vm.image" $ctx }}
  48. imagePullPolicy: {{ $app.image.pullPolicy }}
  49. {{- with $app.containerWorkingDir }}
  50. workingDir: {{ . }}
  51. {{- end }}
  52. {{- if $app.securityContext.enabled }}
  53. securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
  54. {{- end }}
  55. args: {{ include "vminsert.args" . | nindent 12 }}
  56. {{- with $app.envFrom }}
  57. envFrom: {{ toYaml . | nindent 12 }}
  58. {{- end }}
  59. {{- with $app.env }}
  60. env: {{ toYaml . | nindent 12 }}
  61. {{- end }}
  62. ports:
  63. - name: {{ $app.ports.name | default "http" }}
  64. containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.httpListenAddr "default" "8480") }}
  65. {{- with $app.extraArgs.clusternativeListenAddr }}
  66. - name: cluster-tcp
  67. protocol: TCP
  68. containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
  69. {{- end }}
  70. {{- with $app.extraArgs.graphiteListenAddr }}
  71. - name: graphite-tcp
  72. protocol: TCP
  73. containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
  74. - name: graphite-udp
  75. protocol: UDP
  76. containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
  77. {{- end }}
  78. {{- with $app.extraArgs.influxListenAddr }}
  79. - name: influx-tcp
  80. protocol: TCP
  81. containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
  82. - name: influx-udp
  83. protocol: UDP
  84. containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
  85. {{- end }}
  86. {{- with $app.extraArgs.opentsdbHTTPListenAddr }}
  87. - name: opentsdbhttp
  88. protocol: TCP
  89. containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
  90. {{- end }}
  91. {{- with $app.extraArgs.opentsdbListenAddr }}
  92. - name: opentsdb-tcp
  93. protocol: TCP
  94. containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
  95. - name: opentsdb-udp
  96. protocol: UDP
  97. containerPort: {{ include "vm.port.from.flag" (dict "flag" .) }}
  98. {{- end }}
  99. {{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "readiness"))) }}
  100. readinessProbe: {{ toYaml . | nindent 12 }}
  101. {{- end }}
  102. {{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "liveness"))) }}
  103. livenessProbe: {{ toYaml . | nindent 12 }}
  104. {{- end }}
  105. {{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "startup"))) }}
  106. startupProbe: {{ toYaml . | nindent 12 }}
  107. {{- end }}
  108. {{- if or $app.extraVolumeMounts (include "vm.license.mount" .) }}
  109. volumeMounts:
  110. {{- with $app.extraVolumeMounts }}
  111. {{- toYaml . | nindent 12 }}
  112. {{- end }}
  113. {{- include "vm.license.mount" . | nindent 12 }}
  114. {{- end }}
  115. {{- with $app.resources }}
  116. resources: {{ toYaml . | nindent 12 }}
  117. {{- end }}
  118. {{- with $app.extraContainers }}
  119. {{- toYaml . | nindent 8 }}
  120. {{- end }}
  121. {{- with $app.nodeSelector }}
  122. nodeSelector: {{ toYaml . | nindent 8 }}
  123. {{- end }}
  124. {{- if $app.podSecurityContext.enabled }}
  125. securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
  126. {{- end }}
  127. {{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
  128. automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
  129. serviceAccountName: {{ (.Values.serviceAccount).name | default $sa }}
  130. {{- end }}
  131. {{- with $app.tolerations }}
  132. tolerations: {{ toYaml . | nindent 8 }}
  133. {{- end }}
  134. {{- with $app.affinity }}
  135. affinity: {{ toYaml . | nindent 8 }}
  136. {{- end }}
  137. {{- with $app.topologySpreadConstraints }}
  138. topologySpreadConstraints: {{ toYaml . | nindent 8 }}
  139. {{- end }}
  140. {{- if or (and (include "vm.license.secret.key" .) (include "vm.license.secret.name" .)) $app.extraVolumes }}
  141. volumes:
  142. {{- with $app.extraVolumes }}
  143. {{- toYaml . | nindent 8 }}
  144. {{- end }}
  145. {{- include "vm.license.volume" . | nindent 8 }}
  146. {{- end }}
  147. {{- end }}