Skip to content

Commit 5f58c3b

Browse files
authored
Merge pull request #115 from Fedosin/requeue_after
🐛 Don't requeue provider if its spec is invalid
2 parents 41bd79f + cb48ec7 commit 5f58c3b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

internal/controller/preflight_checks.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func preflightChecks(ctx context.Context, c client.Client, provider genericprovi
6363
emptyVersionMessage,
6464
))
6565

66-
return ctrl.Result{RequeueAfter: preflightFailedRequeueAfter}, fmt.Errorf("version can't be empty for provider %s", provider.GetName())
66+
return ctrl.Result{}, fmt.Errorf("version can't be empty for provider %s", provider.GetName())
6767
}
6868

6969
// Check that provider version contains a valid value.
@@ -76,7 +76,7 @@ func preflightChecks(ctx context.Context, c client.Client, provider genericprovi
7676
err.Error(),
7777
))
7878

79-
return ctrl.Result{RequeueAfter: preflightFailedRequeueAfter}, fmt.Errorf("version contains invalid value for provider %s", provider.GetName())
79+
return ctrl.Result{}, fmt.Errorf("version contains invalid value for provider %s", provider.GetName())
8080
}
8181

8282
// Check that if a predefined provider is being installed, and if it's not - ensure that FetchConfig is specified.
@@ -107,8 +107,7 @@ func preflightChecks(ctx context.Context, c client.Client, provider genericprovi
107107
"Only one of Selector and URL must be provided, not both",
108108
))
109109

110-
return ctrl.Result{RequeueAfter: preflightFailedRequeueAfter},
111-
fmt.Errorf("only one of Selector and URL must be provided for provider %s", provider.GetName())
110+
return ctrl.Result{}, fmt.Errorf("only one of Selector and URL must be provided for provider %s", provider.GetName())
112111
}
113112

114113
if err := c.List(ctx, providerList.GetObject()); err != nil {
@@ -135,7 +134,7 @@ func preflightChecks(ctx context.Context, c client.Client, provider genericprovi
135134
preflightFalseCondition.Message = moreThanOneCoreProviderInstanceExistsMessage
136135
conditions.Set(provider, preflightFalseCondition)
137136

138-
return ctrl.Result{RequeueAfter: preflightFailedRequeueAfter}, fmt.Errorf("only one instance of CoreProvider is allowed")
137+
return ctrl.Result{}, fmt.Errorf("only one instance of CoreProvider is allowed")
139138
}
140139

141140
// For any other provider we should check that instances with similar name exist in any namespace
@@ -144,7 +143,7 @@ func preflightChecks(ctx context.Context, c client.Client, provider genericprovi
144143
log.Info(preflightFalseCondition.Message)
145144
conditions.Set(provider, preflightFalseCondition)
146145

147-
return ctrl.Result{RequeueAfter: preflightFailedRequeueAfter}, fmt.Errorf("only one %s provider is allowed in the cluster", p.GetName())
146+
return ctrl.Result{}, fmt.Errorf("only one %s provider is allowed in the cluster", p.GetName())
148147
}
149148
}
150149

0 commit comments

Comments
 (0)