Skip to content

acl/agent/connect: close remaining tracked endpoint gaps#124

Open
mbrulatout wants to merge 4 commits into
criteo:masterfrom
mbrulatout:final-endpoint-gaps
Open

acl/agent/connect: close remaining tracked endpoint gaps#124
mbrulatout wants to merge 4 commits into
criteo:masterfrom
mbrulatout:final-endpoint-gaps

Conversation

@mbrulatout

Copy link
Copy Markdown
Contributor

Summary

Closes out essentially every remaining gap tracked in ENDPOINT_STATUS.md. After this, everything left unmarked is an intentional exclusion (Enterprise-only, deprecated legacy intentions, or Agent.monitor()'s documented streaming limitation).

  • ACL Token: policy/role/authmethod/servicename filters on list(); service_identities, expiration_time, expiration_ttl, local on create()/update(). Also extracted the policy/role/templated-policy body-building logic (identical in both methods) into shared typed helpers — a DRY fix that also resolved a pylint too-many-branches violation the duplication caused.
  • ACL Policy: added update() and delete() — the only two CRUD gaps left.
  • Agent: filter+token on services()/checks(); prune on force_leave(); Kind/Proxy/SocketPath/Locality on Service.register().
  • Connect: CA.update_configuration(), the write counterpart to the existing read-only configuration().

Also: removed the unused features/ registry

Not part of this PR's diff (it turned out consul/features/*.py and tests/test_features.py were never committed to any branch — confirmed via git log --all), but worth noting: those files, sitting locally the whole time, accounted for the "6 pre-existing unrelated test failures" mentioned across every prior PR in this series. They're gone now, which is why this PR's own CI should be fully clean rather than showing that familiar noise.

Real findings from live-probing

  • Consul rejects a service identity's Datacenters scoping when combined with Local: true ("cannot specify a list of datacenters on a local token") — a real, non-obvious interaction, covered by two separate tests instead of one combined one.
  • Rules on ACL Policy must be passed as a dict (JSON-syntax ACL rules) that gets json.dumps()'d once, not a raw HCL string — matches the existing (previously untested) convention in create().
  • A connect-proxy service registration requires a top-level Port or SocketPath, distinct from Proxy.LocalServicePort.
  • Force-leaving a node Consul has never seen is a real server-side error (500), not a no-op success.

Test plan

  • Full pre-commit run --all-files (ruff, ruff format, pylint, mypy) — clean, run from scratch multiple times during development after two real pylint/ruff-mccabe violations were caught and fixed (Token.create/update's branch count, Service.register's cyclomatic complexity)
  • Full test suite — 394 passed, 0 failed

Mathias Brulatout added 4 commits July 6, 2026 10:45
Token: add policy/role/authmethod/servicename filters to list();
add service_identities, expiration_time, expiration_ttl, local to
create()/update(). Extracted the duplicated policy/role/templated-
policy body-building logic (identical in create() and update())
into shared, typed helper functions -- both a DRY cleanup and a fix
for a pylint too-many-branches violation the duplication caused.

Policy: add update() and delete(), the two CRUD operations that
were still missing.

Verified against a live Consul instance that Local=true tokens
reject a service identity's Datacenters scoping (a real,
undocumented-in-the-obvious-place interaction), and that Rules must
be passed as a dict (JSON-syntax ACL rules), not a raw HCL string --
matches the existing create() convention.
Adds filter (bexpr) and token to services()/checks(); prune to
force_leave() (Consul 1.13+); Kind/Proxy/SocketPath/Locality to
Service.register(). Extracted the new register() fields into a
small helper to keep it under ruff's mccabe complexity limit -- it
was already at the edge before this change.

Verified against a live Consul instance that a connect-proxy
registration requires a top-level Port or SocketPath (distinct from
Proxy.LocalServicePort), and that force-leave on a node Consul has
never seen is a real server-side error, not a no-op success.
Adds Connect.CA.update_configuration() for PUT /v1/connect/ca/
configuration, the write counterpart to the existing read-only
configuration(). Requires operator:write (elevated from
operator:read prior to Consul 1.6.10/1.7.10/1.8.6).
Marks Agent, ACL Token/Policy, and Connect CA as fully covered.
Every remaining entry not marked done is an intentional exclusion:
Enterprise-only params/endpoints, the deprecated pre-1.9 legacy
intentions model, and Agent.monitor()'s documented lack of true
streaming.
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