Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions changelog/unreleased/1000-load-balancer-class.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Choose a server's load-balancer implementation

A LoadBalancer server can set `spec.networking.loadBalancerClass` to pick
which load-balancer implementation handles its Service, for a cluster that
runs more than one. Changing it replaces the Service, since Kubernetes
doesn't allow changing a Service's class in place, and the server usually
gets a new external address; see
[Choosing a Load-Balancer Implementation](../../docs/networking.md#choosing-a-load-balancer-implementation).
[PR #1000](https://github.com/GameplanePanel/Gameplane/pull/1000)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: backups.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: backupschedules.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: clusters.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: gameservers.gameplane.local
spec:
Expand Down Expand Up @@ -1405,6 +1405,25 @@ spec:
maxLength: 253
pattern: ^([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)(\.[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)*$
type: string
loadBalancerClass:
description: |-
LoadBalancerClass selects the load-balancer implementation for the
fronting Service (service.spec.loadBalancerClass), for a cluster that
runs more than one, or a custom one for game traffic. It only takes
effect when Expose=LoadBalancer. Kubernetes doesn't allow changing a
Service's class, so when this changes the operator replaces the
Service, which gets a new cluster IP and, usually, a new external
address. Unset leaves the Service's class as it is. The value is a
Kubernetes qualified name: an optional DNS-subdomain prefix and a
slash, then a name of at most 63 characters. The prefix is at most 253
characters, so the whole value is at most 317.
maxLength: 317
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?$
type: string
x-kubernetes-validations:
- message: the loadBalancerClass prefix must be at most 253 characters
rule: '!self.contains(''/'') || self.split(''/'')[0].size()
<= 253'
portOverrides:
description: |-
PortOverrides lets the user pin a specific NodePort or override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: gametemplates.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: modules.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: modulesources.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: networkcaptures.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: restores.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: backups.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: backupschedules.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: clusters.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: gameservers.gameplane.local
spec:
Expand Down Expand Up @@ -1405,6 +1405,25 @@ spec:
maxLength: 253
pattern: ^([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)(\.[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)*$
type: string
loadBalancerClass:
description: |-
LoadBalancerClass selects the load-balancer implementation for the
fronting Service (service.spec.loadBalancerClass), for a cluster that
runs more than one, or a custom one for game traffic. It only takes
effect when Expose=LoadBalancer. Kubernetes doesn't allow changing a
Service's class, so when this changes the operator replaces the
Service, which gets a new cluster IP and, usually, a new external
address. Unset leaves the Service's class as it is. The value is a
Kubernetes qualified name: an optional DNS-subdomain prefix and a
slash, then a name of at most 63 characters. The prefix is at most 253
characters, so the whole value is at most 317.
maxLength: 317
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?$
type: string
x-kubernetes-validations:
- message: the loadBalancerClass prefix must be at most 253 characters
rule: '!self.contains(''/'') || self.split(''/'')[0].size()
<= 253'
portOverrides:
description: |-
PortOverrides lets the user pin a specific NodePort or override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: gametemplates.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: modules.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: modulesources.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: networkcaptures.gameplane.local
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
gameplane.local/crd-bundle-sha256: b409bc125837ec9256cb4968d3f98a162c9a145dee35b16c22f39498a9892e64
gameplane.local/crd-bundle-sha256: 11dd82c4242b31a0d15e684de63c02fcf78f2a316feb2e8dd3ad2a51ff923037
controller-gen.kubebuilder.io/version: v0.22.0
name: restores.gameplane.local
spec:
Expand Down
25 changes: 25 additions & 0 deletions docs/networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,31 @@ created before the upgrade that introduced it. A hostname that doesn't
resolve to its server would now be shown to players, so before upgrading,
check each such hostname, or clear it where it isn't the name players use.

## Choosing a Load-Balancer Implementation

A cluster can run more than one load-balancer implementation, each handling
Services of its own class: a cloud's, MetalLB, Tailscale's operator, or a
custom one for game traffic. Set `spec.networking.loadBalancerClass` on a
LoadBalancer server to pick one; it becomes the Service's
`spec.loadBalancerClass`. Unset, the operator doesn't manage the class: a new
Service has none, so the cluster's default implementation handles it, and an
existing Service keeps any class something else gave it.

Kubernetes doesn't allow changing a Service's class, or adding one to a
LoadBalancer Service that has none, so when the field is set or changes, the
operator deletes the Service and creates it again with the new class. The server keeps running, but its Service gets a new cluster IP and,
usually, a new external address, so players reconnect. Removing the field
leaves the Service's class as it is until the Service is next replaced. The
class is a Kubernetes qualified name, such as `example.com/games`: the part
after the slash is at most 63 characters. The dashboard doesn't edit the
class, and keeps it when you save other networking settings; set it through
the API or `kubectl`.

An address pool or address (`addressPool`, `address`) is a request to the
configured address manager; a Service of another class is outside that
manager's control, so leave them unset with a class of another
implementation.

## Related

- [`install.md`](install.md) — Helm chart values for `operator.addressManager` and cluster prerequisites.
Expand Down
16 changes: 16 additions & 0 deletions operator/api/v1alpha1/gameserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,22 @@ type GameServerNetworking struct {
// +optional
PortOverrides []PortOverride `json:"portOverrides,omitempty"`

// LoadBalancerClass selects the load-balancer implementation for the
// fronting Service (service.spec.loadBalancerClass), for a cluster that
// runs more than one, or a custom one for game traffic. It only takes
// effect when Expose=LoadBalancer. Kubernetes doesn't allow changing a
// Service's class, so when this changes the operator replaces the
// Service, which gets a new cluster IP and, usually, a new external
// address. Unset leaves the Service's class as it is. The value is a
// Kubernetes qualified name: an optional DNS-subdomain prefix and a
// slash, then a name of at most 63 characters. The prefix is at most 253
// characters, so the whole value is at most 317.
// +kubebuilder:validation:MaxLength=317
// +kubebuilder:validation:XValidation:rule="!self.contains('/') || self.split('/')[0].size() <= 253",message="the loadBalancerClass prefix must be at most 253 characters"
// +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?$`
// +optional
LoadBalancerClass *string `json:"loadBalancerClass,omitempty"`

// SourceRanges is an IP allow-list (CIDRs) for the fronting Service. It
// maps to service.spec.loadBalancerSourceRanges and therefore only takes
// effect when Expose=LoadBalancer (cloud LBs that honor it); it is
Expand Down
5 changes: 5 additions & 0 deletions operator/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions operator/config/crd/gameplane.local_gameservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,25 @@ spec:
maxLength: 253
pattern: ^([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)(\.[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)*$
type: string
loadBalancerClass:
description: |-
LoadBalancerClass selects the load-balancer implementation for the
fronting Service (service.spec.loadBalancerClass), for a cluster that
runs more than one, or a custom one for game traffic. It only takes
effect when Expose=LoadBalancer. Kubernetes doesn't allow changing a
Service's class, so when this changes the operator replaces the
Service, which gets a new cluster IP and, usually, a new external
address. Unset leaves the Service's class as it is. The value is a
Kubernetes qualified name: an optional DNS-subdomain prefix and a
slash, then a name of at most 63 characters. The prefix is at most 253
characters, so the whole value is at most 317.
maxLength: 317
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?$
type: string
x-kubernetes-validations:
- message: the loadBalancerClass prefix must be at most 253 characters
rule: '!self.contains(''/'') || self.split(''/'')[0].size()
<= 253'
portOverrides:
description: |-
PortOverrides lets the user pin a specific NodePort or override
Expand Down
Loading
Loading