---
source: packages/shulker-operator/src/reconcilers/minecraft_server/gameserver.rs
expression: game_server
---
apiVersion: agones.dev/v1
kind: GameServer
metadata:
  annotations:
    minecraftserver.shulkermc.io/tags: lobby
  labels:
    app.kubernetes.io/component: minecraft-server
    app.kubernetes.io/instance: minecraft-server-my-server
    app.kubernetes.io/managed-by: shulker-operator
    app.kubernetes.io/name: minecraft-server
    app.kubernetes.io/part-of: cluster-my-cluster
    minecraftcluster.shulkermc.io/name: my-cluster
  name: my-server
  namespace: default
spec:
  ports: []
  health:
    disabled: false
    periodSeconds: 15
    failureThreshold: 5
    initialDelaySeconds: 30
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-container: minecraft-server
      labels:
        app.kubernetes.io/component: minecraft-server
        app.kubernetes.io/instance: minecraft-server-my-server
        app.kubernetes.io/managed-by: shulker-operator
        app.kubernetes.io/name: minecraft-server
        app.kubernetes.io/part-of: cluster-my-cluster
        minecraftcluster.shulkermc.io/name: my-cluster
    spec:
      containers:
        - env:
            - name: SHULKER_SERVER_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: SHULKER_SERVER_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: SHULKER_NETWORK_ADMINS
              value: ""
            - name: SHULKER_SERVER_LIFECYCLE_STRATEGY
              value: AllocateWhenNotEmpty
            - name: EULA
              value: "TRUE"
            - name: COPY_CONFIG_DEST
              value: /data
            - name: SYNC_SKIP_NEWER_IN_DESTINATION
              value: "true"
            - name: SKIP_SERVER_PROPERTIES
              value: "true"
            - name: REPLACE_ENV_IN_PLACE
              value: "true"
            - name: REPLACE_ENV_VARIABLE_PREFIX
              value: CFG_
            - name: CFG_VELOCITY_FORWARDING_SECRET
              valueFrom:
                secretKeyRef:
                  key: key
                  name: my-cluster-forwarding-secret
            - name: MEMORY
              value: ""
            - name: JVM_XX_OPTS
              value: "-XX:MaxRAMPercentage=75"
            - name: TYPE
              value: PAPER
            - name: VERSION
              value: 1.20.1
            - name: EXTRA_ENV
              value: my_value
          image: "itzg/minecraft-server:2024.7.2-java21"
          imagePullPolicy: IfNotPresent
          name: minecraft-server
          ports:
            - containerPort: 25565
              name: minecraft
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
          volumeMounts:
            - mountPath: /config
              name: server-config
            - mountPath: /data
              name: server-data
            - mountPath: /tmp
              name: server-tmp
      initContainers:
        - command:
            - sh
            - /mnt/shulker/config/init-fs.sh
          env:
            - name: SHULKER_CONFIG_DIR
              value: /mnt/shulker/config
            - name: SHULKER_SERVER_CONFIG_DIR
              value: /config
            - name: SHULKER_SERVER_DATA_DIR
              value: /data
            - name: SHULKER_VERSION_CHANNEL
              value: Paper
            - name: SHULKER_SERVER_WORLD_URL
              value: "https://example.com/my_world.tar.gz"
            - name: SHULKER_SERVER_PLUGIN_URLS
              value: "https://maven.jeremylvln.fr/repository/shulker-snapshots/io/shulkermc/shulker-server-agent/0.0.0-test-cfg/shulker-server-agent-0.0.0-test-cfg-paper.jar;https://example.com/my_plugin.jar"
            - name: SHULKER_SERVER_PATCH_URLS
              value: "https://example.com/my_patch.tar.gz"
          image: "alpine:latest"
          name: init-fs
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
          volumeMounts:
            - mountPath: /mnt/shulker/config
              name: shulker-config
              readOnly: true
            - mountPath: /config
              name: server-config
      nodeSelector:
        beta.kubernetes.io/os: linux
      restartPolicy: Never
      serviceAccountName: shulker-my-cluster-server
      subdomain: my-cluster-cluster
      volumes:
        - configMap:
            name: my-server-config
          name: shulker-config
        - emptyDir: {}
          name: server-config
        - emptyDir: {}
          name: server-data
        - emptyDir: {}
          name: server-tmp
  eviction:
    safe: OnUpgrade
