IAM: Create Service Account API and legacy store impl (#110411)

* wip

* IAM: Create Service Account

* Add dual writer

* Update openapi_test.go

* Add integration tests

* Add sql tests

* Add Role to SA spec, add validation, add DBTime, add tests

* Format, update test

* Fixes

* Add check for External

* Address feedback

* Update tests

* Address feedback

* make gen-go

* Simplify a bit

* Fixes

* make update-workspace

* Update pkg/registry/apis/iam/serviceaccount/store.go

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>

* Address feedback, add test for generateName

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Misi
2025-09-08 14:31:32 +02:00
committed by GitHub
co-authored by Ryan McKinley
parent 8a28381278
commit badea8bc37
46 changed files with 1961 additions and 198 deletions
@@ -0,0 +1,9 @@
apiVersion: iam.grafana.app/v0alpha1
kind: ServiceAccount
metadata:
name: test-sa-1
spec:
title: "Test Service Account 1"
disabled: false
role: Editor
@@ -0,0 +1,9 @@
apiVersion: iam.grafana.app/v0alpha1
kind: ServiceAccount
metadata:
name: sa-external
spec:
title: "extsvc-grafana-plugin-name"
role: Viewer
plugin: grafana-plugin-name
@@ -0,0 +1,7 @@
apiVersion: iam.grafana.app/v0alpha1
kind: ServiceAccount
metadata:
generateName: sa-
spec:
title: Test Service Account with GenerateName
role: Viewer
@@ -0,0 +1,7 @@
apiVersion: iam.grafana.app/v0alpha1
kind: ServiceAccount
metadata:
name: sa-with-higher-role
spec:
title: SA with higher role
role: Admin
@@ -0,0 +1,7 @@
apiVersion: iam.grafana.app/v0alpha1
kind: ServiceAccount
metadata:
name: sa-with-invalid-role
spec:
title: SA with invalid role
role: InvalidRole
@@ -0,0 +1,7 @@
apiVersion: iam.grafana.app/v0alpha1
kind: ServiceAccount
metadata:
name: sa-with-no-title
spec:
title: ""
role: Viewer
+2 -1
View File
@@ -7,4 +7,5 @@ spec:
email: testuser1@example123.com
login: testuser1
name: Test User 1
provisioned: false
provisioned: false