-
Notifications
You must be signed in to change notification settings - Fork 790
cluster_link: shadow link roles migrator #30946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nguyen-andrew
merged 10 commits into
redpanda-data:dev
from
nguyen-andrew:sl-role-sync-task-pr2
Jun 30, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a82034e
cluster_link: add role create/update/delete to security_service
nguyen-andrew 24e1d02
cluster_link: add pure role reconciliation diff
nguyen-andrew f2f2748
cluster_link: add roles migrator
nguyen-andrew 106b3c0
cluster_link: test roles migrator
nguyen-andrew f0c89a3
tests: shadow-link roles sync ducktape e2e
nguyen-andrew 6f979db
tests: cover role-sync authority being bounded to in-scope roles
nguyen-andrew 6603c92
tests: cover role sync parking against an Apache Kafka source
nguyen-andrew 55dd0cb
tests: cover functional authz over synced roles + ACLs
nguyen-andrew d9c67f3
tests: cover role sync recovering on a source permission grant
nguyen-andrew e2e4377
tests: cover roles migrator task in test_task_states_change
nguyen-andrew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Copyright 2026 Redpanda Data, Inc. | ||
| * | ||
| * Use of this software is governed by the Business Source License | ||
| * included in the file licenses/BSL.md | ||
| * | ||
| * As of the Change Date specified in that file, in accordance with | ||
| * the Business Source License, use of this software will be governed | ||
| * by the Apache License, Version 2.0 | ||
| */ | ||
|
|
||
| #include "cluster_link/role_reconcile.h" | ||
|
|
||
| #include "container/chunked_hash_map.h" | ||
|
|
||
| namespace cluster_link { | ||
|
|
||
| role_changes reconcile_roles( | ||
| chunked_vector<security::role_with_members> source_selected, | ||
| chunked_vector<security::role_with_members> shadow_selected) { | ||
| auto to_map = [](chunked_vector<security::role_with_members> roles) { | ||
| chunked_hash_map<security::role_name, security::role> m; | ||
| m.reserve(roles.size()); | ||
| for (auto& r : roles) { | ||
| m.emplace(std::move(r.name), std::move(r.role)); | ||
| } | ||
| return m; | ||
| }; | ||
| auto source = to_map(std::move(source_selected)); | ||
| auto shadow = to_map(std::move(shadow_selected)); | ||
|
|
||
| role_changes changes; | ||
| for (auto& [src_name, src_role] : source) { | ||
| auto it = shadow.find(src_name); | ||
| if (it == shadow.end()) { | ||
| changes.to_create.push_back( | ||
| {.name = src_name, .role = std::move(src_role)}); | ||
| } else if (src_role.members() != it->second.members()) { | ||
| changes.to_update.push_back( | ||
| {.name = src_name, .role = std::move(src_role)}); | ||
| } | ||
| } | ||
|
|
||
| for (const auto& [shadow_name, _] : shadow) { | ||
| if (!source.contains(shadow_name)) { | ||
| changes.to_delete.push_back(shadow_name); | ||
| } | ||
| } | ||
|
|
||
| return changes; | ||
| } | ||
|
|
||
| } // namespace cluster_link | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * Copyright 2026 Redpanda Data, Inc. | ||
| * | ||
| * Use of this software is governed by the Business Source License | ||
| * included in the file licenses/BSL.md | ||
| * | ||
| * As of the Change Date specified in that file, in accordance with | ||
| * the Business Source License, use of this software will be governed | ||
| * by the Apache License, Version 2.0 | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "container/chunked_vector.h" | ||
| #include "security/role.h" | ||
| #include "security/types.h" | ||
|
|
||
| namespace cluster_link { | ||
|
|
||
| /// The set of role mutations needed to make the shadow cluster's in-scope | ||
| /// roles match the source's in-scope roles. Inputs to reconcile_roles are | ||
| /// already filtered to the configured selection, so this struct carries no | ||
| /// policy. | ||
| struct role_changes { | ||
| chunked_vector<security::role_with_members> to_create; | ||
| chunked_vector<security::role_with_members> to_update; | ||
| chunked_vector<security::role_name> to_delete; | ||
| }; | ||
|
|
||
| /// Compute the full-mirror diff between two already-filtered role sets: | ||
| /// to_create = source \ shadow (by name) | ||
| /// to_update = names in both whose membership differs | ||
| /// to_delete = shadow \ source (by name) | ||
| role_changes reconcile_roles( | ||
| chunked_vector<security::role_with_members> source_selected, | ||
| chunked_vector<security::role_with_members> shadow_selected); | ||
|
|
||
| } // namespace cluster_link |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
I'd probably use ranges here as well