Overriding Pod properties
To suit your needs, you may need to override or complete some properties filled to the underlying Pod. The podOverrides
property of both the ProxyFleet
and MinecraftServerFleet
allows you to customize the Pod properties as you were writing a Pod directly (i.e. the supported sub-properties are identical to the Pod specification).
You can find all the properties overridable by looking at the shulker-crds
package of the repository:
Adding environment variables
Shulker already injects some environment variables that could be useful. But adding your own is fully supported:
apiVersion: shulkermc.io/v1alpha1
kind: MinecraftServerFleet
metadata:
name: my-server
spec:
clusterRef:
name: my-cluster
replicas: 1
template:
spec:
podOverrides:
env:
- name: OPENMATCH_HOST
value: open-match-frontend.open-match.svc
- name: OPENMATCH_PORT
value: '50504'
Setting custom affinities
By default, Agones adds a preferred scheduling on nodes labelled with agones.dev/role=gameserver
. However you may want to customize more the scheduling behavior.
For instance, you may want to restrict some servers to some nodes:
apiVersion: shulkermc.io/v1alpha1
kind: MinecraftServerFleet
metadata:
name: my-server
spec:
clusterRef:
name: my-cluster
replicas: 1
template:
spec:
podOverrides:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: devops.example.com/gameserver
operator: In
values:
- my-server
tolerations:
- key: "devops.example.com/gameserver"
operator: "Equal"
value: "my-server"
effect: "NoSchedule"
Mounting volumes servers
Additional volumes can be injected to the MinecraftServer
's created Pod
:
apiVersion: shulkermc.io/v1alpha1
kind: MinecraftServer
metadata:
name: my-server
spec:
clusterRef:
name: my-cluster
podOverrides:
volumeMounts:
- name: my-extra-volume
mountPath: /mnt/path
volumes:
- name: my-extra-volume
emptyDir: {}
WARNING
Agones, and thus Shulker, are not meant for data persistence but rather ephemeral workload. While adding custom volumes to a MinecraftServer
is expected to work perfectly, adding some to a MinecraftServerFleet
will only work if your volume source support multiple mounts (it is essentially the same as mounting the same volume to a Deployment
).