Skip to content

refactor(iam,identity): rename MachineAccount to ServiceAccount#583

Merged
kevwilliams merged 1 commit into
mainfrom
feat/rename-machineaccount-to-serviceaccount
Apr 28, 2026
Merged

refactor(iam,identity): rename MachineAccount to ServiceAccount#583
kevwilliams merged 1 commit into
mainfrom
feat/rename-machineaccount-to-serviceaccount

Conversation

@kevwilliams
Copy link
Copy Markdown
Contributor

Summary

  • Renames MachineAccountServiceAccount and MachineAccountKeyServiceAccountKey throughout all Go types, packages, CLI flags, REST storage keys, kubebuilder markers, and YAML config
  • Moves package internal/apiserver/identity/machineaccountkeys/serviceaccountkeys/; REST HTTP path segment /machineaccountkeys/serviceaccountkeys (breaking API change)
  • Renames feature gate MachineAccountKeysServiceAccountKeys and server flags --machineaccountkeys-provider-*--serviceaccountkeys-provider-*
  • Updates CRD, roles, protected-resources, resources-metrics, samples, deployment, and audit-policy YAMLs
  • Regenerates zz_generated.deepcopy.go (×2) and zz_generated.openapi.go

This is a pre-GA breaking rename aligning with industry-standard terminology (Kubernetes, GCP, AWS) for non-human machine identities.

Out of scope (follow-on PRs needed)

  • graphql-gateway — queries the /machineaccountkeys API path directly
  • Prometheus dashboards/alerts referencing milo_machine_account* metric names
  • Operator overlays using old --machineaccountkeys-provider-* flag names

Test plan

  • grep -r "MachineAccount\|machineAccount\|machine_account\|machine-account" --include="*.go" --include="*.yaml" --include="*.yml" | grep -v zz_generated | grep -v _test.go returns zero results
  • go build ./... passes
  • task generate:code && task generate:openapi:identity produces no diff (already regenerated in this PR)

@joggrbot
Copy link
Copy Markdown
Contributor

joggrbot Bot commented Apr 28, 2026

📝 Documentation Analysis

All docs are up to date! 🎉


✅ Latest commit analyzed: 8892eb8 | Powered by Joggr

Renames all MachineAccount and MachineAccountKey types, packages, CLI
flags, REST storage keys, YAML resources, and kubebuilder markers to
ServiceAccount and ServiceAccountKey throughout milo.

This is a pre-GA breaking API rename aligning with industry-standard
terminology (Kubernetes, GCP, AWS) for non-human machine identities.

Key changes:
- Go types: MachineAccount → ServiceAccount, MachineAccountKey → ServiceAccountKey
- Package: internal/apiserver/identity/machineaccountkeys/ → serviceaccountkeys/
- REST path segment: /machineaccountkeys → /serviceaccountkeys
- Feature gate: MachineAccountKeys → ServiceAccountKeys
- CLI flags: --machineaccountkeys-provider-* → --serviceaccountkeys-provider-*
- CRD, roles, protected-resources, resources-metrics, samples YAMLs all renamed
- PolicyBinding Subject enum: MachineAccount → ServiceAccount
- Regenerated zz_generated.deepcopy.go (×2) and zz_generated.openapi.go
@kevwilliams kevwilliams force-pushed the feat/rename-machineaccount-to-serviceaccount branch from a3e3dbd to 8892eb8 Compare April 28, 2026 19:48
@scotwells
Copy link
Copy Markdown
Contributor

@kevwilliams you'll need to adjust the zitadel provider as well.

@kevwilliams kevwilliams merged commit ead128a into main Apr 28, 2026
10 of 11 checks passed
@kevwilliams kevwilliams deleted the feat/rename-machineaccount-to-serviceaccount branch April 28, 2026 20:38
mattdjenkinson added a commit that referenced this pull request May 10, 2026
#608)

## Summary

Mirrors 8e9843d for `UserIdentity`. Two changes, both on the milo side:

1. **`pkg/apis/identity/scheme.go`** — register `status.userUID` as a
valid field selector for `UserIdentity`. Without this, milo's aggregator
pre-rejects List requests with `"status.userUID" is not a known field
selector: only "metadata.name", "metadata.namespace"` before they ever
proxy to auth-provider-zitadel.

2. **`internal/apiserver/identity/useridentities/rest.go`** — forward
the caller's field/label selectors to the backend instead of dropping
them with `lo := metav1.ListOptions{}`. The auth-provider-zitadel REST
handler relies on receiving `status.userUID` to switch into the
SAR-gated cross-user code path. With the milo handler discarding it,
even after milo-os/zitadel-provider#108 the cross-user path could
not be reached for identities — the request never made it past milo.

## Why now

The April 29 cross-user work (#583 here,
milo-os/zitadel-provider#69) registered `Session` on both sides and
intentionally deferred `UserIdentity` ("only Session is needed today").
Staff portal now wants the same lookup for IdP links —
Google/GitHub/email — so support agents can see which providers a user
has linked. End-to-end this PR + milo-os/zitadel-provider#108
unblock the staff-portal user detail page's read-only Account Identities
card.

## Authorization

Unchanged. The SAR check in auth-provider-zitadel remains the gate —
`staff-users` already has `iam.miloapis.com/users.get` cluster-wide via
`staff-user-manager-binding`, so no IAM changes needed.

## Test plan
- [x] `go build ./pkg/apis/identity/...
./internal/apiserver/identity/...` — clean
- [x] `go test ./internal/apiserver/identity/...
./pkg/apis/identity/...` — sessions tests still pass
- [ ] Verify in staging: staff portal user detail page populates the
Account Identities card with the *target* user's IdP links (currently
shows the staff user's own — bug confirmed via apiserver logs and
field-selector error)

Pairs with milo-os/zitadel-provider#108. Refs
milo-os/zitadel-provider#69.
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.

2 participants