diff --git a/kubernetes/apps/gaming/kustomization.yaml b/kubernetes/apps/gaming/kustomization.yaml index def78672d..2d53fdd61 100644 --- a/kubernetes/apps/gaming/kustomization.yaml +++ b/kubernetes/apps/gaming/kustomization.yaml @@ -5,7 +5,7 @@ resources: - ./namespace.yaml - ./_pvc/ks.yaml - ./romm/ks.yaml - # - ./agones/ks.yaml - # - ./shulker/ks.yaml + - ./agones/ks.yaml + - ./shulker/ks.yaml - ./satisfactory/ks.yaml # - ./ownfoil/ks.yaml diff --git a/kubernetes/apps/gaming/shulker/cluster/cobblemon.yaml b/kubernetes/apps/gaming/shulker/cluster/cobblemon.yaml index 6dbe35cc7..9611fdfde 100644 --- a/kubernetes/apps/gaming/shulker/cluster/cobblemon.yaml +++ b/kubernetes/apps/gaming/shulker/cluster/cobblemon.yaml @@ -1,38 +1,43 @@ --- apiVersion: shulkermc.io/v1alpha1 -kind: MinecraftServerFleet +kind: MinecraftServer metadata: name: minecraft-cobblemon spec: clusterRef: name: minecraft-cluster - replicas: 1 - template: - spec: - clusterRef: - name: minecraft-cluster - tags: - - minecraft-cobblemon - version: - channel: Paper - name: "1.20.1" - config: - serverProperties: - enforce-whitelist: "true" - max-players: "8" - gamemode: "survival" - difficulty: "easy" - podOverrides: - resources: - requests: - memory: 2000Mi - cpu: 100m - limits: - memory: 4000Mi - env: - - name: MOD_PLATFORM - value: MODRINTH - - name: MODRINTH_MODPACK - value: https://modrinth.com/modpack/cobblemon-fabric/version/1.5 - - name: JVM_XX_OPTS - value: "-XX:MaxRAMPercentage=75" + tags: + - minecraft-cobblemon + version: + channel: Paper + name: "1.20.1" + config: + serverProperties: + enforce-whitelist: "true" + max-players: "8" + gamemode: "survival" + difficulty: "easy" + podOverrides: + volumeMounts: + - name: cobblemon + mountPath: /mnt/path + volumes: + - name: cobblemon + persistentVolumeClaim: + claimName: minecraft-cobblemon + resources: + requests: + memory: 2000Mi + cpu: 100m + limits: + memory: 4000Mi + env: + - name: MOD_PLATFORM + value: MODRINTH + - name: MODRINTH_MODPACK + value: https://modrinth.com/modpack/cobblemon-fabric/version/1.5.2 + - name: JVM_XX_OPTS + value: "-XX:MaxRAMPercentage=75" + image: + imagePullSecrets: [] + name: "itzg/minecraft-server:java17@sha256:c0fde979d35a726e17fdafafc6e4ef1b50aa711e576bc76c9de4f2e916577177" diff --git a/kubernetes/apps/gaming/shulker/cluster/kustomization.yaml b/kubernetes/apps/gaming/shulker/cluster/kustomization.yaml index 58bbb2f00..163951573 100644 --- a/kubernetes/apps/gaming/shulker/cluster/kustomization.yaml +++ b/kubernetes/apps/gaming/shulker/cluster/kustomization.yaml @@ -3,6 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: gaming resources: + - ./volsync.yaml - ./cluster.yaml - ./proxy.yaml - ./lobby.yaml diff --git a/kubernetes/apps/gaming/shulker/cluster/lobby.yaml b/kubernetes/apps/gaming/shulker/cluster/lobby.yaml index 576acf753..af80fea3a 100644 --- a/kubernetes/apps/gaming/shulker/cluster/lobby.yaml +++ b/kubernetes/apps/gaming/shulker/cluster/lobby.yaml @@ -11,6 +11,22 @@ spec: spec: clusterRef: name: minecraft-cluster + podOverrides: + volumeMounts: + - name: lobby + mountPath: /mnt/path + volumes: + - name: lobby + persistentVolumeClaim: + claimName: minecraft-lobby + env: + - name: DIFFICULTY + value: "easy" + - name: ENABLE_WHITELIST + value: "true" + image: + imagePullSecrets: [] + name: "itzg/minecraft-server:java17@sha256:c0fde979d35a726e17fdafafc6e4ef1b50aa711e576bc76c9de4f2e916577177" tags: - minecraft-lobby version: diff --git a/kubernetes/apps/gaming/shulker/cluster/proxy.yaml b/kubernetes/apps/gaming/shulker/cluster/proxy.yaml index 0e6ec6c4c..a8037a650 100644 --- a/kubernetes/apps/gaming/shulker/cluster/proxy.yaml +++ b/kubernetes/apps/gaming/shulker/cluster/proxy.yaml @@ -9,9 +9,9 @@ spec: replicas: 1 service: type: LoadBalancer - externalTrafficPolicy: Local annotations: io.cilium/lb-ipam-ips: "${MINECRAFT_LB_IP}" + coredns.io/hostname: minecraft.${PRIVATE_DOMAIN} service.beta.kubernetes.io/scw-loadbalancer-proxy-protocol-v2: "true" service.beta.kubernetes.io/scw-loadbalancer-use-hostname: "true" reloader.stakater.com/auto: "true" diff --git a/kubernetes/apps/gaming/shulker/cluster/volsync.yaml b/kubernetes/apps/gaming/shulker/cluster/volsync.yaml new file mode 100644 index 000000000..15caa3418 --- /dev/null +++ b/kubernetes/apps/gaming/shulker/cluster/volsync.yaml @@ -0,0 +1,170 @@ +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: minecraft-cobblemon-restic +spec: + secretStoreRef: + kind: ClusterSecretStore + name: onepassword-connect + target: + name: minecraft-cobblemon-restic-secret + creationPolicy: Owner + template: + engineVersion: v2 + data: + RESTIC_REPOSITORY: "{{ .REPOSITORY_TEMPLATE }}/minecraft-cobblemon" + RESTIC_PASSWORD: "{{ .RESTIC_PASSWORD }}" + AWS_ACCESS_KEY_ID: "{{ .AWS_ACCESS_KEY_ID }}" + AWS_SECRET_ACCESS_KEY: "{{ .AWS_SECRET_ACCESS_KEY }}" + dataFrom: + - extract: + key: volsync-restic-template +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: minecraft-cobblemon +spec: + accessModes: ["ReadWriteOnce"] + dataSourceRef: + kind: ReplicationDestination + apiGroup: volsync.backube + name: minecraft-cobblemon-rdst + resources: + requests: + storage: 5Gi + storageClassName: ${CLUSTER_STORAGE_BLOCK} +--- +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationDestination +metadata: + name: minecraft-cobblemon-rdst +spec: + trigger: + manual: restore-once + restic: + repository: minecraft-cobblemon-restic-secret + copyMethod: Snapshot + accessModes: ["ReadWriteOnce"] + storageClassName: ${CLUSTER_STORAGE_BLOCK} + volumeSnapshotClassName: ${CLUSTER_SNAPSHOT_BLOCK} + cacheAccessModes: ["ReadWriteOnce"] + cacheCapacity: 8Gi + cacheStorageClassName: ${CLUSTER_STORAGE_HOSTPATH} + moverSecurityContext: + runAsUser: 568 + runAsGroup: 568 + fsGroup: 568 + capacity: 5Gi # must match the PersistentVolumeClaim `.resources.requests.storage` size above +--- +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationSource +metadata: + name: minecraft-cobblemon-rsrc +spec: + sourcePVC: minecraft-cobblemon + trigger: + schedule: "15 */8 * * *" + restic: + pruneIntervalDays: 10 + repository: minecraft-cobblemon-restic-secret + copyMethod: Snapshot + accessModes: ["ReadWriteOnce"] + storageClassName: ${CLUSTER_STORAGE_BLOCK} + volumeSnapshotClassName: ${CLUSTER_SNAPSHOT_BLOCK} + cacheAccessModes: ["ReadWriteOnce"] + cacheCapacity: 8Gi + cacheStorageClassName: ${CLUSTER_STORAGE_HOSTPATH} + moverSecurityContext: + runAsUser: 568 + runAsGroup: 568 + fsGroup: 568 + retain: + daily: 10 + within: 3d +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: minecraft-lobby-restic +spec: + secretStoreRef: + kind: ClusterSecretStore + name: onepassword-connect + target: + name: minecraft-lobby-restic-secret + creationPolicy: Owner + template: + engineVersion: v2 + data: + RESTIC_REPOSITORY: "{{ .REPOSITORY_TEMPLATE }}/minecraft-lobby" + RESTIC_PASSWORD: "{{ .RESTIC_PASSWORD }}" + AWS_ACCESS_KEY_ID: "{{ .AWS_ACCESS_KEY_ID }}" + AWS_SECRET_ACCESS_KEY: "{{ .AWS_SECRET_ACCESS_KEY }}" + dataFrom: + - extract: + key: volsync-restic-template +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: minecraft-lobby +spec: + accessModes: ["ReadWriteOnce"] + dataSourceRef: + kind: ReplicationDestination + apiGroup: volsync.backube + name: minecraft-lobby-rdst + resources: + requests: + storage: 5Gi + storageClassName: ${CLUSTER_STORAGE_BLOCK} +--- +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationDestination +metadata: + name: minecraft-lobby-rdst +spec: + trigger: + manual: restore-once + restic: + repository: minecraft-lobby-restic-secret + copyMethod: Snapshot + accessModes: ["ReadWriteOnce"] + storageClassName: ${CLUSTER_STORAGE_BLOCK} + volumeSnapshotClassName: ${CLUSTER_SNAPSHOT_BLOCK} + cacheAccessModes: ["ReadWriteOnce"] + cacheCapacity: 8Gi + cacheStorageClassName: ${CLUSTER_STORAGE_HOSTPATH} + moverSecurityContext: + runAsUser: 568 + runAsGroup: 568 + fsGroup: 568 + capacity: 5Gi # must match the PersistentVolumeClaim `.resources.requests.storage` size above +--- +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationSource +metadata: + name: minecraft-lobby-rsrc +spec: + sourcePVC: minecraft-lobby + trigger: + schedule: "15 */8 * * *" + restic: + pruneIntervalDays: 10 + repository: minecraft-lobby-restic-secret + copyMethod: Snapshot + accessModes: ["ReadWriteOnce"] + storageClassName: ${CLUSTER_STORAGE_BLOCK} + volumeSnapshotClassName: ${CLUSTER_SNAPSHOT_BLOCK} + cacheAccessModes: ["ReadWriteOnce"] + cacheCapacity: 8Gi + cacheStorageClassName: ${CLUSTER_STORAGE_HOSTPATH} + moverSecurityContext: + runAsUser: 568 + runAsGroup: 568 + fsGroup: 568 + retain: + daily: 10 + within: 3d