180 Commits

Author SHA1 Message Date
b5281c923f K8s: Dashboards: Fix provisioned dashboard cleanup (#104504) 2025-04-25 05:55:50 -06:00
b09d79b21c K8s/Dashboard: Promote from alpha1 to beta1 (#104009) 2025-04-23 20:54:35 +03:00
b887e8aa05 K8s: Dashboards: Add fine grained access control checks to /apis (#104347)
---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
Co-authored-by: Gabriel MABILLE <gabriel.mabille@grafana.com>
Co-authored-by: Marco de Abreu <marco.deabreu@grafana.com>
Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
2025-04-23 03:29:05 +01:00
fc9f32a9f6 SQLTemplates: Add helper to ensure all templates have a test-case (#103964)
* SQLTemplates: Add helper to ensure all templates have a test-case associated

* UnifiedStorage: Add missing sql template test case

* LegacyDashboards: Add sql templates fs to test cases for exhaustiveness check

* RBACStore: Add sql templates fs to test cases for exhaustiveness check

* LegacyIAM: Add missing sql template test cases
2025-04-22 11:21:51 +02:00
efd9334295 Provisioning: route provisioning storage to the provisioning client (#104082) 2025-04-18 21:47:37 +03:00
d57fa1291f Dashboards: Disallow List with RV filter on legacy & align RV format (#104003)
Throw errors when trying to call List in legacy with an RV specified
Change ResourceVersion to microseconds

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
2025-04-15 22:08:54 +01:00
0283c98e30 K8s/Folders: Use v1beta1 and app-sdk based spec (#103975) 2025-04-14 23:20:10 +03:00
c47ab101d1 Dashboards: Add Dashboard Schema validation (2) (#103844)
* Activate schema validation and align underlying systems

* update to save as v0 if not the right schema version

* Resolve merge conflicts

* Move RequireApiErrorStatus to tests package

* Add mutation tests

* Fix lint

* Only do min version check if dashboard is v1

* Fix lint and disable provisioning test

* Revert provisioning changes

* Revert more tests and add schema test

* Reran gen

* SQL Dashboard save

* Adjust APIVERSION

* Fixed mutation test

* Add logging on downgrade

---------

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-04-11 23:05:41 +02:00
b39eaac69e Unistore: Keep apiVersion from the legacy SQL table (#103939)
keep apiversion
2025-04-11 22:49:45 +03:00
bba85c1128 K8s: Dashboards: Fix error handling (#103929) 2025-04-11 13:31:41 -06:00
95f04c79cd Dashboards: Add Dashboard Schema validation (1) (#103662) 2025-04-11 16:52:46 +00:00
f5ad1ef69b K8s: Folders: Add v1 api (#103842) 2025-04-11 13:09:52 +01:00
757be6365a CI: Bump golangci-lint to 2.0.2 (#103572) 2025-04-10 14:42:23 +02:00
a01d8a0871 K8s: Dashboards: Allow userID to not be set for quota check (#103745) 2025-04-09 19:53:43 +01:00
af8a70bbab K8s/Permissions: Enable a grant-permissions annotation action to set default permissions (#102527)
* create permissions

* add key

* lint

* structure as a delayed callback

* legacy API hook

* merge main

* wired up

* and folders

* watch repos

* missing return statement

* Set the correct permissions

* add TestAfterCreatePermissionCreator

* do not add perms on folder create

* fix tests

* add annotation on create

* lint

* lint

* ensure we set permissions when the FT is disabled

* remove custom folder_storage

* fix lint

* change default

* lint

* lint

* fix: annotation

* ensure permissions are added on folder legacy

* remove folderstorage again

* fix tests

* add FT

* undo change to folder

* dashboard on create

* remove annotation for folder

* fix tests

* fix prepare after rebase

* fix tests

* fix tests

* fix tests

* lint

* address comments

* add test for prepareObjectForStorage

* add again skipIfMode as per comment

---------

Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
2025-04-09 13:05:37 +02:00
9ba5606c3f K8s: Dashboards V1: Run migrations in mutation hook (#103670) 2025-04-09 01:48:09 -05:00
0c79a8927b Dashboards: Add validation tests for all dual writer modes (#103570)
* Add validation tests for mode 0 and 4

* Add mode 1, 2, 3, 5

---------

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
2025-04-08 14:37:50 +02:00
c8c55621fb Dashboards: Fix dashboard UID inconsistency between creation and retrieval in legacy storage (#103568) 2025-04-08 12:25:32 +02:00
df537d6f0f UniStore/Large Objects: Make threshold configurable (#101774)
* Make blob threshold configurable
* Test condition for deconstructing large objects
* Refactor blob threshold naming
2025-04-08 10:50:35 +02:00
b2f80d4dca Dashboards: Add Dashboard API Validation tests and fix underlying issues (#103502) 2025-04-07 05:44:28 +03:00
364247e26b Provisioning: add most mocks to unit test provisioning jobs (#103446)
* Use interface for factories

* Add most mocks to unit test jobs

* Generate more mocks for main jobs package

* Interface for parser

* Use clients directly without parser

* Regenerate mock

* Eliminate resource clients from Parser

* Interface for folder tree
2025-04-04 15:42:20 +03:00
04fb9f534e Dashboards: Only expose LibraryPanels and search on v0 (not v1+v2) (#103335) 2025-04-03 20:24:12 +03:00
4918d8720c Dashboard Restore: Remove experimental functionality under feature flag dashboardRestore for now - this will be reworked (#103204) 2025-04-03 02:52:54 -05:00
08042ae827 search: add legacy id for all resources in bleve (#103206)
* add legacy id for all resources in bleve
2025-04-02 08:20:23 -04:00
4cb756c5d1 K8s: Fix error conversion for provisioned dashboards (#103074) 2025-03-31 14:34:54 +01:00
f84654d162 Stats: Optimize getting folder stats (#103033) 2025-03-28 20:17:50 -05:00
12c5b81850 K8s: Dashboards: Reduce db calls to get users on list (#103020) 2025-03-27 22:57:49 +02:00
7c2890384a K8s: Dashboards: Set v1alpha1 as priority (#102729) 2025-03-25 10:32:49 -06:00
4d79d5e80c K8s: Fix legacy dashboard folder check (#102660) 2025-03-22 06:22:59 +03:00
08bbd7a536 fix (unified-storage): always do perm filtering in bleve by default (#102541)
* make unifiedStorageSearchPermissionFiltering default true
2025-03-21 10:06:01 -04:00
e2737f195b RBAC: Remove dashboard guardians pt 2 (#102556)
* remove NewByDashboard guardian

* remove unused authorizer

* more cleanup

* simplify canAdmin evaluation
2025-03-21 10:32:27 +00:00
2e2b5942c8 K8s/Unified: Consolidate generation logic in apistore client (#102260) 2025-03-21 10:45:25 +02:00
da95ee22cc K8s: Fix dashboard creation timestamp (#102578) 2025-03-21 07:47:09 +02:00
c33a53a47a K8s: Remove restore functionality; can be done with list (#102560) 2025-03-20 16:38:32 -05:00
6c704484e9 K8s: Add sorting by more than titles (#102403) 2025-03-18 20:23:43 -05:00
6019b21cc5 K8s: Dashboards: Fix multi-org provisioning flow (#102266) 2025-03-17 20:20:03 +02:00
bb881f38bb K8s/Dashboards: Remove uid+version from spec (#101992) 2025-03-16 20:46:12 -05:00
5c24312625 Dashboards: Fix duplicate provisioning when errors occur on title-only based provisioning (#102249)
Dashboards: fix title based provisioning
2025-03-15 21:12:48 -06:00
2456eeb69b fix(unified-storage): Improve test coverage on legacy searcher and parse result helper (#102147)
* include TotalHits when searching for provisioning information and improve tests

* return err when parsing search results with mismatch number of columns and cells and add tests for it
2025-03-14 08:25:59 -04:00
5d2ba10113 K8s/Dashboards: Extract Dashboard APIs to an app submodule (#102029)
* Move dashboard k8s APIs to a separate app

Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com>

* Copy dashboard code in Dockerfile

Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com>

* Fix conversion generation

Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com>

* Update OpenAPI snapshot for dashboard/v0alpha1

Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com>

---------

Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com>
2025-03-13 11:05:01 +02:00
edb331dc00 fix(unified-storage): Fix legacysearch returning mismatched cell/column count in response (#102044)
Fix legacysearch returning less cells than column count in search response
2025-03-12 13:00:22 -07:00
bfedf0b512 Dashboard: Redirect between v1alpha1 and v2alpha1 depending on stored version (#101292)
* wip: Create a proxy state manager to avoid complexity

* Read path redirecting

* add tests for unified dashboard API

* add tests

* Contemplate both formats in DashboardProxy

* Fix force old

* Fix tests for proxy

* catch errors

* Save as V2 when dynamic dashboard is enabled

* Improve tests

* Remove feature toggle

* Use kubernetesDashboards for e2e suite

* Fix issue when loading snapshots

* Fix typescript errors

* Integrate with backend conversion error

* Remove legacy annotation

* fix snapshot loading; lint

* Add missing hideTimeControls

* fix test

* make setupDashboardAPI to all suites

* refactor getDashboardAPI

* Add tests

* fix DashboardScenePage tests

* fix tests

* fix go tests

* Refactor to understand better the need of transforming to v2 to compare

* Fix detect changes logic

* yes status from schema gen

---------

Co-authored-by: alexandra vargas <alexa1866@gmail.com>
Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
2025-03-12 11:43:32 -06:00
42ae2fb026 fix(unified-storage): add missing dashboard legacy_id when in legacy read mode (#101944)
* add missing dashboard legacy_id when in modes 0-2
2025-03-11 12:56:34 -04:00
ea89a68028 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>
2025-03-11 13:00:37 +02:00
64f1df69d5 Search: Rename managed object index (#101856) 2025-03-10 19:48:53 +03:00
827da46c51 Unified Storage: Remove wildcard queries (#101441)
* WIP adding custom analyzer so we can do substring search efficiently

* Adding unit tests for title search

* formatting

* adds more title search unit tests

* organize helpers

* fixes issue caused by having two title mappings

* Removes camelcase token filter since it prevents you from searching for a substring of chars and numbers. Adds regression test.

* adds back mapping for title_phrase

* use simple analyzer for input query string so it doesn't filter out english stop words

* ran bleve tests, table snapshots updated

* ignore linter for "unused" test functions. They are very helpful for troubleshooting search. Keeping them.

* only log total hits and query cost if result not nil

* fixes failing test - one more field because there are two title mappings now

* fix test

* fixes test - only take first item when its the title

* Adds separate internal field for title ngram mapping.

When searching with a query, results are sorted by score desc.

When searching without a query, results are sorted by title desc.

Adjusts ngram max to be 10.

Text queries are a disjunction of an exact match, phrase match, and a match. Boosted to have priority in that order.

Adds more unit tests for searching.

* linter

* fix test

* ran tests - generated new test dash json

* sort by title phrase instead of title

* fix test - not relying on /apis/dashboard/search to apply title sorting anymore
2025-03-07 09:51:15 -06:00
2e0d2f3c76 fix(unified-storage): break dependency from dualwriter in resource module (#101788) 2025-03-07 15:27:31 +01:00
dc2defd84f K8s/Annotations: Use manager/source annotations rather than repo (#101313)
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-03-05 08:54:20 +02:00
c1b48cc488 Dashboards: Add apiVersion to dashboard table (#100845) 2025-03-04 07:47:45 +03:00
5652e0b835 K8s/Dashboard/SQL: Support ascending order query (#101363) 2025-02-28 11:34:09 +03:00