RANGER-5719: Shared partition-plan library and SPIFFE header auth utilities - #1137
Open
ramackri wants to merge 5 commits into
Open
RANGER-5719: Shared partition-plan library and SPIFFE header auth utilities#1137ramackri wants to merge 5 commits into
ramackri wants to merge 5 commits into
Conversation
ramackri
pushed a commit
to ramackri/ranger
that referenced
this pull request
Aug 6, 2026
Wire PluginHeaderAuthConfig into RangerAuditServerDestination so plugins send X-Spiffe-Id on audit POSTs when xasecure.audit.destination.auditserver.authn.header.enabled=true. Requires RANGER-5719 (apache#1137) for PluginHeaderAuthConfig and setTrustedAuthHeaders().
…uting Add agents-common partition plan model, allocator, validator, routing helpers, and PolicyDownloadAuthUsersUtil for RANGER-5655. SPIFFE header utilities move to RANGER-5723 (apache#1139).
ramackri
force-pushed
the
RANGER-5719-patch
branch
from
August 6, 2026 03:15
c4cf544 to
0ced753
Compare
added 3 commits
August 6, 2026 13:02
Drop scalePlugin, replacePlan, isPromoteAlreadyApplied, sameContentAs, toAllowedUserSets, hashToSlotIndex, and related helpers that no production caller uses in the 5721/5722 design; can reintroduce when scaling or bulk replace is wired.
Remove PluginEntry.empty(), the four-arg promotePlugin overload, and DEFAULT_AUDIT_TOPIC (tests use the literal topic name).
No callers in apache#1137, rangerRelease 5721/5722, or tests; plans are built via plugins(map).
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a shared “audit partition plan” library under agents-common to model, validate, allocate, and route Admin-managed Kafka audit partitions, with accompanying unit tests to lock down expected behaviors and JSON compatibility.
Changes:
- Added canonical JSON model types for the partition plan (
PartitionPlan,PluginEntry,BufferEntry) plus JSON round-trip support. - Added core utilities for plan lifecycle and runtime use: allocation/mutation (
PartitionPlanAllocator), validation (PartitionPlanValidator), and routing helpers (PartitionPlanRoutingUtils). - Added supporting utilities/constants (
AuditPartitionPlanConstants,AuditPartitionPlanAdminConfig,PolicyDownloadAuthUsersUtil) and a focused unit test suite.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| agents-common/src/main/java/org/apache/ranger/audit/partition/AuditPartitionPlanAdminConfig.java | Reads Admin configuration to determine per-plugin partition allocation defaults/overrides. |
| agents-common/src/main/java/org/apache/ranger/audit/partition/AuditPartitionPlanConstants.java | Defines shared constants for the partition plan feature (defaults + property keys). |
| agents-common/src/main/java/org/apache/ranger/audit/partition/PartitionPlanAllocator.java | Implements append-only mutation helpers for promoting plugins/onboarding services/updating allow-lists. |
| agents-common/src/main/java/org/apache/ranger/audit/partition/PartitionPlanRoutingUtils.java | Converts logical plan partition IDs to Kafka producer partition indices (0-based) with clamping. |
| agents-common/src/main/java/org/apache/ranger/audit/partition/PartitionPlanValidator.java | Validates plan structure and enforces append-only constraints across updates. |
| agents-common/src/main/java/org/apache/ranger/audit/partition/PolicyDownloadAuthUsersUtil.java | Parses/normalizes policy.download.auth.users values used for ingestor authorization metadata. |
| agents-common/src/main/java/org/apache/ranger/audit/partition/exception/PartitionPlanException.java | Defines a dedicated runtime exception type for plan validation/allocation failures. |
| agents-common/src/main/java/org/apache/ranger/audit/partition/model/BufferEntry.java | Models buffer partitions portion of the plan for future plugin promotions. |
| agents-common/src/main/java/org/apache/ranger/audit/partition/model/PartitionPlan.java | Core JSON model + (de)serialization entrypoints and builder. |
| agents-common/src/main/java/org/apache/ranger/audit/partition/model/PluginEntry.java | Models per-plugin partitions and associated Ranger service repos. |
| agents-common/src/test/java/org/apache/ranger/audit/partition/AuditPartitionPlanAdminConfigTest.java | Verifies default/override resolution behavior for Admin config. |
| agents-common/src/test/java/org/apache/ranger/audit/partition/PartitionPlanAllocatorTest.java | Exercises allocator mutations (promotion/onboarding/removal/allow-list updates). |
| agents-common/src/test/java/org/apache/ranger/audit/partition/PartitionPlanRoutingUtilsTest.java | Verifies logical-id → Kafka-index mapping and clamping behavior. |
| agents-common/src/test/java/org/apache/ranger/audit/partition/PartitionPlanTestSupport.java | Provides reusable seed/pre-assigned plan fixtures for tests. |
| agents-common/src/test/java/org/apache/ranger/audit/partition/PartitionPlanValidatorTest.java | Covers validator rejection/acceptance scenarios and append-only constraints. |
| agents-common/src/test/java/org/apache/ranger/audit/partition/PolicyDownloadAuthUsersUtilTest.java | Verifies parsing/normalization rules for allow-list values. |
| agents-common/src/test/java/org/apache/ranger/audit/partition/model/PartitionPlanJsonTest.java | Validates JSON round-trip stability for seed/onboarded/allow-list variants. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
rameeshm
reviewed
Aug 14, 2026
- Reject null plugin entries, non-contiguous partition ids, and ineffective allow-lists - Split append-only validation messages; allow metadata updates at same partition count - Simplify tail partition allocation; harden allow-list normalization against null elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First PR in the RANGER-5655 series — Admin-managed Kafka audit partition plan.
JIRA: RANGER-5719
Split from closed #1135.
This PR adds the partition plan library only (+1,789 lines, 17 files). It does not change runtime behavior, SPIFFE auth, Admin REST, ingestor, or DB schema. Safe to merge independently.
SPIFFE header utilities and
RangerRESTClient.setTrustedAuthHeaders()are in #1139 (RANGER-5723).Partition plan library (
agents-common)Canonical JSON model stored in Admin
x_ranger_global_state(RangerAuditPartitionPlan):PartitionPlan,PluginEntry,BufferEntryPartitionPlanAllocatorPartitionPlanValidatorPartitionPlanRoutingUtilsPolicyDownloadAuthUsersUtilpolicy.download.auth.usersper service for ingestor allow-listsAuditPartitionPlanAdminConfigpartitions.per.plugin, per-plugin overrides)AuditPartitionPlanConstantsranger_auditstopic, initial version, property names)Tests: allocator, validator, routing, JSON round-trip, allow-list extraction.
Related PRs — RANGER-5655 merge order
AuditPartitionPlanMgrAuditPluginIdResolverdeferred to RANGER-5721.Test plan
mvn -pl agents-common -am test— partition plan unit tests passbuild-17,plugins-docker-build,services-docker-build