Skip to content

refactor(common): one hasTaint for the agent's taint remover and the controller's guard - #1173

Merged
bpalermo merged 3 commits into
mainfrom
refactor/consolidate-has-taint
Oct 3, 2026
Merged

bpalermo merged 3 commits into
mainfrom
refactor/consolidate-has-taint

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 3, 2026

Copy link
Copy Markdown
Owner

What

The two writers of the proposal 033 node taint each had a private hasTaint with the same body:

  • agent/internal/node/taint.go:47: the agent's TaintRemover
  • controller/internal/nodetaint/guard.go:225: the controller's re-arm Guard

The controller must not import agent internals, so the function moves to a new leaf package, common/taint, as taint.Has(node, key). That package's only dependency is k8s.io/api/core/v1, and both callers already link it. Both production call sites and the three test files that used hasTaint as an assertion helper now call taint.Has.

Tests: hasTaint had no direct unit test, so there was nothing to move. Every existing test in both packages is unchanged apart from the call rename.

Proof the copies were identical

Signatures and bodies on origin/main, compared with a function-extracting diff:

IDENTICAL: agent/internal/node/taint.go:hasTaint == controller/internal/nodetaint/guard.go:hasTaint (8 lines)

Module counts (bazel query 'deps(<bin>)', external repos / external labels)

binary before after
//agent/cmd/agent 116 / 7408 116 / 7408
//controller/cmd/controller 109 / 6765 109 / 6765
//registrar/cmd/registrar 117 / 6921 117 / 6921
//cni/cmd/cni 47 / 2082 47 / 2082
//agent/cmd/mesh-dns 37 / 2023 37 / 2023
//agent/cmd/proxy-supervisor 31 / 1645 31 / 1645

Verification

  • bazel test --config=race on //agent/internal/node:all and //controller/internal/nodetaint:all: all pass.
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: clean.
  • make format-check: clean.
  • make gazelle: done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 3 commits October 3, 2026 19:13
…controller's guard

The node agent's TaintRemover and the controller's nodetaint Guard each had a
private hasTaint with the same body. The controller must not import agent
internals, so it moves to a new leaf package, common/taint (Has), whose only
dependency is k8s.io/api/core/v1. Both packages already link that.

Pure refactor: no behaviour change, no binary gains a module.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 97313c9 into main Oct 3, 2026
24 checks passed
@bpalermo
bpalermo deleted the refactor/consolidate-has-taint branch October 3, 2026 22:58
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