Skip to content

Commit

Permalink
Synchronously delete pod #85
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkarlsen committed Aug 24, 2020
1 parent 73df6ea commit 7edd2e8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions controllers/githubactionrunner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,10 @@ func (r *GithubActionRunnerReconciler) Reconcile(req ctrl.Request) (ctrl.Result,
return runner.GetName()
}).([]string)

//only consider pods with running status
podList, err = r.listRelatedPods(instance, corev1.PodRunning)
if err != nil {
return result, err
}
for _, pod := range podList.Items {
if !funk.Contains(busyRunnerNames, pod.GetName()) {
err = r.Client.Delete(context.TODO(), &pod, &client.DeleteOptions{})
var propagationPolicy = metav1.DeletePropagationForeground
err = r.Client.Delete(context.TODO(), &pod, &client.DeleteOptions{PropagationPolicy: &propagationPolicy})
if err == nil {
instance.Status.CurrentSize--
r.Recorder.Event(instance, corev1.EventTypeNormal, "Scaling", fmt.Sprintf("Deleted pod %s/%s", pod.Namespace, pod.Name))
Expand Down

0 comments on commit 7edd2e8

Please sign in to comment.