Skip to content

Commit

Permalink
apiservercontrollerset: propagate errors that occurred during object/…
Browse files Browse the repository at this point in the history
…controller construction
  • Loading branch information
p0lyn0mial committed May 6, 2021
1 parent 6969150 commit cb236f2
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -43,6 +43,8 @@ type preparedAPIServerControllerSet struct {

type controllerWrapper struct {
emptyAllowed bool
// creationError allows for reporting errors that occurred during object creation
creationError error
controller
}

Expand All @@ -54,6 +56,9 @@ func (cw *controllerWrapper) prepare() (controller, error) {
if !cw.emptyAllowed && cw.controller == nil {
return nil, fmt.Errorf("missing controller")
}
if cw.creationError != nil {
return nil, cw.creationError
}

return cw.controller, nil
}
Expand Down Expand Up @@ -401,7 +406,7 @@ func (e *encryptionControllerBuilder) build() controllerWrapper {
if e.emptyAllowed {
return e.controllerWrapper
}
e.controllerWrapper.controller = encryption.NewControllers(
e.controllerWrapper.controller, e.controllerWrapper.creationError = encryption.NewControllers(
e.component,
e.unsupportedConfigPrefix,
e.provider,
Expand Down

0 comments on commit cb236f2

Please sign in to comment.