Conversation
Replaces #677. That PR added a partial Role manifest (only spec.inheritedRoles) for the existing iam-user-self-manage role to the activity overlay, relying on server-side apply to merge it into the core role. That does not hold under the actual GitOps setup: both the core role (via milo-core-control-plane-crds) and the partial overlay (via milo-activity-policies) are applied by Flux's kustomize-controller, which uses a single shared field manager (kustomize-controller) for every Kustomization. With one shared manager, each apply re-declares its full field set, so the two Kustomizations prune each other's fields on every reconcile -- the role flip-flops between "has includedPermissions, no audit inheritance" and "has audit inheritance, no permissions". The map-type of inheritedRoles only helps across distinct field managers, which Flux does not provide here. This instead delivers the self-audit capability without mutating the shared core role: - New standalone Role activity-self-audit-log-querier in the activity service overlay, inheriting activity.miloapis.com-audit-log-querier. It is a distinct object with a single owner -- no cross-Kustomization field contention. - The user webhook grants it per-user, scoped to the user's own User resource (mirroring the existing user-self-manage PolicyBinding), so self-audit access stays self-scoped. A static Group binding to system:authenticated was rejected because only resourceKind=User is available for a group subject, which would grant every user access to all users' audit logs. - The grant is gated on a configurable role name (empty -> skip), so the core control plane carries zero activity coupling when activity is not deployed -- preserving the dependency-decoupling goal of #676. - The user controller attaches an owner reference to the binding for GC on user deletion, guarded by IsNotFound so it is inert when the activity overlay is absent. Refs: #676 Replaces: #677 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
## Summary Every Claude Code session on this repo rediscovers the same handful of tooling habits and one piece of milo-specific architecture, because nothing in the tree records them. This adds a small version-controlled memory next to the agent config, one file per fact plus an index, covering the GitHub CLI habits that keep issue bodies rendering and sub-issues reachable, keeping a local main current, running an unattended loop without permission prompts, and where this repo's ActivityPolicy resources live and how they ship. Everything environment-specific stayed out, so there are no incident catalogues, cluster names, project IDs, credentials, or deploy-repo paths. The ActivityPolicy note overlaps the area #679 touches, so review that entry against it. ## Test plan - [ ] Each entry holds for this repo on its own and is safe to publish - [ ] A session that loads the index can act on each note without asking for more context
|
Detail moved out of the description. Why #677 fails. It added a partial
What this change does:
Rejected alternative. One PolicyBinding to Validation so far: Supersedes #677. Part of datum-cloud/infra#2943 and datum-cloud/infra#2939. |
scotwells
left a comment
There was a problem hiding this comment.
You shouldn't need to create a separate policy binding for this. It should be granted through role inheritance on the user self-manage role. It should be patched on the infra layer so the system's are de-coupled.
|
better yes |
Summary
Users should be able to query their own audit logs, but granting that through the shared self-manage role ties the core control plane to the activity service, which deploys after it.
An earlier attempt, #677, added the grant to that shared role from the activity deployment, and because Flux applies both deployments as one owner, each strips the other's fields on every reconcile, so the role swings between having audit access and losing every other permission.
This change gives the activity service its own role for the access and binds each user to it for their own account only.
When the activity service is not deployed, the binding is skipped and the core control plane carries nothing of it.
Test plan
Fixes #676