fix(operator): 有玩家在线时停服先在游戏里预告 30 秒,期间改回运行会取消

This commit is contained in:
Lemon-miaow committed 2026-09-27 05:18:41 +08:00
1 parent 4ae64cc2e8
commit 6d5aca79fb
16 files changed
+453 -13

No files matched your search

@@ -342,6 +342,11 @@ type MinecraftServerStatus struct {
// or the server stops, so the empty-duration counter starts fresh each time
// the server becomes unoccupied.
EmptySince *metav1.Time `json:"emptySince,omitempty"`
// StopNoticeAt is when the operator told the players on a server that it is
// about to stop (desiredState flipped to Stopped with players online). The stop
// itself waits until StopNoticeWindow has passed since then; the stamp is cleared
// once the server is scaled down, or when desiredState goes back to Running first.
StopNoticeAt *metav1.Time `json:"stopNoticeAt,omitempty"`
// AutoRestarts counts how often the operator recreated the pod of a start
// that timed out (at most MaxAutoRestarts, with a doubling backoff); reaching Ready or
// stopping resets it.
@@ -121,6 +121,9 @@ func (in *MinecraftServerStatus) DeepCopyInto(out *MinecraftServerStatus) {
if in.EmptySince != nil {
out.EmptySince = in.EmptySince.DeepCopy()
}
if in.StopNoticeAt != nil {
out.StopNoticeAt = in.StopNoticeAt.DeepCopy()
}
if in.LastAutoRestartAt != nil {
out.LastAutoRestartAt = in.LastAutoRestartAt.DeepCopy()
}