SPEKTRA Edge IAM Principal Tracking
ServiceAccounts are project-scoped resources, but in theory, they can be granted roles in other projects and organizations too. Users are, in IAM terms, global resources, not necessarily bound to any organizational entity. They can however join any project or organization.
Members (Users or ServiceAccounts) are associated with
projects/organizations via RoleBinding resources. Organizational role
bindings are copied to downstream child projects/organizations by
the IAM Controller (iam/controller/v1/iam_scope/org_rbs_copier.go
).
If you visit iam/server/v1/role_binding/role_binding_service.go
, you
should note that, for each written/deleted RoleBinding we are managing
MemberAssignment resource. See iam/proto/v1/member_assignment.proto
for more details, it has described the role.
Generally, though, one instance of MemberAssignment is created per each scope/member combination. This internal resource facilitates tracking of members in organizational entities.
Members can see a list of their projects/organizations via ListMyProjects/ListMyOrganization calls. To make such calls possible, we needed to use MemberAssignment helper collection, we copy also many project/organization fields directly to MemberAssignment instances. Therefore, projects/organizations filter/orderBy/fieldMask/cursor objects can be mostly translated to MemberAssignment ones. To make it work, MemberAssignment is a regional, but globally synced resource (its copies are spread through all IAM regions, period). Regional status ensures that each region is responsible for tracking members in local organizations/projects individually. IamDbController syncs all created copies across all regions, so each region knows the full list of projects/organizations where the given member participates.
In case project/organization fields change (like title), the IAM Controller
is responsible for propagating change to all MemberAssignment instances.
Implementation is in file iam/controller/v1/mem_assignments_meta_updater.go
.