feat(operator): implement idle auto-stop (spec §8)

Adds empty-server auto-stop to the reconciler. When Idle.AutoStopEnabled
is true and the RCON player tally is zero for EmptySecondsBeforeStop seconds,
the operator flips desiredState to Stopped, which triggers the normal
graceful-shutdown path.

- Add EmptySince status field to track empty duration
- Clear EmptySince on stop and when players return
- Reuse existing RCON probe's player count (zero extra network cost)
- 4 new test cases covering timestamp, timeout, player-join reset, and
  disabled-by-default
This commit is contained in:
Lemon-miaow committed 2026-07-05 01:52:45 +08:00
1 parent bd49313e7e
commit 91bfa27e8c
4 files changed
+154

No files matched your search

@@ -118,6 +118,9 @@ func (in *MinecraftServerStatus) DeepCopyInto(out *MinecraftServerStatus) {
if in.StartRequestedAt != nil {
out.StartRequestedAt = in.StartRequestedAt.DeepCopy()
}
if in.EmptySince != nil {
out.EmptySince = in.EmptySince.DeepCopy()
}
if in.Conditions != nil {
l := make([]metav1.Condition, len(in.Conditions))
for i := range in.Conditions {