_minecraft.tpl 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. enabled: true
  89. type: {{ $storage.type }}
  90. datasetName: {{ $storage.datasetName | default "" }}
  91. hostPath: {{ $storage.hostPath | default "" }}
  92. targetSelector:
  93. minecraft:
  94. minecraft:
  95. mountPath: {{ $storage.mountPath }}
  96. {{- end }}
  97. {{- end -}}