Skip to content

Commit

Permalink
move back the first/last time inside containerlist loop
Browse files Browse the repository at this point in the history
Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>
  • Loading branch information
helayoty committed Jan 23, 2023
1 parent 92035a5 commit ef04817
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/provider/containergroup_to_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ func (p *ACIProvider) getPodStatusFromContainerGroup(ctx context.Context, cg *az

// cg is validated
allReady := true
var firstContainerStartTime, lastUpdateTime *time.Time

containerStatuses := make([]v1.ContainerStatus, 0, len(cg.Properties.Containers))
containersList := cg.Properties.Containers

//init the start/last time
firstContainerStartTime := containersList[0].Properties.InstanceView.CurrentState.StartTime
lastUpdateTime := firstContainerStartTime

for i := range containersList {
err := validation.ValidateContainer(ctx, containersList[i])
logger.Debugf("container %s has missing fields. retrying the validation...", *containersList[i].Name)
if err != nil {
return nil, err
}

firstContainerStartTime = containersList[i].Properties.InstanceView.CurrentState.StartTime
lastUpdateTime = firstContainerStartTime

containerStatus := v1.ContainerStatus{
Name: *containersList[i].Name,
State: aciContainerStateToContainerState(containersList[i].Properties.InstanceView.CurrentState),
Expand Down

0 comments on commit ef04817

Please sign in to comment.