Do not override API
@@ -125,6 +125,7 @@ func (r *ServerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
}
func (r *ServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
+ if r.RedSkyAPI == nil {
// Create a new Red Sky API
cfg := &config.RedSkyConfig{}
if err := cfg.Load(); err != nil {
@@ -140,9 +141,8 @@ func (r *ServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
r.Log.Info("Red Sky API is unavailable, skipping setup", "message", err.Error())
return nil
}
-
- // Assume the API connection is usable (or will be)
r.RedSkyAPI = api
+ }
// Enforce a one trial per-second creation limit (no burst! that is the whole point)
r.trialCreation = rate.NewLimiter(1, 1)
