Commit 929ff4b
committed
feat(groups): add ServiceAccountAccessToken managed resource
Adds a group-scoped ServiceAccountAccessToken managed resource that manages
the personal access token of a group service account.
Owner mode (default): the ProviderConfig is a group owner and the token is
managed via the service-account endpoints:
- Create -> Groups.CreateServiceAccountPersonalAccessToken
- Observe -> Groups.ListServiceAccountPersonalAccessTokens (match by token id)
- Rotate -> Groups.RotateServiceAccountPersonalAccessToken
- Revoke -> Groups.RevokeServiceAccountPersonalAccessToken
Self-managed mode: when the referenced ProviderConfig authenticates with the
very token this resource writes to its connection secret (detected when the
PersonalAccessToken credential secretRef matches writeConnectionSecretToRef by
namespace, name and key), the provider acts as the service account itself and
uses the self endpoints instead:
- Observe -> GET /personal_access_tokens/self (self-inform; external name is
auto-adopted from the response)
- Rotate -> RotatePersonalAccessTokenSelf
- Revoke -> RevokePersonalAccessTokenSelf
This enables a self-sustaining loop of short-lived, self-rotating tokens used to
reconcile a group. A dead self-token surfaces as a clear terminal error
(reseed the credentials secret). A SelfManaged status condition reports the
detected mode.
The external name is the token id and the token value is written to the
connection secret on create/rotate. Rotation, expiresAt/renewalPeriodDays and
renewBeforeDays semantics match the group AccessToken controller. groupId,
serviceAccountId, name and scopes are immutable (enforced via CEL); the
rotation-timing fields stay mutable.
Fixes #324
Signed-off-by: Markus Siebert <markus.siebert@deutschebahn.com>1 parent 845e4d7 commit 929ff4b
29 files changed
Lines changed: 5338 additions & 4 deletions
File tree
- apis
- cluster/groups/v1alpha1
- namespaced/groups/v1alpha1
- examples/groups
- package/crds
- pkg
- cluster
- clients/groups
- fake
- controller/groups
- serviceaccountaccesstokens
- common
- namespaced
- clients/groups
- fake
- controller/groups
- serviceaccountaccesstokens
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
47 | 92 | | |
48 | 93 | | |
49 | 94 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments