K8s/Dashboards: Generate Dashboards k8s APIs using Grafana App SDK (#99966)
* Generate Dashboard kinds with `grafana-app-sdk` Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Hack together a fix for invalid TS codegen for v0 & v1 Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Address Go linter issues Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Address TS linter issues Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Add new app to CODEOWNERS Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Fix a couple of issues detected by tests Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Update OpenAPI definitions and test files Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Remove title from Dashboard v1alpha1 spec Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Remove unused CUE schemas Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * remove unrelated files * allow any in the generated betterer * Add a comment explaining why we don't use deepcopy-gen Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> * Default to v2alpha1 if dashboards v2 FF is enabled Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> --------- Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com> Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
co-authored by
Ryan McKinley
parent
3fffb2872e
commit
ea89a68028
@@ -0,0 +1,68 @@
|
||||
package kinds
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/sdkkinds/dashboard/v0alpha1"
|
||||
"github.com/grafana/grafana/sdkkinds/dashboard/v1alpha1"
|
||||
"github.com/grafana/grafana/sdkkinds/dashboard/v2alpha1"
|
||||
)
|
||||
|
||||
// Status is the shared status of all dashboard versions.
|
||||
DashboardStatus: {
|
||||
// Optional conversion status.
|
||||
conversion?: ConversionStatus
|
||||
}
|
||||
|
||||
// ConversionStatus is the status of the conversion of the dashboard.
|
||||
ConversionStatus: {
|
||||
// Whether from another version has failed.
|
||||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
failed: bool
|
||||
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion: string
|
||||
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
error: string
|
||||
}
|
||||
|
||||
dashboard: {
|
||||
kind: "Dashboard"
|
||||
pluralName: "Dashboards"
|
||||
current: "v0alpha1"
|
||||
|
||||
codegen: {
|
||||
ts: {
|
||||
enabled: true
|
||||
config: {
|
||||
enumsAsUnionTypes: true
|
||||
}
|
||||
}
|
||||
go: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
|
||||
versions: {
|
||||
"v0alpha1": {
|
||||
schema: {
|
||||
spec: v0alpha1.DashboardSpec
|
||||
status: DashboardStatus
|
||||
}
|
||||
}
|
||||
"v1alpha1": {
|
||||
schema: {
|
||||
spec: v1alpha1.DashboardSpec
|
||||
status: DashboardStatus
|
||||
}
|
||||
}
|
||||
"v2alpha1": {
|
||||
schema: {
|
||||
spec: v2alpha1.DashboardSpec
|
||||
status: DashboardStatus
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user