Fix manager crashloopback for ARC deployments without scaleset-related controllers (#2293)

This commit is contained in:
Yusuke Kuoka 2023-02-21 08:18:59 +09:00 committed by GitHub
parent 274d0c874e
commit a44fe04bef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 68 additions and 58 deletions

12
main.go
View File

@ -317,7 +317,17 @@ func main() {
}
}
// We use this environment avariable to turn on the ScaleSet related controllers.
// Otherwise ARC's legacy chart is unable to deploy a working ARC controller-manager pod,
// due to that the chart does not contain new actions.* CRDs while ARC requires those CRDs.
//
// We might have used a more explicitly named environment variable for this,
// e.g. "CONTROLLER_MANAGER_ENABLE_SCALE_SET" to explicitly enable the new controllers,
// or "CONTROLLER_MANAGER_DISABLE_SCALE_SET" to explicitly disable the new controllers.
// However, doing so would affect either private ARC testers or current ARC users
// who run ARC without those variabls.
mgrPodName := os.Getenv("CONTROLLER_MANAGER_POD_NAME")
if mgrPodName != "" {
mgrPodNamespace := os.Getenv("CONTROLLER_MANAGER_POD_NAMESPACE")
var mgrPod corev1.Pod
err = mgr.GetAPIReader().Get(context.Background(), types.NamespacedName{Namespace: mgrPodNamespace, Name: mgrPodName}, &mgrPod)
@ -340,7 +350,6 @@ func main() {
log.Error(err, "unable to obtain manager container image")
os.Exit(1)
}
if err = (&actionsgithubcom.AutoscalingRunnerSetReconciler{
Client: mgr.GetClient(),
Log: log.WithName("AutoscalingRunnerSet"),
@ -382,6 +391,7 @@ func main() {
os.Exit(1)
}
// +kubebuilder:scaffold:builder
}
if !disableAdmissionWebhook && !autoScalingRunnerSetOnly {
injector := &actionssummerwindnet.PodRunnerTokenInjector{