83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "minecraft.fullname" . }}
|
|
labels:
|
|
{{- include "minecraft.labels" . | nindent 4 }}
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate # Avoid parallel access to the volume
|
|
selector:
|
|
matchLabels:
|
|
{{- include "minecraft.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
{{- with .Values.podAnnotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "minecraft.selectorLabels" . | nindent 8 }}
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: default
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
terminationGracePeriodSeconds: 30
|
|
volumes:
|
|
- name: minecraft
|
|
persistentVolumeClaim:
|
|
claimName: {{ include "minecraft.fullname" . }}
|
|
initContainers:
|
|
- name: download
|
|
image: alpine:3.12.1
|
|
imagePullPolicy: IfNotPresent
|
|
command:
|
|
- sh
|
|
- -c
|
|
- '[[ ! -d /minecraft/world ]] && wget -O- "{{ .Values.downloadURL }}" | tar -x --strip-components=1 -C /minecraft || true'
|
|
volumeMounts:
|
|
- name: minecraft
|
|
mountPath: /minecraft
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 64Mi
|
|
limits:
|
|
cpu: 100m
|
|
memory: 64Mi
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
env:
|
|
- name: JAVA_OPTS
|
|
value: '-Xms3500m -Xmx3500m'
|
|
volumeMounts:
|
|
- name: minecraft
|
|
mountPath: /minecraft
|
|
ports:
|
|
- containerPort: 25565
|
|
name: minecraft
|
|
protocol: TCP
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|