Enhance RunnerSet to optionally retain PVs accross restarts (#1340)

* Enhance RunnerSet to optionally retain PVs accross restarts

This is our initial attempt to bring back the ability to retain PVs across runner pod restarts when using RunnerSet.
The implementation is composed of two new controllers, `runnerpersistentvolumeclaim-controller` and `runnerpersistentvolume-controller`.
It all starts from our existing `runnerset-controller`. The controller now tries to mark any PVCs created by StatefulSets created for the RunnerSet.
Once the controller terminated statefulsets, their corresponding PVCs are clean up by `runnerpersistentvolumeclaim-controller`, then PVs are unbound from their corresponding PVCs by `runnerpersistentvolume-controller` so that they can be reused by future PVCs createf for future StatefulSets that shares the same same StorageClass.

Ref #1286

* Update E2E test suite to cover runner, docker, and go caching with RunnerSet + PVs

Ref #1286
This commit is contained in:
Yusuke Kuoka
2022-05-16 09:26:48 +09:00
committed by GitHub
parent adf69bbea0
commit b5194fd75a
10 changed files with 610 additions and 4 deletions

22
main.go
View File

@@ -240,6 +240,18 @@ func main() {
GitHubClient: ghClient,
}
runnerPersistentVolumeReconciler := &controllers.RunnerPersistentVolumeReconciler{
Client: mgr.GetClient(),
Log: log.WithName("runnerpersistentvolume"),
Scheme: mgr.GetScheme(),
}
runnerPersistentVolumeClaimReconciler := &controllers.RunnerPersistentVolumeClaimReconciler{
Client: mgr.GetClient(),
Log: log.WithName("runnerpersistentvolumeclaim"),
Scheme: mgr.GetScheme(),
}
if err = runnerPodReconciler.SetupWithManager(mgr); err != nil {
log.Error(err, "unable to create controller", "controller", "RunnerPod")
os.Exit(1)
@@ -250,6 +262,16 @@ func main() {
os.Exit(1)
}
if err = runnerPersistentVolumeReconciler.SetupWithManager(mgr); err != nil {
log.Error(err, "unable to create controller", "controller", "RunnerPersistentVolume")
os.Exit(1)
}
if err = runnerPersistentVolumeClaimReconciler.SetupWithManager(mgr); err != nil {
log.Error(err, "unable to create controller", "controller", "RunnerPersistentVolumeClaim")
os.Exit(1)
}
if err = (&actionsv1alpha1.Runner{}).SetupWebhookWithManager(mgr); err != nil {
log.Error(err, "unable to create webhook", "webhook", "Runner")
os.Exit(1)