fix(api): 停服时 CR 已不存在返回 404 not_found,与唤醒一致

This commit is contained in:
Lemon-miaow committed 2026-09-27 12:49:46 +08:00
1 parent f692725bed
commit 5b0686dc06
3 files changed
+70 -1

No files matched your search

+3
View File
@@ -1853,6 +1853,9 @@ func (c *fakeCluster) WorldVolumeExists(_ context.Context, n string) (bool, erro
}
func (c *fakeCluster) SetDesiredState(_ context.Context, n string, s v1alpha1.DesiredState) error {
if _, ok := c.byName[n]; !ok {
return ErrNotFound // the MinecraftServer is gone, as K8sCluster.getServer reports it
}
if err := c.wakeErr[n]; err != nil && s == v1alpha1.DesiredRunning {
return err
}