charts/zombi/minecraft/templates/deployment.yaml
2021-01-29 16:37:42 +01:00

79 lines
2.4 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
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: {{ include "minecraft.fullname" . }}
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: {{ include "minecraft.fullname" . }}
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 }}