Skip to content

Commit

Permalink
hack to make stuff settle
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkarlsen committed Aug 24, 2020
1 parent 0ac25a4 commit 7ec3206
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions controllers/githubactionrunner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"strings"
"time"

garov1alpha1 "github.com/evryfs/github-actions-runner-operator/api/v1alpha1"
)
Expand Down Expand Up @@ -119,6 +120,11 @@ func (r *GithubActionRunnerReconciler) Reconcile(req ctrl.Request) (ctrl.Result,
return runner.GetName()
}).([]string)

podList, err := r.listRelatedPods(instance, corev1.PodRunning)
if err != nil {
return result, err
}

for _, pod := range podList.Items {
if !funk.Contains(busyRunnerNames, pod.GetName()) {
var propagationPolicy = metav1.DeletePropagationForeground
Expand All @@ -129,6 +135,8 @@ func (r *GithubActionRunnerReconciler) Reconcile(req ctrl.Request) (ctrl.Result,
r.Recorder.Event(instance, corev1.EventTypeNormal, "Scaling", fmt.Sprintf("Deleted pod %s/%s", pod.Namespace, pod.Name))
}

//awful hack
time.Sleep(3 * time.Second)
return result, err
}
}
Expand Down

0 comments on commit 7ec3206

Please sign in to comment.