Skip to content

Commit

Permalink
Examples for relay configuration
Browse files Browse the repository at this point in the history
Updated examples from googleforgames#772 moved into their own separate PR, so that
when googleforgames#772 is submitted, link checks om the quickstart documentation will
resolve correctly.
  • Loading branch information
markmandel committed Oct 4, 2023
1 parent 2f182ab commit f4aacef
Show file tree
Hide file tree
Showing 6 changed files with 347 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/agones-xonotic-relay/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Agones & Xonotic via Relay Example

This is the code example for the "Quickstart: Quilkin with Agones and Xonotic (Relay)" Guide, linked via the homepage.
26 changes: 26 additions & 0 deletions examples/agones-xonotic-relay/client-token.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

version: v1alpha1
filters:
- name: quilkin.filters.concatenate_bytes.v1alpha1.ConcatenateBytes
config:
on_read: APPEND
on_write: DO_NOTHING
bytes: NDU2 # 456
clusters:
- endpoints:
- address: ${LOADBALANCER_IP}:7777
38 changes: 38 additions & 0 deletions examples/agones-xonotic-relay/fleet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2022 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Usually you would define a Fleet rather than a GameServerSet
# directly. This is here mostly for testing purposes

apiVersion: "agones.dev/v1"
kind: Fleet
metadata:
name: xonotic
spec:
replicas: 3
strategy:
type: Recreate
template:
spec:
ports:
- name: default
containerPort: 26000
health:
initialDelaySeconds: 30
periodSeconds: 60
template:
spec:
containers:
- name: xonotic
image: us-docker.pkg.dev/agones-images/examples/xonotic-example:1.2
23 changes: 23 additions & 0 deletions examples/agones-xonotic-relay/gameserverallocation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2022 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: "allocation.agones.dev/v1"
kind: GameServerAllocation
spec:
selectors:
- matchLabels:
agones.dev/fleet: xonotic
metadata:
annotations:
quilkin.dev/tokens: NDU2 # 456
72 changes: 72 additions & 0 deletions examples/agones-xonotic-relay/proxy-pool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# Pool of Quilkin proxies, tied to the
# Quilkin relay control plane in relay-control-plane.yaml
#

---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
role: proxy
name: quilkin-proxies
spec:
replicas: 3
selector:
matchLabels:
role: proxy
template:
metadata:
labels:
role: proxy
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: /metrics
prometheus.io/port: "8000"
spec:
containers:
- name: quilkin
image: us-docker.pkg.dev/quilkin-mark-dev/release/quilkin:0.7.0
args: ["proxy", "--management-server", "http://quilkin-relay-agones:7800"]
env:
- name: RUST_LOG
value: info #,quilkin=trace
livenessProbe:
failureThreshold: 3
httpGet:
path: /live
port: 8000
scheme: HTTP
ports:
- containerPort: 7777
protocol: UDP

---
apiVersion: v1
kind: Service
metadata:
name: quilkin-proxies
spec:
ports:
- port: 7777
protocol: UDP
targetPort: 7777
selector:
role: proxy
type: LoadBalancer
185 changes: 185 additions & 0 deletions examples/agones-xonotic-relay/relay-control-plane.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
#
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# Everything to setup the relay and agent Agones control plane
#

---
# ANCHOR: config-map
apiVersion: v1
kind: ConfigMap
metadata:
name: quilkin-relay-filter-config
labels:
quilkin.dev/configmap: "true"
data:
quilkin.yaml: |
version: v1alpha1
filters:
- name: quilkin.filters.capture.v1alpha1.Capture
config:
suffix:
size: 3
remove: true
- name: quilkin.filters.token_router.v1alpha1.TokenRouter
# ANCHOR_END: config-map

---

# RBAC Setup for Agones Relay Control Plane

apiVersion: v1
kind: ServiceAccount
metadata:
name: quilkin-agones
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: quilkin-agones
rules:
- apiGroups:
- agones.dev
resources:
- gameservers
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: quilkin-agones
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: quilkin-agones
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: system:serviceaccount:default:quilkin-agones
---

# Quilkin Relay server

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
role: xds
name: quilkin-relay-agones
spec:
replicas: 1
selector:
matchLabels:
role: xds
template:
metadata:
labels:
role: xds
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: /metrics
prometheus.io/port: "8000"
spec:
containers:
- name: quilkin
args:
- relay
- agones
env:
- name: RUST_LOG
value: info
image: us-docker.pkg.dev/quilkin-mark-dev/release/quilkin:0.7.0
livenessProbe:
failureThreshold: 3
httpGet:
path: /live
port: 8000
scheme: HTTP
ports:
- containerPort: 7800
protocol: TCP
serviceAccountName: quilkin-agones
---

# Quilkin Agones Agent

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
role: xds
name: quilkin-agones-agent
spec:
replicas: 1
selector:
matchLabels:
role: xds
template:
metadata:
labels:
role: xds
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: /metrics
prometheus.io/port: "8000"
spec:
containers:
- name: quilkin
args:
- agent
- --relay
- http://quilkin-relay-agones:7900
- agones
env:
- name: RUST_LOG
value: info
image: us-docker.pkg.dev/quilkin-mark-dev/release/quilkin:0.7.0
livenessProbe:
failureThreshold: 3
httpGet:
path: /live
port: 8000
scheme: HTTP
serviceAccountName: quilkin-agones
---
apiVersion: v1
kind: Service
metadata:
name: quilkin-relay-agones
spec:
ports:
- name: ads
port: 7800
protocol: TCP
targetPort: 7800
- name: cpds
port: 7900
protocol: TCP
targetPort: 7900
selector:
role: xds

0 comments on commit f4aacef

Please sign in to comment.