coins-deployment.yaml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. {{- $ref := . }}
  2. {{- range $coinName := $ref.Values.coins }}
  3. {{- $coinEnabled := get $ref.Values (printf "%vEnabled" $coinName) }}
  4. {{- if $coinEnabled }}
  5. {{- $coin := get $ref.Values $coinName }}
  6. {{- $_ := set $ref "common" (dict "nameSuffix" $coinName) }}
  7. {{- $_ := set $coin.volumeMounts "plots" $ref.Values.appVolumeMounts.plots }}
  8. {{- $_ := set $coin.volumeMounts "plotting" $ref.Values.appVolumeMounts.plotting }}
  9. apiVersion: {{ template "common.capabilities.deployment.apiVersion" $ref }}
  10. kind: Deployment
  11. metadata:
  12. name: {{ template "common.names.fullname" $ref }}
  13. labels: {{ include "common.labels" $ref | nindent 4 }}
  14. spec:
  15. strategy:
  16. type: {{ $ref.Values.updateStrategy }}
  17. selector:
  18. matchLabels: {{ include "common.labels.selectorLabels" $ref | nindent 6 }}
  19. template:
  20. metadata:
  21. name: {{ template "common.names.fullname" $ref }}
  22. labels: {{ include "common.labels.selectorLabels" $ref | nindent 8 }}
  23. spec:
  24. hostNetwork: true
  25. {{- include "initContainers" (dict "nodeIP" $ref.Values.nodeIP "apiPort" $ref.Values.machinarisApiPort "coinName" $coinName ) | nindent 6 }}
  26. containers:
  27. - name: {{ $ref.Chart.Name }}
  28. {{- include "resourceLimits" $ref | nindent 10 }}
  29. tty: true
  30. {{ include "common.containers.imageConfig" (dict "repository" $ref.Values.image.repository "tag" $ref.Values.image.tag "pullPolicy" $ref.Values.image.pullPolicy "postfix" $ref.common.nameSuffix) | nindent 10 }}
  31. {{ include "common.containers.configurePorts" $coin | nindent 10 }}
  32. volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" (dict "appVolumeMounts" $coin.volumeMounts "ixVolumes" $ref.Values.ixVolumes) | nindent 12 }}
  33. {{ range $index, $hostPathConfiguration := $ref.Values.extraAppVolumeMounts }}
  34. - name: extrappvolume-{{ $index }}
  35. mountPath: {{ $hostPathConfiguration.mountPath }}
  36. {{ end }}
  37. {{ include "allEnvironmentVariables" (dict "defaultEnv" (dict "TZ" $ref.Values.timezone "worker_address" $ref.Values.nodeIP "worker_api_port" $coin.apiPort "controller_host" $ref.Values.nodeIP "controller_api_port" $ref.Values.apiPort "farmer_port" $coin.farmerPort "blockchains" $coinName "plots_dir" $ref.Values.appVolumeMounts.plots.mountPath "mode" "fullnode") "environmentVariables" $coin.environmentVariables) | nindent 10 }}
  38. volumes: {{ include "common.storage.configureAppVolumes" (dict "appVolumeMounts" $coin.volumeMounts "ixVolumes" $ref.Values.ixVolumes) | nindent 8 }}
  39. {{ range $index, $hostPathConfiguration := $ref.Values.extraAppVolumeMounts }}
  40. - name: extrappvolume-{{ $coinName }}-{{ $index }}
  41. hostPath:
  42. path: {{ $hostPathConfiguration.hostPath }}
  43. {{ end }}
  44. ---
  45. {{- end }}
  46. {{- end }}