Skip to content

feat(kspm-collector): grant leader-election lease regardless of transportLayer - #2824

Draft
mech-pig wants to merge 1 commit into
mainfrom
ma/kspm-collector/http-only-lease
Draft

mech-pig wants to merge 1 commit into
mainfrom
ma/kspm-collector/http-only-lease

Conversation

@mech-pig

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Draft, opened early for RBAC review by the chart owners. It's the kspm-collector counterpart of #2787 (shield chart).

The leader-election Lease rules in the collector Role (templates/role.yaml) are rendered only when transportLayer is http, and the lock name is only required for http (templates/_helpers.tpl). The collector's HTTP transport needs both. The NATS transport is being removed from the collector, so a collector that ends up on HTTP while transportLayer still says nats would run without permission to take its lease.

Changes:

  • Always render the Lease rules, ignoring transportLayer.
  • Always require leaderElection.lockName. It already defaults to kspm-collector-leader-election and was already passed to the collector for every transport; only the required check was http-only. An explicitly empty lock name now fails at render time instead of at collector startup.
  • Mark transportLayer, natsUrl, natsMaxReconnect and natsMaxReconnectFailures as deprecated, in values.yaml comments and in the README table where the value is documented, following the convention used by other charts in this repo. The values are still accepted, so nothing breaks.
  • Fix the README's leaderElection.lockName row, which said it applied only to http.
  • Chart version 0.20.5 → 0.20.6.

RBAC impact: with transportLayer: nats, the Role now also contains the Lease rules. These are the same rules every default (http) installation already gets. Nothing changes for installations with transportLayer unset or http.

Tests: helm unittest charts/kspm-collector → 77/77 passed. I replaced "Should not create rules if transportLayer is not http" with two tests asserting the Lease rules under nats, and added a test that the lock name is required under nats. helm lint passes.

Checklist

  • Title of the PR starts with type and scope, (e.g. feat(agent,node-analyzer,sysdig-deploy):)
  • Chart Version bumped for the respective charts
  • Variables are documented in the README.md (or README.tpl in some charts)
  • All test files are added in the tests folder of their respective chart and have a "_test" suffix

🤖 Generated with Claude Code

…portLayer

The leader-election Lease rules in the Role were only rendered when
transportLayer was http, and the lock name was only required for http.
The collector's HTTP transport needs both, so a collector that ends up
on HTTP while transportLayer still says nats would run without
permission to take the lease.

- Always render the Lease rules (a collector using NATS doesn't use them).
- Always require leaderElection.lockName (it has a default).
- Mark transportLayer, natsUrl, natsMaxReconnect and
  natsMaxReconnectFailures as deprecated: the NATS transport is being
  removed and the collector will use HTTP only. The values are still
  accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant