Vixen
02b45cc4
csharp
public sealed class KubernetesPlacement

Realms as pods. ADR-019's first backend.

Read the guide page for this →

Remarks

⚠ A Pod, not a Deployment and not a StatefulSet. Realms are not fungible replicas: each has an identity, a map, a population, a version and a lifetime that ends when the last player leaves. A Deployment's controller would restart a realm that exited on purpose, and its rolling update is the wrong shape for doc 27 § Upgrades — draining a realm means moving players, not terminating a pod when a readiness probe flips. An owner reference on the orchestrator's own pod gives the one thing the controller was wanted for, which is garbage collection.

⚠ hostPort, not a Service per pod. A Service per realm puts kube-proxy and conntrack between the player and the simulation — the gateway problem in a different hat, and the one doc 27 § The routing question spends a page rejecting. It also consumes a cluster IP per shard. The cost is that the node port range is cluster configuration, which M5 names as this design's one prerequisite.

Fields and properties (1)

  • public const string BackendName

    What this backend calls itself in a PlacementProbe.

Methods (8)

  • public KubernetesPlacement(KubernetesPlacementOptions options, IClusterApi cluster, TimeProvider? time = null)

    Stands a backend up.

  • public ValueTask<PlacementProbe> ProbeAsync(CancellationToken cancellation)

    Whether this backend can run here, and what it found.

  • public ValueTask<RealmInstance> StartAsync(RealmSpec spec, CancellationToken cancellation)

    Brings a realm up.

  • public ValueTask StopAsync(RealmInstanceId instance, StopMode mode, CancellationToken cancellation)

    Takes a realm down.

  • public ValueTask<IReadOnlyList<RealmInstance>> ListAsync(CancellationToken cancellation)

    What this backend believes is running.

  • public IAsyncEnumerable<PlacementEvent> WatchAsync(CancellationToken cancellation)

    Everything that happens to instances, as it happens.

  • public void Dispose()

    Stops following pods. Does not delete them.

  • public V1Pod Describe(RealmSpec spec, int port)

    The pod a shard becomes.

Used by (1)

  • KubernetesPlacementTestsVixen.Live.Placement.Kubernetes.Tests