mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-29 18:27:58 +08:00
[FIX] InitContainers has nil element
This commit is contained in:
parent
b290761743
commit
7d02944bdf
@ -1087,7 +1087,3 @@ func checkActionFinish(serviceID string, optTypes ...string) bool {
|
||||
func parseLabels(labels map[string]string) (string, string, string, string) {
|
||||
return labels["tenant_id"], labels["service_id"], labels["version"], labels["creater_id"]
|
||||
}
|
||||
|
||||
func recordUpdateEvent(old, new *corev1.Pod) {
|
||||
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ func (r *RuntimeServer) GetPodDetail(ctx context.Context, req *pb.GetPodDetailRe
|
||||
podDetail.Events = append(podDetail.Events, events...)
|
||||
}
|
||||
|
||||
if len(pod.Spec.InitContainers) == 0 {
|
||||
if len(pod.Spec.InitContainers) != 0 {
|
||||
describeContainers(pod.Spec.InitContainers, pod.Status.InitContainerStatuses, &podDetail.InitContainers)
|
||||
}
|
||||
describeContainers(pod.Spec.Containers, pod.Status.ContainerStatuses, &podDetail.Containers)
|
||||
@ -128,8 +128,7 @@ func describeContainers(containers []corev1.Container, containerStatuses []corev
|
||||
statuses[status.Name] = status
|
||||
}
|
||||
|
||||
var pcs []*pb.PodContainer
|
||||
for _, container := range containers {
|
||||
for idx, container := range containers {
|
||||
status, ok := statuses[container.Name]
|
||||
pc := &pb.PodContainer{
|
||||
Image: container.Image,
|
||||
@ -138,9 +137,9 @@ func describeContainers(containers []corev1.Container, containerStatuses []corev
|
||||
describeContainerState(status, pc)
|
||||
}
|
||||
describeContainerResource(container, pc)
|
||||
pcs = append(pcs, pc)
|
||||
pcs := *podContainers
|
||||
pcs[idx] = pc
|
||||
}
|
||||
*podContainers = pcs
|
||||
}
|
||||
|
||||
func describeContainerState(status corev1.ContainerStatus, podContainer *pb.PodContainer) {
|
||||
|
Loading…
Reference in New Issue
Block a user