Skip to content

Commit 0edf61c

Browse files
authored
rename: machine accounts → service accounts in config (#586)
## Summary - Renames all Role objects from `iam-machine-accounts-*` / `identity-machine-account-keys-*` to `iam-service-accounts-*` / `identity-service-account-keys-*` - Updates permissions in roles from `machineaccounts.*` / `machineaccountkeys.*` to `serviceaccounts.*` / `serviceaccountkeys.*` - Updates `iam-editor` and `iam-viewer` aggregate roles to reference `serviceaccounts` permissions - Renames ProtectedResource objects (`iam.miloapis.com-machineaccount` → `iam.miloapis.com-serviceaccount`, etc.) - Renames resource-metrics config files and updates metric name prefixes (`milo_machine_accounts` → `milo_service_accounts`) - Updates audit policy configmap to audit `serviceaccountkeys` instead of `machineaccountkeys` - Updates activity policy for the renamed `ServiceAccount` resource kind - Updates apiserver deployment flag names to `--serviceaccountkeys-provider-*` Without this PR, users get a 403 when trying to list/create service accounts because the RBAC permission `iam.miloapis.com/serviceaccounts.list` doesn't exist yet — only `machineaccounts.list` was defined. ## Test plan - [ ] Verify users with `iam-viewer` or `iam-editor` role can list service accounts after milo picks up these config changes - [ ] Verify service account keys can be created/listed/deleted - [ ] Confirm old `iam-machine-accounts-*` roles are deleted from the cluster (or coexist during transition)
2 parents 0e7ac60 + fec88c1 commit 0edf61c

6 files changed

Lines changed: 54 additions & 51 deletions

File tree

config/roles/iam-editor.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ spec:
2222
- iam.miloapis.com/userinvitations.update
2323
- iam.miloapis.com/userinvitations.patch
2424
- iam.miloapis.com/userinvitations.delete
25-
- iam.miloapis.com/machineaccounts.create
26-
- iam.miloapis.com/machineaccounts.update
27-
- iam.miloapis.com/machineaccounts.patch
28-
- iam.miloapis.com/machineaccounts.delete
25+
- iam.miloapis.com/serviceaccounts.create
26+
- iam.miloapis.com/serviceaccounts.update
27+
- iam.miloapis.com/serviceaccounts.patch
28+
- iam.miloapis.com/serviceaccounts.delete
2929
- iam.miloapis.com/policybindings.create
3030
- iam.miloapis.com/policybindings.update
3131
- iam.miloapis.com/policybindings.patch

config/roles/iam-viewer.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ spec:
2424
- iam.miloapis.com/userinvitations.get
2525
- iam.miloapis.com/userinvitations.list
2626
- iam.miloapis.com/userinvitations.watch
27-
- iam.miloapis.com/machineaccounts.get
28-
- iam.miloapis.com/machineaccounts.list
29-
- iam.miloapis.com/machineaccounts.watch
27+
- iam.miloapis.com/serviceaccounts.get
28+
- iam.miloapis.com/serviceaccounts.list
29+
- iam.miloapis.com/serviceaccounts.watch
3030
- iam.miloapis.com/protectedresources.get
3131
- iam.miloapis.com/protectedresources.list
3232
- iam.miloapis.com/protectedresources.watch

config/services/identity/policies/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ apiVersion: kustomize.config.k8s.io/v1alpha1
44
kind: Component
55

66
resources:
7-
- machineaccount-policy.yaml
7+
- serviceaccount-policy.yaml

config/services/identity/policies/machineaccount-policy.yaml renamed to config/services/identity/policies/serviceaccount-policy.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# SPDX-License-Identifier: AGPL-3.0-only
22

3-
# ActivityPolicy for MachineAccount resources.
4-
# Defines how MachineAccount API operations appear in activity timelines.
3+
# ActivityPolicy for ServiceAccount resources.
4+
# Defines how ServiceAccount API operations appear in activity timelines.
55
#
66
# Audit rules handle CRUD operations captured by the Kubernetes API server audit log.
77
# No eventRules — the controller sets conditions but does not emit Kubernetes Events.
88
#
99
# Design principles:
10-
# - Use the machine account name as display text
11-
# - Action-oriented language ("created machine account", "deactivated machine account")
10+
# - Use the service account name as display text
11+
# - Action-oriented language ("created service account", "deactivated service account")
1212
# - State-specific rules (deactivate/activate) are evaluated before the generic update rule
1313
apiVersion: activity.miloapis.com/v1alpha1
1414
kind: ActivityPolicy
1515
metadata:
16-
name: iam.miloapis.com-machineaccount
16+
name: iam.miloapis.com-serviceaccount
1717
spec:
1818
resource:
1919
apiGroup: iam.miloapis.com
20-
kind: MachineAccount
20+
kind: ServiceAccount
2121

2222
# Audit log rules for CRUD operations.
2323
# These are automatically captured by the API server and don't require controller code.
@@ -26,20 +26,20 @@ spec:
2626
auditRules:
2727
- name: create
2828
match: "!audit.user.username.startsWith('system:') && audit.verb == 'create'"
29-
summary: "{{ actor }} created machine account {{ link(audit.objectRef.name, audit.objectRef) }}"
29+
summary: "{{ actor }} created service account {{ link(audit.objectRef.name, audit.objectRef) }}"
3030

3131
- name: delete
3232
match: "!audit.user.username.startsWith('system:') && audit.verb == 'delete'"
33-
summary: "{{ actor }} deleted machine account {{ audit.objectRef.name }}"
33+
summary: "{{ actor }} deleted service account {{ audit.objectRef.name }}"
3434

3535
- name: deactivate
3636
match: "!audit.user.username.startsWith('system:') && audit.verb in ['update', 'patch'] && !has(audit.objectRef.subresource) && has(audit.requestObject.spec) && has(audit.requestObject.spec.state) && audit.requestObject.spec.state == 'Inactive'"
37-
summary: "{{ actor }} deactivated machine account {{ link(audit.objectRef.name, audit.objectRef) }}"
37+
summary: "{{ actor }} deactivated service account {{ link(audit.objectRef.name, audit.objectRef) }}"
3838

3939
- name: activate
4040
match: "!audit.user.username.startsWith('system:') && audit.verb in ['update', 'patch'] && !has(audit.objectRef.subresource) && has(audit.requestObject.spec) && has(audit.requestObject.spec.state) && audit.requestObject.spec.state == 'Active'"
41-
summary: "{{ actor }} reactivated machine account {{ link(audit.objectRef.name, audit.objectRef) }}"
41+
summary: "{{ actor }} reactivated service account {{ link(audit.objectRef.name, audit.objectRef) }}"
4242

4343
- name: update
4444
match: "!audit.user.username.startsWith('system:') && audit.verb in ['update', 'patch'] && !has(audit.objectRef.subresource)"
45-
summary: "{{ actor }} updated machine account {{ link(audit.objectRef.name, audit.objectRef) }}"
45+
summary: "{{ actor }} updated service account {{ link(audit.objectRef.name, audit.objectRef) }}"

docs/api/iam.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Resource Types:
1212

1313
- [Group](#group)
1414

15-
- [MachineAccount](#machineaccount)
15+
- [ServiceAccount](#serviceaccount)
1616

1717
- [PlatformAccessApproval](#platformaccessapproval)
1818

@@ -45,6 +45,7 @@ Resource Types:
4545

4646

4747

48+
4849
GroupMembership is the Schema for the groupmemberships API
4950

5051
<table>
@@ -301,6 +302,7 @@ with respect to the current state of the instance.<br/>
301302

302303

303304

305+
304306
Group is the Schema for the groups API
305307

306308
<table>
@@ -443,15 +445,16 @@ with respect to the current state of the instance.<br/>
443445
</tr></tbody>
444446
</table>
445447

446-
## MachineAccount
448+
## ServiceAccount
447449
<sup><sup>[↩ Parent](#iammiloapiscomv1alpha1 )</sup></sup>
448450

449451

450452

451453

452454

453455

454-
MachineAccount is the Schema for the machine accounts API
456+
457+
ServiceAccount is the Schema for the service accounts API
455458

456459
<table>
457460
<thead>
@@ -471,7 +474,7 @@ MachineAccount is the Schema for the machine accounts API
471474
<tr>
472475
<td><b>kind</b></td>
473476
<td>string</td>
474-
<td>MachineAccount</td>
477+
<td>ServiceAccount</td>
475478
<td>true</td>
476479
</tr>
477480
<tr>
@@ -480,29 +483,29 @@ MachineAccount is the Schema for the machine accounts API
480483
<td>Refer to the Kubernetes API documentation for the fields of the `metadata` field.</td>
481484
<td>true</td>
482485
</tr><tr>
483-
<td><b><a href="#machineaccountspec">spec</a></b></td>
486+
<td><b><a href="#serviceaccountspec">spec</a></b></td>
484487
<td>object</td>
485488
<td>
486-
MachineAccountSpec defines the desired state of MachineAccount<br/>
489+
ServiceAccountSpec defines the desired state of ServiceAccount<br/>
487490
</td>
488491
<td>false</td>
489492
</tr><tr>
490-
<td><b><a href="#machineaccountstatus">status</a></b></td>
493+
<td><b><a href="#serviceaccountstatus">status</a></b></td>
491494
<td>object</td>
492495
<td>
493-
MachineAccountStatus defines the observed state of MachineAccount<br/>
496+
ServiceAccountStatus defines the observed state of ServiceAccount<br/>
494497
</td>
495498
<td>false</td>
496499
</tr></tbody>
497500
</table>
498501

499502

500-
### MachineAccount.spec
501-
<sup><sup>[↩ Parent](#machineaccount)</sup></sup>
503+
### ServiceAccount.spec
504+
<sup><sup>[↩ Parent](#serviceaccount)</sup></sup>
502505

503506

504507

505-
MachineAccountSpec defines the desired state of MachineAccount
508+
ServiceAccountSpec defines the desired state of ServiceAccount
506509

507510
<table>
508511
<thead>
@@ -517,10 +520,10 @@ MachineAccountSpec defines the desired state of MachineAccount
517520
<td><b>state</b></td>
518521
<td>enum</td>
519522
<td>
520-
The state of the machine account. This state can be safely changed as needed.
523+
The state of the service account. This state can be safely changed as needed.
521524
States:
522-
- Active: The machine account can be used to authenticate.
523-
- Inactive: The machine account is prohibited to be used to authenticate, and revokes all existing sessions.<br/>
525+
- Active: The service account can be used to authenticate.
526+
- Inactive: The service account is prohibited to be used to authenticate, and revokes all existing sessions.<br/>
524527
<br/>
525528
<i>Enum</i>: Active, Inactive<br/>
526529
<i>Default</i>: Active<br/>
@@ -530,12 +533,12 @@ States:
530533
</table>
531534

532535

533-
### MachineAccount.status
534-
<sup><sup>[↩ Parent](#machineaccount)</sup></sup>
536+
### ServiceAccount.status
537+
<sup><sup>[↩ Parent](#serviceaccount)</sup></sup>
535538

536539

537540

538-
MachineAccountStatus defines the observed state of MachineAccount
541+
ServiceAccountStatus defines the observed state of ServiceAccount
539542

540543
<table>
541544
<thead>
@@ -547,25 +550,25 @@ MachineAccountStatus defines the observed state of MachineAccount
547550
</tr>
548551
</thead>
549552
<tbody><tr>
550-
<td><b><a href="#machineaccountstatusconditionsindex">conditions</a></b></td>
553+
<td><b><a href="#serviceaccountstatusconditionsindex">conditions</a></b></td>
551554
<td>[]object</td>
552555
<td>
553-
Conditions provide conditions that represent the current status of the MachineAccount.<br/>
556+
Conditions provide conditions that represent the current status of the ServiceAccount.<br/>
554557
</td>
555558
<td>false</td>
556559
</tr><tr>
557560
<td><b>email</b></td>
558561
<td>string</td>
559562
<td>
560-
The computed email of the machine account following the pattern:
563+
The computed email of the service account following the pattern:
561564
{metadata.name}@{metadata.namespace}.{project.metadata.name}.{global-suffix}<br/>
562565
</td>
563566
<td>false</td>
564567
</tr><tr>
565568
<td><b>state</b></td>
566569
<td>enum</td>
567570
<td>
568-
State represents the current activation state of the machine account from the auth provider.
571+
State represents the current activation state of the service account from the auth provider.
569572
This field tracks the state from the previous generation and is updated when state changes
570573
are successfully propagated to the auth provider. It helps optimize performance by only
571574
updating the auth provider when a state change is detected.<br/>
@@ -577,8 +580,8 @@ updating the auth provider when a state change is detected.<br/>
577580
</table>
578581

579582

580-
### MachineAccount.status.conditions[index]
581-
<sup><sup>[↩ Parent](#machineaccountstatus)</sup></sup>
583+
### ServiceAccount.status.conditions[index]
584+
<sup><sup>[↩ Parent](#serviceaccountstatus)</sup></sup>
582585

583586

584587

docs/api/identity.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Package v1alpha1 contains API types for identity-related resources.
1212

1313
- [UserIdentity](#useridentity)
1414
- [Session](#session)
15-
- [MachineAccountKey](#machineaccountkey)
15+
- [ServiceAccountKey](#serviceaccountkey)
1616

1717
---
1818

@@ -77,33 +77,33 @@ This resource provides information about user authentication sessions, including
7777

7878
---
7979

80-
### MachineAccountKey
80+
### ServiceAccountKey
8181

82-
MachineAccountKey represents a credential for a MachineAccount.
82+
ServiceAccountKey represents a credential for a ServiceAccount.
8383

84-
This resource allows users to manage API keys for machine-to-machine authentication. When a MachineAccountKey is created, the system generates a private key that is returned in the status only once.
84+
This resource allows users to manage API keys for machine-to-machine authentication. When a ServiceAccountKey is created, the system generates a private key that is returned in the status only once.
8585

8686
**Use cases:**
8787

8888
- Authenticating external services and automation scripts
8989
- Managing key rotation and expiration
90-
- Auditing machine account activity
90+
- Auditing service account activity
9191

9292
**Important notes:**
9393

9494
- The `privateKey` is ONLY available in the creation response and is NEVER persisted in the Milo API server.
9595
- Keys can have an optional expiration date.
96-
- Each key is associated with a specific `MachineAccount` identified by its email.
96+
- Each key is associated with a specific `ServiceAccount` identified by its email.
9797

98-
#### MachineAccountKeySpec
98+
#### ServiceAccountKeySpec
9999

100100
| Field | Type | Description |
101101
| :--- | :--- | :--- |
102-
| `machineAccountUserName` | string | The email address of the MachineAccount that owns this key. |
102+
| `serviceAccountUserName` | string | The email address of the ServiceAccount that owns this key. |
103103
| `expirationDate` | metav1.Time | Optional date and time when the key will expire. |
104104
| `publicKey` | string | Optional public key to be registered. If not provided, one will be auto-generated. |
105105

106-
#### MachineAccountKeyStatus
106+
#### ServiceAccountKeyStatus
107107

108108
| Field | Type | Description |
109109
| :--- | :--- | :--- |

0 commit comments

Comments
 (0)