Skip to content

Commit 044d3c2

Browse files
Remove message from Runtime SDK FailureResponses
Signed-off-by: killianmuldoon <[email protected]>
1 parent 1ec0cd6 commit 044d3c2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

internal/runtime/client/client.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ func (c *client) Discover(ctx context.Context, extensionConfig *runtimev1.Extens
142142

143143
// Check to see if the response is a failure and handle the failure accordingly.
144144
if response.GetStatus() == runtimehooksv1.ResponseStatusFailure {
145-
return nil, errors.Errorf("failed to discover extension %q: got failure response with message %q", extensionConfig.Name, response.GetMessage())
145+
log.Info(fmt.Sprintf("failed to discover extension %q: got failure response with message %v", extensionConfig.Name, response.GetMessage()))
146+
// Don't add the message to the error as it is may be unique causing too many reconciliations. Ref: https://github.com/kubernetes-sigs/cluster-api/issues/6921
147+
return nil, errors.Errorf("failed to discover extension %q: got failure response", extensionConfig.Name)
146148
}
147149

148150
// Check to see if the response is valid.
@@ -364,8 +366,9 @@ func (c *client) CallExtension(ctx context.Context, hook runtimecatalog.Hook, fo
364366

365367
// If the received response is a failure then return an error.
366368
if response.GetStatus() == runtimehooksv1.ResponseStatusFailure {
367-
log.Error(err, "extension handler returned a failure response")
368-
return errors.Errorf("failed to call extension handler %q: got failure response with message %q", name, response.GetMessage())
369+
log.Error(err, "extension handler returned a failure response with message: %v", response.GetMessage())
370+
// Don't add the message to the error as it is may be unique causing too many reconciliations. Ref: https://github.com/kubernetes-sigs/cluster-api/issues/6921
371+
return errors.Errorf("failed to call extension handler %q: got failure response", name)
369372
}
370373

371374
if retryResponse, ok := response.(runtimehooksv1.RetryResponseObject); ok && retryResponse.GetRetryAfterSeconds() != 0 {

0 commit comments

Comments
 (0)