From c62ba51d687329ab68bc6e225ca5d68aff90adbd Mon Sep 17 00:00:00 2001 From: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com> Date: Thu, 28 Aug 2025 20:52:14 -0600 Subject: [PATCH] Kubernetes Dashboards: Delete resourceVersion (on update and create) and name (on create) (#110318) delete resourceVersion when creating and updating, and delete name whe creating --- public/app/features/dashboard/api/v1.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard/api/v1.ts b/public/app/features/dashboard/api/v1.ts index f14576d9983..ca8d4cc0c75 100644 --- a/public/app/features/dashboard/api/v1.ts +++ b/public/app/features/dashboard/api/v1.ts @@ -71,18 +71,22 @@ export class K8sDashboardAPI implements DashboardAPI { }; } + // remove resource version because it's not allowed to be set + // and the api server will throw an error + delete obj.metadata.resourceVersion; + // for v1 in g12, we will ignore the schema version validation from all default clients, // as we implement the necessary backend conversions, we will drop this query param if (dashboard.uid) { obj.metadata.name = dashboard.uid; - // remove resource version when updating - delete obj.metadata.resourceVersion; return this.client.update(obj, { fieldValidation: 'Ignore' }).then((v) => this.asSaveDashboardResponseDTO(v)); } obj.metadata.annotations = { ...obj.metadata.annotations, [AnnoKeyGrantPermissions]: 'default', }; + // non-scene dashboard will have obj.metadata.name when trying to save a dashboard copy + delete obj.metadata.name; return this.client.create(obj, { fieldValidation: 'Ignore' }).then((v) => this.asSaveDashboardResponseDTO(v)); }