Prevent runner pod deletion delay when pod disappeared before unregistration

This commit is contained in:
Yusuke Kuoka
2022-02-27 11:55:06 +00:00
parent 59c3288e87
commit 11be6c1fb6
2 changed files with 57 additions and 10 deletions

View File

@@ -447,6 +447,20 @@ func (r *RunnerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
return ctrl.Result{}, nil
}
func runnerContainerExitCode(pod *corev1.Pod) *int32 {
for _, status := range pod.Status.ContainerStatuses {
if status.Name != containerName {
continue
}
if status.State.Terminated != nil {
return &status.State.Terminated.ExitCode
}
}
return nil
}
func runnerPodOrContainerIsStopped(pod *corev1.Pod) bool {
// If pod has ended up succeeded we need to restart it
// Happens e.g. when dind is in runner and run completes