Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(container-kill): Adds statusCheckTimeout to container kill recovery #498

Merged
merged 2 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion chaoslib/litmus/container-kill/helper/container-kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func killContainer(experimentsDetails *experimentTypes.ExperimentDetails, client
}

//Check the status of restarted container
err = common.CheckContainerStatus(experimentsDetails.AppNS, experimentsDetails.TargetPods, clients)
err = common.CheckContainerStatus(experimentsDetails.AppNS, experimentsDetails.TargetPods, experimentsDetails.Timeout, experimentsDetails.Delay, clients)
if err != nil {
return errors.Errorf("application container is not in running state, %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/common/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ func GetContainerID(appNamespace, targetPod, targetContainer string, clients cli
}

// CheckContainerStatus checks the status of the application container
func CheckContainerStatus(appNamespace, appName string, clients clients.ClientSets) error {
func CheckContainerStatus(appNamespace, appName string, timeout, delay int, clients clients.ClientSets) error {
return retry.
Times(90).
Wait(2 * time.Second).
Times(uint(timeout / delay)).
Wait(time.Duration(delay) * time.Second).
Try(func(attempt uint) error {
pod, err := clients.KubeClient.CoreV1().Pods(appNamespace).Get(appName, v1.GetOptions{})
if err != nil {
Expand Down