Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 850c9e3

Browse files
author
Per Goncalves da Silva
committedMay 7, 2025·
Make bad resource failures terminal
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent dfe79f2 commit 850c9e3

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
 

‎pkg/controller/install/deployment.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ func (i *StrategyDeploymentInstaller) Install(s Strategy) error {
206206
if apierrors.IsForbidden(err) {
207207
return StrategyError{Reason: StrategyErrInsufficientPermissions, Message: fmt.Sprintf("install strategy failed: %s", err)}
208208
}
209+
if apierrors.IsInvalid(err) || apierrors.IsBadRequest(err) {
210+
return StrategyError{Reason: StrategyErrBadResource, Message: fmt.Sprintf("%s", err)}
211+
}
212+
log.Debugf("[debug] failed to install strategy %s: %v", strategy.GetStrategyName(), err)
209213
return err
210214
}
211215

‎pkg/controller/install/errors.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const (
1010
StrategyErrBadPatch = "PatchUnsuccessful"
1111
StrategyErrDeploymentUpdated = "DeploymentUpdated"
1212
StrategyErrInsufficientPermissions = "InsufficentPermissions"
13+
StrategyErrBadResource = "BadResource"
1314
)
1415

1516
// unrecoverableErrors are the set of errors that mean we can't recover an install strategy
@@ -18,6 +19,7 @@ var unrecoverableErrors = map[string]struct{}{
1819
StrategyErrReasonTimeout: {},
1920
StrategyErrBadPatch: {},
2021
StrategyErrInsufficientPermissions: {},
22+
StrategyErrBadResource: {},
2123
}
2224

2325
// StrategyError is used to represent error types for install strategies

‎pkg/controller/operators/olm/operator.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,9 @@ func (a *Operator) transitionCSVState(in v1alpha1.ClusterServiceVersion) (out *v
22152215
}
22162216

22172217
if syncError = installer.Install(strategy); syncError != nil {
2218+
logger.Debugf("debugmark %v", syncError)
2219+
logger.Debugf("debugmark %#v", syncError)
2220+
logger.Debugf("debugmark %+v", syncError)
22182221
if install.IsErrorUnrecoverable(syncError) {
22192222
logger.Infof("Setting CSV reason to failed without retry: %v", syncError)
22202223
out.SetPhaseWithEvent(v1alpha1.CSVPhaseFailed, v1alpha1.CSVReasonComponentFailedNoRetry, fmt.Sprintf("install strategy failed: %s", syncError), now, a.recorder)

0 commit comments

Comments
 (0)
Please sign in to comment.