fix(discovery): Do not fail if missing a subset of resources during API discover #406
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of this PR is to avoid completely failing API discovery if only a subset of resources fail to be fetched.
In my particular case, another team managing keda-operator-metrics-apiserver occasionally goes into a bad state causing an error discovery resources. If metacontroller is starting up for the first time, then it will get an error fetching resources and be blocked until the keda operator is in a good state and responds with resources during API discovery.
{"level":"error","ts":1638640761.0517867,"msg":"Failed to fetch discovery info","error":"unable to retrieve the complete list of server APIs: external.metrics.k8s.io/v1beta1: the server is currently unable to handle the request","stacktrace":"metacontroller/pkg/dynamic/discovery.(*ResourceMap).Start.func1\n\t/go/src/metacontroller/pkg/dynamic/discovery/discovery.go:179"}