Skip to content

fix: skip non-Kubernetes entries in analyze output#484

Open
immanuwell wants to merge 1 commit into
etcd-io:mainfrom
immanuwell:fix/analyze-skip-non-k8s-entries
Open

fix: skip non-Kubernetes entries in analyze output#484
immanuwell wants to merge 1 commit into
etcd-io:mainfrom
immanuwell:fix/analyze-skip-non-k8s-entries

Conversation

@immanuwell

Copy link
Copy Markdown

this fixes a panic in auger analyze when the db has non-Kubernetes keys like compact_rev_key.

it was assuming every entry had TypeMeta, so the Largest objects section could blow up. this skips entries without Kubernetes metadata and adds a regression test.

how to repro

go run . analyze -f cmd/testdata/boltdb/db

before this panics with a nil pointer dereference

after it prints the report and exits cleanly

@k8s-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: immanuwell
Once this PR has been reviewed and has the lgtm label, please assign wenjiaswe for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: immanuwell <pchpr.00@list.ru>
@immanuwell
immanuwell force-pushed the fix/analyze-skip-non-k8s-entries branch from 39828d7 to d6fef93 Compare June 1, 2026 05:39
Comment thread cmd/analyze.go
@@ -45,7 +47,11 @@ func init() {
}

func analyzeValidateAndRun() error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this func still needed?

Comment thread cmd/analyze.go
for i, entry := range entries {
fmt.Printf("\t%d\t%s\n", entry.count, entry.gvk)
if i > 10 {
if i >= 10 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. is the change from i > 10 to i >= 10 relevant to the fix?

Comment thread cmd/analyze.go
fmt.Printf("Current (latest revision) storage used by kubernetes objects: %d\n", totalKeySize+totalValueSize)
fmt.Printf("\n")
fmt.Printf("Most common kubernetes types:\n")
fmt.Fprintf(out, "Total kubernetes objects: %d\n", len(summaries))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Fprintf(out, "Total kubernetes objects: %d\n", len(summaries))
fmt.Fprintf(out, "Total objects: %d\n", len(summaries))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants