discovery/rds: skip DB clusters whose ARN is unset - #19501
Open
r0h1tb wants to merge 1 commit into
Open
Conversation
DBClusterArn is optional in the DescribeDBClusters response. The explicit-cluster path (config: clusters) stores the returned cluster keyed by the configured ARN without checking the ARN came back, so a cluster response missing it panicked the refresh goroutine at the describeDBInstances call. Skip the cluster like describeAllDBClusters already does for the same field, and say so in the log. Signed-off-by: Rohit Behera <126186063+r0h1tb@users.noreply.github.com>
Collaborator
|
In what situation would you have a cluster without an ARN??? Or is this just to be more defensive, in which case I'm all for it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes a panic in the RDS service discovery refresh; no tracking issue, found by code reading in the same class as #19324/#19396.
Problem
refresh()dereferences*cluster.DBClusterArnto look up the cluster's instances (rds.go:540 on main).DBClusterArnis optional in theDescribeDBClustersresponse — the SDK marks no member ofDBClusteras required — so a cluster response missing it panics the refresh goroutine and takes the whole process down.The explicit-cluster path (
clusters:config) reaches this most easily:describeDBClustersstores whatever the API returns keyed by the configured ARN without checking the ARN came back.describeAllDBClustersalready skips ARN-less clusters (rds.go:421), which is why the all-clusters path never trips this.Fix
Skip the cluster with a warning, mirroring the existing
describeAllDBClustersbehaviour and the "Skipping invalid ElastiCache ARN" precedent in elasticache.go.Tests
TestRDSRefreshSkipsClusterWithoutArndrives the realrefresh()— the existing table test rebuilds the target list inline and never calls it, which is how this survived review. Against unfixed code:With the fix the ARN-less cluster is skipped, the healthy cluster in the same config still produces its target, and the package suite is green (
ok github.com/prometheus/prometheus/discovery/aws, matching main).