mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
feat(region): add container info into server details (#20544)
This commit is contained in:
@@ -274,6 +274,15 @@ type ServerDetails struct {
|
||||
|
||||
// 监控上报URL
|
||||
MonitorUrl string `json:"monitor_url"`
|
||||
|
||||
// 容器描述信息
|
||||
Containers []*PodContainerDesc `json:"containers"`
|
||||
}
|
||||
|
||||
type PodContainerDesc struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Image string `json:"image"`
|
||||
}
|
||||
|
||||
type Floppy struct {
|
||||
|
||||
@@ -2612,6 +2612,22 @@ func (self *SGuest) moreExtraInfo(
|
||||
out.MonitorUrl = drv.FetchMonitorUrl(ctx, self)
|
||||
}
|
||||
|
||||
if drv != nil && drv.GetHypervisor() == api.HYPERVISOR_POD {
|
||||
ctrs, _ := GetContainerManager().GetContainersByPod(self.GetId())
|
||||
desc := make([]*api.PodContainerDesc, len(ctrs))
|
||||
for i := range ctrs {
|
||||
ctr := ctrs[i]
|
||||
desc[i] = &api.PodContainerDesc{
|
||||
Id: ctr.GetId(),
|
||||
Name: ctr.GetName(),
|
||||
}
|
||||
if ctr.Spec != nil {
|
||||
desc[i].Image = ctr.Spec.Image
|
||||
}
|
||||
}
|
||||
out.Containers = desc
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user