From f5b24a9a173353a9c60e8564d85a34983974d302 Mon Sep 17 00:00:00 2001 From: savagebidoof Date: Sat, 1 Jul 2023 16:05:10 +0200 Subject: [PATCH] Added Undocumented Minecraft example. --- 90-MixConfigs/Minecraft/ConfigMap.yaml | 24 ++++++++++++++ 90-MixConfigs/Minecraft/Deployment.yaml | 32 +++++++++++++++++++ 90-MixConfigs/Minecraft/Gateway.yaml | 15 +++++++++ .../Minecraft/Istio-Ingress/Ingress.yaml | 27 ++++++++++++++++ 90-MixConfigs/Minecraft/README.md | 1 + 90-MixConfigs/Minecraft/Service.yaml | 18 +++++++++++ 90-MixConfigs/Minecraft/VirtualService.yaml | 18 +++++++++++ 7 files changed, 135 insertions(+) create mode 100644 90-MixConfigs/Minecraft/ConfigMap.yaml create mode 100644 90-MixConfigs/Minecraft/Deployment.yaml create mode 100644 90-MixConfigs/Minecraft/Gateway.yaml create mode 100644 90-MixConfigs/Minecraft/Istio-Ingress/Ingress.yaml create mode 100644 90-MixConfigs/Minecraft/README.md create mode 100644 90-MixConfigs/Minecraft/Service.yaml create mode 100644 90-MixConfigs/Minecraft/VirtualService.yaml diff --git a/90-MixConfigs/Minecraft/ConfigMap.yaml b/90-MixConfigs/Minecraft/ConfigMap.yaml new file mode 100644 index 0000000..390ce6d --- /dev/null +++ b/90-MixConfigs/Minecraft/ConfigMap.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: minecraft-config + namespace: default + labels: + app: minecraft +data: + EULA: "TRUE" + MEMORY: 1G + TYPE: "FOLIA" + FORCE_REDOWNLOAD: "FALSE" + VERSION: "1.19.4" + MOTD: "My minecraft world!" + ONLINE_MODE: "FALSE" + ENABLE_QUERY: "TRUE" + ENABLE_RCON: "FALSE" + ALLOW_NETHER: "FALSE" + GENERATE_STRUCTURES: "FALSE" + SNOOPER_ENABLED: "FALSE" + SPAWN_ANIMALS: "FALSE" + SPAWN_MONSTERS: "FALSE" + SPAWN_NPCS: "FALSE" + ENABLE_AUTOPAUSE: "TRUE" \ No newline at end of file diff --git a/90-MixConfigs/Minecraft/Deployment.yaml b/90-MixConfigs/Minecraft/Deployment.yaml new file mode 100644 index 0000000..30ce502 --- /dev/null +++ b/90-MixConfigs/Minecraft/Deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: minecraft-1 + namespace: default + labels: + app: minecraft +spec: + replicas: 1 + selector: + matchLabels: + app: minecraft + template: + metadata: + labels: + app: minecraft + spec: + containers: + - name: minecraft + image: itzg/minecraft-server + resources: + requests: + cpu: "100m" + imagePullPolicy: IfNotPresent #Always + ports: + - containerPort: 25565 + envFrom: + - configMapRef: + name: minecraft-config + env: + - name: MOTD + value: "World 1 Server" \ No newline at end of file diff --git a/90-MixConfigs/Minecraft/Gateway.yaml b/90-MixConfigs/Minecraft/Gateway.yaml new file mode 100644 index 0000000..7b47906 --- /dev/null +++ b/90-MixConfigs/Minecraft/Gateway.yaml @@ -0,0 +1,15 @@ +apiVersion: networking.istio.io/v1alpha3 +kind: Gateway +metadata: + name: minecraft-gateway + namespace: default +spec: + selector: + istio: games + servers: + - port: + number: 25565 + name: tcp-1 + protocol: TCP + hosts: + - "*" \ No newline at end of file diff --git a/90-MixConfigs/Minecraft/Istio-Ingress/Ingress.yaml b/90-MixConfigs/Minecraft/Istio-Ingress/Ingress.yaml new file mode 100644 index 0000000..363127c --- /dev/null +++ b/90-MixConfigs/Minecraft/Istio-Ingress/Ingress.yaml @@ -0,0 +1,27 @@ +apiVersion: install.istio.io/v1alpha1 +kind: IstioOperator +metadata: + name: ingress +spec: + profile: empty # Do not install CRDs or the control plane + components: + ingressGateways: + - name: ingress-games-gateway + namespace: istio-system + enabled: true + label: + # Set a unique label for the gateway. This is required to ensure Gateways + # can select this workload + istio: games + k8s: + service: + ports: + - port: 25565 + targetPort: 25565 + name: minecraft-port + protocol: TCP + values: + gateways: + istio-ingressgateway: + # Enable gateway injection + injectionTemplate: gateway diff --git a/90-MixConfigs/Minecraft/README.md b/90-MixConfigs/Minecraft/README.md new file mode 100644 index 0000000..dc8ba28 --- /dev/null +++ b/90-MixConfigs/Minecraft/README.md @@ -0,0 +1 @@ +https://github.com/itzg/docker-minecraft-server/#server-configuration \ No newline at end of file diff --git a/90-MixConfigs/Minecraft/Service.yaml b/90-MixConfigs/Minecraft/Service.yaml new file mode 100644 index 0000000..a9fca20 --- /dev/null +++ b/90-MixConfigs/Minecraft/Service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: minecraft + namespace: default + labels: + app: minecraft + world: "1" +spec: + ports: + - port: 25565 + name: tcp-minecraft + protocol: TCP +# nodePort: 30000 + selector: + app: minecraft + world: "1" +# type: NodePort \ No newline at end of file diff --git a/90-MixConfigs/Minecraft/VirtualService.yaml b/90-MixConfigs/Minecraft/VirtualService.yaml new file mode 100644 index 0000000..abc7170 --- /dev/null +++ b/90-MixConfigs/Minecraft/VirtualService.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: minecraft-1 + namespace: default +spec: + hosts: + - "*" + gateways: + - minecraft-gateway + tcp: + - match: + - port: 25565 + route: + - destination: + host: minecraft.default.svc.cluster.local + port: + number: 25565 \ No newline at end of file