_minecraft.tpl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. type: {{ .Values.mcStorage.data.type }}
  80. datasetName: {{ .Values.mcStorage.data.datasetName | default "" }}
  81. hostPath: {{ .Values.mcStorage.data.hostPath | default "" }}
  82. targetSelector:
  83. minecraft:
  84. minecraft:
  85. mountPath: /data
  86. {{- range $idx, $storage := .Values.mcStorage.additionalStorages }}
  87. {{ printf "mc-%v" (int $idx) }}:
  88. {{- $size := "" -}}
  89. {{- if $storage.size -}}
  90. {{- $size = (printf "%vGi" $storage.size) -}}
  91. {{- end }}
  92. enabled: true
  93. type: {{ $storage.type }}
  94. datasetName: {{ $storage.datasetName | default "" }}
  95. hostPath: {{ $storage.hostPath | default "" }}
  96. server: {{ $storage.server | default "" }}
  97. share: {{ $storage.share | default "" }}
  98. domain: {{ $storage.domain | default "" }}
  99. username: {{ $storage.username | default "" }}
  100. password: {{ $storage.password | default "" }}
  101. size: {{ $size }}
  102. {{- if eq $storage.type "smb-pv-pvc" }}
  103. mountOptions:
  104. - key: noperm
  105. {{- end }}
  106. targetSelector:
  107. minecraft:
  108. minecraft:
  109. mountPath: {{ $storage.mountPath }}
  110. {{- end }}
  111. {{- end -}}