You need to sign in or sign up before continuing.
提交 58a58a29 编写于 作者: J jeff

query workload pods in a graceful way, which supports paging

上级 106c2aad
......@@ -175,6 +175,14 @@ func (ctl *PodCtl) generateObject(item v1.Pod) *Pod {
createTime := item.CreationTimestamp.Time
containerStatus := item.Status.ContainerStatuses
containerSpecs := item.Spec.Containers
var ownerKind, ownerName string
// For ReplicaSet,ReplicaController,DaemonSet,StatefulSet,Job,CronJob, k8s will automatically
// set ownerReference for pods, in case of setting ownerReference manually.
if item.OwnerReferences != nil && len(item.OwnerReferences) > 0 {
ownerKind = item.OwnerReferences[0].Kind
ownerName = item.OwnerReferences[0].Name
}
var containers Containers
......@@ -204,6 +212,8 @@ func (ctl *PodCtl) generateObject(item v1.Pod) *Pod {
Annotation: MapString{item.Annotations},
Containers: containers,
RestartCount: restartCount,
OwnerKind: ownerKind,
OwnerName: ownerName,
Labels: MapString{item.Labels},
}
......
......@@ -219,6 +219,8 @@ type Pod struct {
Containers Containers `gorm:"type:text" json:"containers,omitempty"`
Annotation MapString `json:"annotations"`
Labels MapString `json:"labels"`
OwnerKind string `gorm:"column:ownerKind" json:"ownerKind,omitempty"`
OwnerName string `gorm:"column:ownerName" json:"ownerName,omitempty"`
RestartCount int `json:"restartCount"`
CreateTime time.Time `gorm:"column:createTime" json:"createTime,omitempty"`
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册