Skip to content

chore: remove the unused allow package - #3081

Open
mrueg wants to merge 1 commit into
kubernetes:mainfrom
mrueg:chore-remove-dead-allow-pkg
Open

chore: remove the unused allow package#3081
mrueg wants to merge 1 commit into
kubernetes:mainfrom
mrueg:chore-remove-dead-allow-pkg

Conversation

@mrueg

@mrueg mrueg commented Aug 10, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

pkg/allow has no references anywhere in the repository — no callers, no tests, no documentation:

$ grep -rn 'pkg/allow"\|allow\.Labels' --include='*.go' --include='*.md' .
(no matches)

Label allowlisting is implemented entirely in internal/store, via createPrometheusLabelKeysValues and the allowLabelsList threaded down from the builder. pkg/allow is a parallel implementation that nothing has called.

It has also drifted out of correctness while nothing exercised it. Allowed indexes values[i] while ranging over labels, so a values shorter than labels panics. And its nested loop appends a pair per match, so a duplicate entry in labels produces the same label name twice — which Prometheus rejects, discarding the entire scrape rather than the offending series (the same failure mode as #3064). Neither is reachable today precisely because the package is dead, but they are what carrying it forward would eventually cost.

go build ./..., go vet ./..., the full unit suite and golangci-lint run are all clean with it removed.

⚠️ This removes an exported package, so it is a breaking change for anyone importing k8s.io/kube-state-metrics/v2/pkg/allow directly. Nothing in tree does, and the package is unusable as a drop-in replacement for the internal implementation anyway, but the module is published — so this is a maintainer call rather than a mechanical cleanup.

How does this change affect the cardinality of KSM: does not change cardinality

Which issue(s) this PR fixes: N/A

Summary by CodeRabbit

  • Breaking Changes
    • Removed the default metric-label matching functionality.
    • Removed the public label filtering interface, including label definitions and permission checks.

pkg/allow has no references anywhere in the repository: no callers, no
tests, no documentation. Label allowlisting is implemented entirely in
internal/store, through createPrometheusLabelKeysValues and the
allowLabelsList threaded down from the builder.

It had also drifted out of correctness while nothing exercised it.
Allowed indexes values[i] while ranging over labels, so a shorter values
panics; and its nested loop appends a pair per match, so a duplicate
entry in labels yields the same label name twice -- which Prometheus
rejects, taking the whole scrape with it.

This removes an exported package, so it is a breaking change for anyone
importing k8s.io/kube-state-metrics/v2/pkg/allow directly.
@kubernetes-prow
kubernetes-prow Bot requested review from bhope and nmn3m August 10, 2026 23:33
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrueg

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

The pull request process is described 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

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 10, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

This issue is currently awaiting triage.

If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@github-project-automation github-project-automation Bot moved this to Needs Triage in SIG Instrumentation Aug 10, 2026
@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: af36e0f1-2b68-4330-8e7d-7f449aaac799

📥 Commits

Reviewing files that changed from the base of the PR and between 9ad03e8 and a2ff93f.

📒 Files selected for processing (1)
  • pkg/allow/allow_labels.go
💤 Files with no reviewable changes (1)
  • pkg/allow/allow_labels.go

📝 Walkthrough

Walkthrough

The pull request deletes pkg/allow/allow_labels.go. This removes default metric-label matching, the exported Labels type, the Allowed method, and internal label deduplication.

Changes

Cohort / File(s) Summary
Allow labels API removal
pkg/allow/allow_labels.go
Deletes metric-label matching, the exported Labels type, the Allowed method, and label deduplication logic.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the removal of the unused pkg/allow package, which is the main change in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant