fix(felis): 编辑服务器时内存和 CPU 可各自单改互不清除,显示名可清空,内存显示真实上限

This commit is contained in:
Lemon-miaow committed 2026-09-26 22:22:02 +08:00
1 parent 22d1e834ad
commit d65cf3af30
18 files changed
+600 -60

No files matched your search

+17
View File
@@ -15,6 +15,7 @@ import (
"time"
"felis.lolicon.best/internal/apis/felis/v1alpha1"
corev1 "k8s.io/api/core/v1"
)
const testRoot = "mc.example.net" // neutral; never a deployment domain
@@ -1845,6 +1846,22 @@ func (c *fakeCluster) PatchServerSpec(_ context.Context, n string, p ServerSpecP
if p.IdleStopSeconds != nil {
info.IdleStopSeconds = *p.IdleStopSeconds
}
if p.DisplayName != nil {
info.DisplayName = *p.DisplayName
}
if p.JavaMemory != nil {
info.JavaMemory = *p.JavaMemory
}
if p.Resources != nil {
info.Resources = *p.Resources.DeepCopy()
info.Memory, info.CPU = "", ""
if q, ok := p.Resources.Limits[corev1.ResourceMemory]; ok {
info.Memory = q.String()
}
if q, ok := p.Resources.Limits[corev1.ResourceCPU]; ok {
info.CPU = q.String()
}
}
return nil
}