_minecraft.tpl 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. {{- define "minecraft.workload" -}}
  2. workload:
  3. minecraft:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.mcNetwork.hostNetwork }}
  9. securityContext:
  10. fsGroup: {{ .Values.mcID.group }}
  11. containers:
  12. minecraft:
  13. enabled: true
  14. primary: true
  15. tty: true
  16. stdin: true
  17. imageSelector: {{ .Values.mcConfig.imageSelector }}
  18. securityContext:
  19. runAsUser: 0
  20. runAsGroup: 0
  21. readOnlyRootFilesystem: false
  22. runAsNonRoot: false
  23. capabilities:
  24. add:
  25. - CHOWN
  26. - DAC_OVERRIDE
  27. - FOWNER
  28. - SETUID
  29. - SETGID
  30. fixedEnv:
  31. PUID: {{ .Values.mcID.user }}
  32. envFrom:
  33. - configMapRef:
  34. name: minecraft-config
  35. {{ with .Values.mcConfig.additionalEnvs }}
  36. envList:
  37. {{ range $env := . }}
  38. - name: {{ $env.name }}
  39. value: {{ $env.value }}
  40. {{ end }}
  41. {{ end }}
  42. probes:
  43. liveness:
  44. enabled: true
  45. type: exec
  46. command: mc-health
  47. readiness:
  48. enabled: true
  49. type: exec
  50. command: mc-health
  51. startup:
  52. enabled: true
  53. type: exec
  54. command: mc-health
  55. initialDelaySeconds: 120
  56. {{/* Service */}}
  57. service:
  58. minecraft:
  59. enabled: true
  60. primary: true
  61. type: NodePort
  62. targetSelector: minecraft
  63. ports:
  64. server:
  65. enabled: true
  66. primary: true
  67. port: {{ .Values.mcNetwork.serverPort }}
  68. nodePort: {{ .Values.mcNetwork.serverPort }}
  69. targetSelector: minecraft
  70. rcon:
  71. enabled: {{ .Values.mcConfig.enableRcon }}
  72. port: {{ .Values.mcNetwork.rconPort }}
  73. nodePort: {{ .Values.mcNetwork.rconPort }}
  74. targetSelector: minecraft
  75. {{/* Persistence */}}
  76. persistence:
  77. data:
  78. enabled: true
  79. {{- include "minecraft.storage.ci.migration" (dict "storage" .Values.mcStorage.data) }}
  80. {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.mcStorage.data) | nindent 4 }}
  81. targetSelector:
  82. minecraft:
  83. minecraft:
  84. mountPath: /data
  85. {{- range $idx, $storage := .Values.mcStorage.additionalStorages }}
  86. {{ printf "mc-%v" (int $idx) }}:
  87. enabled: true
  88. {{- include "minecraft.storage.ci.migration" (dict "storage" $storage) }}
  89. {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
  90. targetSelector:
  91. minecraft:
  92. minecraft:
  93. mountPath: {{ $storage.mountPath }}
  94. {{- end }}
  95. {{- end -}}
  96. {{/* TODO: Remove on the next version bump, eg 1.2.0+ */}}
  97. {{- define "minecraft.storage.ci.migration" -}}
  98. {{- $storage := .storage -}}
  99. {{- if $storage.hostPath -}}
  100. {{- $_ := set $storage "hostPathConfig" dict -}}
  101. {{- $_ := set $storage.hostPathConfig "hostPath" $storage.hostPath -}}
  102. {{- end -}}
  103. {{- end -}}