feat(operator): 平台升级不再重启运行中的游戏服,registry 清理保留游戏 pod 在用的镜像

This commit is contained in:
Lemon-miaow committed 2026-09-24 23:52:30 +08:00
1 parent 07eb682358
commit 80fbc779d9
5 files changed
+188 -10

No files matched your search

+20
View File
@@ -67,6 +67,26 @@ func (k *K8sCluster) WorldVolumeExists(ctx context.Context, name string) (bool,
return true, nil
}
// PodImages lists the image of every container and init container of every pod
// in the namespace, for the registry pruner (cmd/felis inUseImageRefs). It is
// one list call on the pods:list grant the console already holds.
func (k *K8sCluster) PodImages(ctx context.Context) ([]string, error) {
var pods corev1.PodList
if err := k.c.List(ctx, &pods, client.InNamespace(k.namespace)); err != nil {
return nil, err
}
var images []string
for _, p := range pods.Items {
for _, c := range p.Spec.InitContainers {
images = append(images, c.Image)
}
for _, c := range p.Spec.Containers {
images = append(images, c.Image)
}
}
return images, nil
}
func (k *K8sCluster) GetBySubdomain(ctx context.Context, subdomain string) (*ServerInfo, error) {
var list v1alpha1.MinecraftServerList
if err := k.c.List(ctx, &list, client.InNamespace(k.namespace)); err != nil {