Skip to content

Commit

Permalink
Remove simple-tcp and simple-udp (#1992)
Browse files Browse the repository at this point in the history
* Remove simple-tcp and simple-udp

This covers:
* Moving the windows build scripts from simple-udp to simple-game-server
* Moving all the documentation to use simple-game-server (tested this by
 hand)
* Updated all the examples to use simple-game-servers
* Removal of both simple-udp and simple-tcp

Closes #1890

* Review updates:

* Only remove example links on release (had to add `‌` because of strange markdown formatting issues)
* Update fleet_autoscaling.py fleet name
  • Loading branch information
markmandel authored Feb 12, 2021
1 parent d48b1c0 commit c833e5d
Show file tree
Hide file tree
Showing 64 changed files with 345 additions and 1,588 deletions.
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ WINDOWS_VERSIONS = ltsc2019 # 1909 (For GKE WINDOWS_SAC support)
BUILD_WINDOWS_IMAGE =

# Specify stress test level 1..100
# STRESS_TEST_LEVEL=n requires capacity between 50*n up to 100*n simple-udp Game Servers.
# STRESS_TEST_LEVEL=n requires capacity between 50*n up to 100*n simple-game-server Game Servers.
STRESS_TEST_LEVEL ?= 20

# kind cluster name to use
Expand Down
2 changes: 0 additions & 2 deletions build/includes/examples.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ test-examples-on-gcr: example-image-test.autoscaler-webhook
test-examples-on-gcr: example-image-test.cpp-simple
test-examples-on-gcr: example-image-test.nodejs-simple
test-examples-on-gcr: example-image-test.rust-simple
test-examples-on-gcr: example-image-test.simple-tcp
test-examples-on-gcr: example-image-test.simple-udp
test-examples-on-gcr: example-image-test.unity-simple
test-examples-on-gcr: example-image-test.xonotic
test-examples-on-gcr: example-image-test.crd-client
Expand Down
2 changes: 0 additions & 2 deletions build/includes/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ release-example-image-markdown: example-image-markdown.crd-client
release-example-image-markdown: example-image-markdown.nodejs-simple
release-example-image-markdown: example-image-markdown.rust-simple
release-example-image-markdown: example-image-markdown.simple-game-server
release-example-image-markdown: example-image-markdown.simple-tcp
release-example-image-markdown: example-image-markdown.simple-udp
release-example-image-markdown: example-image-markdown.supertuxkart
release-example-image-markdown: example-image-markdown.unity-simple
release-example-image-markdown: example-image-markdown.xonotic
Expand Down
5 changes: 1 addition & 4 deletions build/includes/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ sdk-publish-csharp:
$(MAKE) run-sdk-command-csharp COMMAND=publish VERSION=$(RELEASE_VERSION) DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS) -it"

# Perform make build for all examples
build-examples: build-example-xonotic build-example-cpp-simple build-example-simple-udp build-example-autoscaler-webhook build-example-nodejs-simple
build-examples: build-example-xonotic build-example-cpp-simple build-example-autoscaler-webhook build-example-nodejs-simple

# Run "make build" command for one example directory
build-example:
Expand All @@ -228,9 +228,6 @@ build-example-xonotic:
build-example-cpp-simple:
$(MAKE) build-example EXAMPLE=cpp-simple

build-example-simple-udp:
$(MAKE) build-example EXAMPLE=simple-udp

build-example-rust-simple:
$(MAKE) build-example EXAMPLE=rust-simple

Expand Down
2 changes: 1 addition & 1 deletion examples/crd-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

REPOSITORY ?= gcr.io/agones-images

server_tag = $(REPOSITORY)/crd-client:0.4
server_tag = $(REPOSITORY)/crd-client:0.5

# _____ _
# |_ _|_ _ _ __ __ _ ___| |_ ___
Expand Down
2 changes: 1 addition & 1 deletion examples/crd-client/create-gs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ spec:
imagePullPolicy: Always
env:
- name: GAMESERVER_IMAGE
value: "gcr.io/agones-images/udp-server:0.21"
value: "gcr.io/agones-images/simple-game-server:0.1"
restartPolicy: Never
4 changes: 2 additions & 2 deletions examples/crd-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func main() {
Namespace: viper.GetString(gameserversNamespace),
},
Spec: agonesv1.GameServerSpec{
Container: "udp-server",
Container: "simple-game-server",
Ports: []agonesv1.GameServerPort{{
ContainerPort: 7654,
HostPort: 7654,
Expand All @@ -101,7 +101,7 @@ func main() {
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "udp-server",
Name: "simple-game-server",
Image: viper.GetString(gameServerImage),
},
},
Expand Down
4 changes: 2 additions & 2 deletions examples/fleet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ spec:
template:
spec:
containers:
- name: simple-udp
image: gcr.io/agones-images/udp-server:0.21
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.1
6 changes: 3 additions & 3 deletions examples/gameserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
# This will mean that users will need to lookup what port has been opened through the server side SDK.
portPolicy: Static
# The name of the container to open the port on. Defaults to the game server container if omitted or empty.
container: simple-udp
container: simple-game-server
# the port that is being opened on the game server process
containerPort: 7654
# the port exposed on the host, only required when `portPolicy` is "Static". Overwritten when portPolicy is "Dynamic".
Expand Down Expand Up @@ -95,6 +95,6 @@ spec:
# Pod Specification
spec:
containers:
- name: simple-udp
image: gcr.io/agones-images/udp-server:0.21
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.1
imagePullPolicy: Always
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

!bin/simple-tcp.exe
!bin/simple-game-server.exe
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ FROM mcr.microsoft.com/windows/servercore:${WINDOWS_VERSION}
# Unlike the Linux image the binary is built on the host since buildx cannot
# invoke RUN commands for Windows Containers and multi-stage images
# cannot copy data between OSes.
COPY ["bin/simple-udp.exe", "/server/simple-udp.exe"]
COPY ["bin/simple-game-server.exe", "/server/simple-game-server.exe"]

WORKDIR /server
EXPOSE 7654
USER ContainerUser
ENTRYPOINT ["C:\\server\\simple-udp.exe"]
ENTRYPOINT ["C:\\server\\simple-game-server.exe"]
63 changes: 59 additions & 4 deletions examples/simple-game-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@
# \_/ \__,_|_| |_|\__,_|_.__/|_|\___|___/
#

REPOSITORY = gcr.io/agones-images
REGISTRY = gcr.io/agones-images
BUILDX_WINDOWS_BUILDER = windows-builder
WINDOWS_VERSIONS = ltsc2019 # 1909 (For GKE WINDOWS_SAC support)
WINDOWS_DOCKER_PUSH_ARGS = # When pushing set to --push.

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
server_tag = $(REPOSITORY)/simple-game-server:0.1
server_tag = $(REGISTRY)/simple-game-server:0.1
ifdef WITH_WINDOWS
server_tag_linux_amd64 = $(server_tag)-linux_amd64
else
server_tag_linux_amd64 = $(server_tag)
endif
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand All @@ -37,9 +45,56 @@ root_path = $(realpath $(project_path)/../..)
# |_|\__,_|_| \__, |\___|\__|___/
# |___/

ifdef WITH_WINDOWS
push: push-multi-arch-image
build: build-linux-image $(foreach winver, $(WINDOWS_VERSIONS), build-windows-image-$(winver))
else
push: push-linux-image
build: build-linux-image
endif

# Builds all image artifacts and create a docker manifest that is used to inform the CRI (Docker or containerd usually)
# which image is the best fit for the host. See https://www.docker.com/blog/multi-arch-images/ for details.
push-multi-arch-image: push-linux-image push-windows-images
# TODO: `docker manifest` does not yet stamp the `os.version` for Windows manifest entry.
# This means only 1 Windows version can be supported in a multi-platform build.
# Either adopt, https://github.com/kubernetes-sigs/azuredisk-csi-driver/pull/585/files or
# wait for https://github.com/docker/cli/pull/2578 to be available in Docker 20.10.
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(server_tag) $(server_tag_linux_amd64) $(foreach windows_version, $(WINDOWS_VERSIONS), $(server_tag)-windows_amd64-$(windows_version))
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(server_tag) --purge

# Pushes all variants of the Windows images to the container image registry.
push-linux-image: build
docker push $(server_tag_linux_amd64)

# Pushes all variants of the Windows images to the container image registry.
push-windows-images: $(foreach winver, $(WINDOWS_VERSIONS), push-windows-image-$(winver))

# Pushes a specific version of Windows to a container image registry.
push-windows-image-%:
$(MAKE) WINDOWS_DOCKER_PUSH_ARGS=--push build-windows-image-$*

build-windows-image-%: build-windows-binary ensure-windows-buildx
# TODO: Use `--builder $(BUILDX_WINDOWS_BUILDER)` later once Docker 19.03.13 is the build target. Cloud Build has 19.03.08 https://cloud.google.com/cloud-build/release-notes
cd $(root_path) && DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build --platform windows/amd64 -f $(project_path)Dockerfile.windows \
--tag=$(server_tag)-windows_amd64-$* --build-arg WINDOWS_VERSION=$* examples/simple-game-server/ $(WINDOWS_DOCKER_PUSH_ARGS)

# Builds the server binary for Windows (amd64).
build-windows-binary:
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o bin/simple-game-server.exe main.go

ensure-windows-buildx:
# TODO: Remove `--use` and specify `--builder` for each buildx command once Docker 19.03.13 is available.
# `--use` sets the global default buildx context to $(BUILDX_WINDOWS_BUILDER).
#
# Windows image builds must be directed to a specific buildx context.
# The default context does not support building cross platform images.
-DOCKER_CLI_EXPERIMENTAL=enabled docker buildx create --name=$(BUILDX_WINDOWS_BUILDER) --use

# Build a docker image for the server, and tag it
build:
cd $(root_path) && docker build -f $(project_path)/Dockerfile --tag=$(server_tag) .
build-linux-image:
cd $(root_path) && docker build -f $(project_path)Dockerfile --tag=$(server_tag_linux_amd64) .

# check if hosted on Google Cloud Registry
gcr-check:
Expand Down
4 changes: 2 additions & 2 deletions examples/simple-game-server/fleet-distributed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ spec:
image: gcr.io/agones-images/simple-game-server:0.1
resources:
requests:
memory: "32Mi"
memory: "64Mi"
cpu: "20m"
limits:
memory: "32Mi"
memory: "64Mi"
cpu: "20m"
4 changes: 2 additions & 2 deletions examples/simple-game-server/gameserver-passthrough.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ spec:
value: "TRUE"
resources:
requests:
memory: "32Mi"
memory: "64Mi"
cpu: "20m"
limits:
memory: "32Mi"
memory: "64Mi"
cpu: "20m"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
apiVersion: "agones.dev/v1"
kind: GameServer
metadata:
generateName: "simple-udp-"
generateName: "simple-game-server-"
spec:
ports:
- name: default
Expand All @@ -24,15 +24,15 @@ spec:
template:
spec:
containers:
- name: simple-udp
image: gcr.io/agones-images/udp-server:0.21
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.1
resources:
requests:
memory: "256Mi"
cpu: "500m"
memory: "64Mi"
cpu: "20m"
limits:
memory: "512Mi"
cpu: "500m"
memory: "64Mi"
cpu: "20m"
# Limit this pod to Windows nodes.
nodeSelector:
kubernetes.io/os: windows
4 changes: 2 additions & 2 deletions examples/simple-game-server/gameserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ spec:
image: gcr.io/agones-images/simple-game-server:0.1
resources:
requests:
memory: "32Mi"
memory: "64Mi"
cpu: "20m"
limits:
memory: "32Mi"
memory: "64Mi"
cpu: "20m"
32 changes: 0 additions & 32 deletions examples/simple-tcp/Dockerfile

This file was deleted.

31 changes: 0 additions & 31 deletions examples/simple-tcp/Dockerfile.windows

This file was deleted.

Loading

0 comments on commit c833e5d

Please sign in to comment.