Skip to content

Commit

Permalink
Merge pull request #116 from paypal/develop
Browse files Browse the repository at this point in the history
release
  • Loading branch information
vipragupta authored Oct 13, 2021
2 parents e878f48 + d1eb0cd commit e2f702b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
16 changes: 8 additions & 8 deletions dce/monitor/plugin/default/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ func (m *monitor) Start(ctx context.Context) (types.PodStatus, error) {
return types.POD_FAILED, nil
}

if healthy == types.UNHEALTHY {
err = pod.PrintInspectDetail(pod.MonitorContainerList[i].ContainerId)
if err != nil {
log.Warnf("failed to get container detail: %s ", err)
}
return types.POD_FAILED, nil
}

if exitCode == 0 && !running {
logger.Infof("Removed finished(exit with 0) container %s from monitor list",
pod.MonitorContainerList[i])
pod.MonitorContainerList = append(pod.MonitorContainerList[:i], pod.MonitorContainerList[i+1:]...)
i--
continue
}

if healthy == types.UNHEALTHY {
err = pod.PrintInspectDetail(pod.MonitorContainerList[i].ContainerId)
if err != nil {
log.Warnf("failed to get container detail: %s ", err)
}
return types.POD_FAILED, nil
}
}

Expand Down
19 changes: 13 additions & 6 deletions utils/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -1177,13 +1177,8 @@ healthCheck:
EndStep(StepMetrics, fmt.Sprintf("HealthCheck-%s", containers[i].ServiceName),
types.GetInstanceStatusTag(containers[i], healthy, running, exitCode), err)

if err != nil || healthy == types.UNHEALTHY {
if err != nil {
log.Println("POD_INIT_HEALTH_CHECK_FAILURE -- Send Failed")

if err == nil {
err = errors.New("POD_INIT_HEALTH_CHECK_FAILURE")
}

err = PrintInspectDetail(containers[i].ContainerId)
if err != nil {
log.Warnf("Error during docker inspect: %v ", err)
Expand All @@ -1195,13 +1190,25 @@ healthCheck:

if healthy == types.HEALTHY {
healthCount++
continue
}

if exitCode == 0 && !running {
log.Printf("Remove exited(exit code = 0)container %s from monitor list", containers[i])
containers = append(containers[:i], containers[i+1:]...)
i--
healthCount--
continue
}

if healthy == types.UNHEALTHY {
log.Println("POD_INIT_HEALTH_CHECK_FAILURE -- Send Failed")
err = PrintInspectDetail(containers[i].ContainerId)
if err != nil {
log.Warnf("Error during docker inspect: %v ", err)
}
out <- types.POD_FAILED.String()
return
}

// Break health check IF only system proxy is running
Expand Down

0 comments on commit e2f702b

Please sign in to comment.