Skip to content

Commit 713f6d1

Browse files
authored
IAM: Move resource definitions to apps/iam step 1 (#107389)
* wip * Use serviceaccount model from /apps/iam * revert version update * Add tembinding, userteam, other improvements * Change serviceaccounttoken spec * Revert the change of ServiceAccountToken * Revert the change of UserTeam * Clean up * Remove files that are not needed for now * Lint * Update sql query's integration tests * Fix tests * update openapi spec * Move LastSeenAt to the annotations * Updte openapi_snapshots * Change lastSeenAt annotation name
1 parent c7374b6 commit 713f6d1

File tree

78 files changed

+5592
-1409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+5592
-1409
lines changed

apps/iam/kinds/manifest.cue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,16 @@ package kinds
33
manifest: {
44
appName: "iam"
55
groupOverride: "iam.grafana.app"
6-
kinds: [ globalrole, globalrolebinding, corerole, role, rolebinding, resourcepermission ]
6+
kinds: [
7+
globalrole,
8+
globalrolebinding,
9+
corerole,
10+
role,
11+
rolebinding,
12+
resourcepermission,
13+
user,
14+
team,
15+
teambinding,
16+
serviceaccount,
17+
]
718
}

apps/iam/kinds/serviceaccount.cue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package kinds
2+
3+
import (
4+
"github.com/grafana/grafana/apps/iam/kinds/v0alpha1"
5+
)
6+
7+
serviceaccount: {
8+
kind: "ServiceAccount"
9+
pluralName: "ServiceAccounts"
10+
current: "v0alpha1"
11+
12+
codegen: {
13+
ts: { enabled: false }
14+
go: { enabled: true }
15+
}
16+
17+
versions: {
18+
"v0alpha1": {
19+
schema: {
20+
spec: v0alpha1.ServiceAccountSpec
21+
}
22+
}
23+
}
24+
}

apps/iam/kinds/team.cue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package kinds
2+
3+
import (
4+
"github.com/grafana/grafana/apps/iam/kinds/v0alpha1"
5+
)
6+
7+
team: {
8+
kind: "Team"
9+
pluralName: "Teams"
10+
current: "v0alpha1"
11+
12+
codegen: {
13+
ts: { enabled: false }
14+
go: { enabled: true }
15+
}
16+
17+
versions: {
18+
"v0alpha1": {
19+
schema: {
20+
spec: v0alpha1.TeamSpec
21+
}
22+
}
23+
}
24+
}

apps/iam/kinds/teambinding.cue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package kinds
2+
3+
import (
4+
"github.com/grafana/grafana/apps/iam/kinds/v0alpha1"
5+
)
6+
7+
teambinding: {
8+
kind: "TeamBinding"
9+
pluralName: "TeamBindings"
10+
current: "v0alpha1"
11+
12+
codegen: {
13+
ts: { enabled: false }
14+
go: { enabled: true }
15+
}
16+
17+
versions: {
18+
"v0alpha1": {
19+
schema: {
20+
spec: v0alpha1.TeamBindingSpec
21+
}
22+
}
23+
}
24+
}

apps/iam/kinds/user.cue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package kinds
2+
3+
import (
4+
"github.com/grafana/grafana/apps/iam/kinds/v0alpha1"
5+
)
6+
7+
user: {
8+
kind: "User"
9+
pluralName: "Users"
10+
current: "v0alpha1"
11+
12+
codegen: {
13+
ts: { enabled: false }
14+
go: { enabled: true }
15+
}
16+
17+
versions: {
18+
"v0alpha1": {
19+
schema: {
20+
spec: v0alpha1.UserSpec
21+
}
22+
}
23+
}
24+
}

apps/iam/kinds/v0alpha1/resourcepermission.cue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ ResourcePermission: {
2121
resource: #Resource
2222
permissions: [...#Permission]
2323
}
24-
25-

apps/iam/kinds/v0alpha1/rolespec.cue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ RoleSpec: {
2020
// created?
2121
// updated?
2222
}
23-
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package v0alpha1
2+
3+
ServiceAccountSpec: {
4+
title: string
5+
disabled: bool
6+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package v0alpha1
2+
3+
TeamBindingSpec: {
4+
#Subject: {
5+
// uid of the identity
6+
name: string
7+
// permission of the identity in the team
8+
permission: TeamPermission
9+
}
10+
11+
subjects: [...#Subject]
12+
teamRef: TeamRef
13+
}
14+
15+
TeamRef:{
16+
// Name is the unique identifier for a team.
17+
name: string
18+
}
19+
20+
TeamPermission: "admin" | "member"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package v0alpha1
2+
3+
TeamSpec: {
4+
title: string
5+
email: string
6+
}

0 commit comments

Comments
 (0)