Commit Graph

344 Commits

Author SHA1 Message Date
Andres Martinez Gotor
4c4f7a3331
Chore: Restore permissions used to create plugins dir (#94139) 2024-10-03 09:09:54 +02:00
Jeff Levin
a21a232a8e
Revert read replica POC (#93551)
* Revert "chore: add replDB to team service (#91799)"

This reverts commit c6ae2d7999.

* Revert "experiment: use read replica for Get and Find Dashboards (#91706)"

This reverts commit 54177ca619.

* Revert "QuotaService: refactor to use ReplDB for Get queries (#91333)"

This reverts commit 299c142f6a.

* Revert "refactor replCfg to look more like plugins/plugin config (#91142)"

This reverts commit ac0b4bb34d.

* Revert "chore (replstore): fix registration with multiple sql drivers, again (#90990)"

This reverts commit daedb358dd.

* Revert "Chore (sqlstore): add validation and testing for repl config (#90683)"

This reverts commit af19f039b6.

* Revert "ReplStore: Add support for round robin load balancing between multiple read replicas (#90530)"

This reverts commit 27b52b1507.

* Revert "DashboardStore: Use ReplDB and get dashboard quotas from the ReadReplica (#90235)"

This reverts commit 8a6107cd35.

* Revert "accesscontrol service read replica (#89963)"

This reverts commit 77a4869fca.

* Revert "Fix: add mapping for the new mysqlRepl driver (#89551)"

This reverts commit ab5a079bcc.

* Revert "fix: sql instrumentation dual registration error (#89508)"

This reverts commit d988f5c3b0.

* Revert "Experimental Feature Toggle: databaseReadReplica (#89232)"

This reverts commit 50244ed4a1.
2024-09-25 15:21:39 -08:00
Andres Martinez Gotor
f9cd0fe5d1
Add debug headers when downloading plugins (#92579) 2024-08-29 11:30:21 +02:00
Misi
a3d688c8ed
CLI: Provide the list of admins if the admin with the default ID was not found (#92217)
* Provide the list of admins if the admin with the default ID was not found

* Clean up

* Update docs

* Update docs/sources/cli.md

Co-authored-by: Dan Cech <dcech@grafana.com>

* Update pkg/cmd/grafana-cli/commands/reset_password_command.go

Co-authored-by: Dan Cech <dcech@grafana.com>

* Lint

---------

Co-authored-by: Dan Cech <dcech@grafana.com>
2024-08-27 16:01:33 +02:00
Andres Martinez Gotor
1b336e94c8
Chore: Check version compatibilty when installing a plugin (#92200) 2024-08-22 13:47:00 +02:00
Dave Henderson
df3d8915ba
Chore: Bump Go to 1.23.0 (#92105)
* chore: Bump Go to 1.23.0

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* update swagger files

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* chore: update .bingo/README.md formatting to satisfy prettier

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* chore(lint): Fix new lint errors found by golangci-lint 1.60.1 and Go 1.23

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* keep golden file

* update openapi

* add name to expected output

* chore(lint): rearrange imports to a sensible order

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2024-08-21 11:40:42 -04:00
Kristin Laemmert
c6ae2d7999
chore: add replDB to team service (#91799) 2024-08-15 12:19:38 -04:00
Kristin Laemmert
299c142f6a
QuotaService: refactor to use ReplDB for Get queries (#91333)
* Feature (quota service): Use ReplDB for quota service Gets

This adds the replDB to the quota service, as well as some more test helper functions to simplify updating tests. My intent is that the helper functions can be removed when this is fully rolled out (or not) and we're consistently using the ReplDB interface (or not!)

* test updates
2024-08-08 13:41:33 -04:00
Will Browne
9300c1bbea
Plugins: Update CLI check if plugin is already installed (#91213)
* check if plugin installed

* undo remove initial vers check

* still attempt deps
2024-08-06 09:21:40 +01:00
Gabriel MABILLE
8988e04044
RBAC: Add permission registry (#91247)
* RBAC: Permission registry

* Populate permission registry

* Wire

* conflic_user_cmd

* Update pkg/services/accesscontrol/permreg/permreg_test.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* PR feedback

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* Remove ToDo, tackle in subsequent PR

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-08-02 09:32:06 +02:00
jackyin
d11f8c7bc3
Plugins: Ensure grafana cli can install multiple plugin dependencies (#91230)
* fix cli can only install one dep

* handle error
2024-08-01 11:47:11 +01:00
Will Browne
343d6f8a0c
Plugins: Support > 1 levels of plugin dependencies (#90174)
* do it

* prevent loops

* change to sync.Map
2024-07-09 15:46:30 +01:00
Kristin Laemmert
77a4869fca
accesscontrol service read replica (#89963)
* accesscontrol service read replica
* now using the ReplDB interface
* ReadReplica for GetUser
2024-07-08 10:00:13 -04:00
Karl Persson
e568b86ac0
Zanzana: Initial work to allow partial data migrations (#89919)
* Zanana: Add Write method to interface

* Zanzana: Add utilities for translating RBAC to openFGA tuple keys

* RBAC: Add zanzana synchronizer

* Run zanzana sync in access controll provider
2024-07-02 14:45:25 +02:00
Dave Henderson
e21d357d67
chore: Updating linter, fixing some new warnings (#88863) 2024-06-06 13:01:27 -04:00
Karl Persson
68f2585712
Cli: Fix bug where password is hashed twice (#88589) 2024-06-03 09:14:55 +02:00
Ieva
3e77768144
RBAC: Expand action sets when fetching permissions (#87967)
* logic to expand action set to the underlying actions when permissions are fetched from the DB

* updates needed for dependency injection

* clean up some code, also deduplicate scopes when grouping scopes and actions

* expand on a comment

* rename a method
2024-05-21 15:09:26 +01:00
Alexander Zobnin
82dea4b3e5
Access control: Cache basic roles and teams permissions (#87043)
* RBAC: Cache basic roles permissions

* Cache teams permissions

* Set cache TTL to 1 minute

* Add OSS implementation

* Fetch basic role permissions correctly

* fix conflict_user_command

* Fix teams permissions query

* Add traces for GetUserPermissions

* Fix folders tests

* Fix colflict user command

* Update store mock

* Fix linter error

* Reuse GetUserPermissions for fetching basic roles

* tests for GetTeamsPermissions

* pre-allocate slice capacity

* Fix linter
2024-05-07 15:23:11 +02:00
Karl Persson
a2cba3d0b5
User: Add tracing (#87028)
* Inject tracer in tests

* Annotate with traces

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2024-04-30 13:15:56 +02:00
Ieva
cee713e34c
Chore: Add tracing to team service (#86999)
* add tracing to team service

* another test fix

* pass in context for team creation and membership checking
2024-04-29 11:32:03 +01:00
Ieva
8028d1c3e1
Chore: Update tests to use team membership hooks (#86846)
* update tests to use team membership hooks

* linting
2024-04-24 16:55:42 +01:00
Serge Zaitsev
522a98c126
Chore: Make Cfg field private in SQLStore (#85593)
* make cfg private in sqlstore

* fix db init in tests

* fix case

* fix folder test init

* fix imports

* make another Cfg private

* remove another Cfg

* remove unused variable

* use store cfg, it has side-effects

* fix mutated cfg in tests
2024-04-24 10:38:40 +02:00
Timur Olzhabayev
951916c668
Chore: Making the plugin install commands respect the config parameter (#86578)
Currently the grafana cli plugin commands are not reacting to the --config parameter. This PR make it possible to use config to define the plugin endpoints via config as an alternative to providing the --repo flag.
2024-04-22 10:29:25 +02:00
Vanilla
817f787947
Cli: Check missing plugin parameter of plugin update command (#86410)
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2024-04-18 15:46:04 +02:00
Karl Persson
1a6777cb93
User: use update function for password updates (#86419)
* Update password through Update function instead

* Remove duplicated to lower

* Refactor password code
2024-04-17 15:24:36 +02:00
Dave Henderson
5687243d0b
Feature Flags: use FeatureToggles interface where possible (#85131)
* Feature Flags: use FeatureToggles interface where possible

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* Replace TestFeatureToggles with existing WithFeatures

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
2024-04-04 12:22:31 -04:00
Eric Leijonmarck
2f7fd729ef
Auth: Enable case insensitive logins/emails by default (#84840)
* wip

* wip

* wip

* wip postgres tests
2024-03-22 16:45:18 +01:00
Marcus Efraimsson
6c1de260a2
API Server: Standalone observability (#84789)
Adds support for logs (specify level), metrics (enable metrics and Prometheus /metrics endpoint 
and traces (jaeger or otlp) for standalone API server. This will allow any grafana core service 
part of standalone apiserver to use logging, metrics and traces as normal.
2024-03-21 17:06:32 +01:00
Will Browne
9d453d0dcc
Plugins: Remove direct featuremgmt.FeatureToggles dependency from plugins config (#84482) 2024-03-15 10:58:51 +01:00
Jo
cc3b088b6c
Teams: Fix missing context in team service (#83327)
fix missing context in team service
2024-02-27 11:10:54 +01:00
linoman
ac84069071
Password policy (#82268)
* add password service interface

* add password service implementation

* add tests for password service

* add password service wiring

* add feature toggle

* Rework from service interface to static function

* Replace previous password validations

* Add codeowners to password service

* add error logs

* update config files


---------

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2024-02-16 04:58:05 -06:00
Gabriel MABILLE
846eadff63
RBAC Search: Replace userLogin filter by namespacedID filter (#81810)
* Add namespace ID

* Refactor and add tests

* Rename maxOneOption -> atMostOneOption

* Add ToDo

* Remove UserLogin & UserID for NamespaceID

Co-authored-by: jguer <joao.guerreiro@grafana.com>

* Remove unecessary import of the userSvc

* Update pkg/services/accesscontrol/acimpl/service.go

* fix 1 -> userID

* Update pkg/services/accesscontrol/accesscontrol.go

---------

Co-authored-by: jguer <joao.guerreiro@grafana.com>
2024-02-16 11:42:36 +01:00
Karl Persson
1315c67c8b
Team/User: UID migrations (#82298)
* Add user uid migration to run on every startup to protect against empty values in a upgrade downgrade scenario

* Add team uid migration to run on every startup to protect against empty values in a upgrade downgrade scenario

* Run team uid migration
2024-02-12 14:48:29 +01:00
Dan Cech
790e1feb93
Chore: Update test database initialization (#81673)
* streamline initialization of test databases, support on-disk sqlite test db

* clean up test databases

* introduce testsuite helper

* use testsuite everywhere we use a test db

* update documentation

* improve error handling

* disable entity integration test until we can figure out locking error
2024-02-09 09:35:39 -05:00
Ryan McKinley
1fab107e79
FeatureFlags: Avoid using cfg.IsFeatureToggleEnabled (#81407) 2024-01-28 15:22:45 -08:00
Gabriel MABILLE
722b78f3e0
RBAC: Add userLogin filter to the permission search endpoint (#81137)
* RBAC: Search add user login filter

* Switch to a userService resolving instead

* Remove unused error

* Fallback to use the cache

* account for userID filter

* Account for the error

* snake case

* Add test cases

* Add api tests

* Fix return on error

* Re-order imports
2024-01-26 09:43:16 +01:00
Marcus Efraimsson
6768c6c059
Chore: Remove public vars in setting package (#81018)
Removes the public variable setting.SecretKey plus some other ones. 
Introduces some new functions for creating setting.Cfg.
2024-01-23 12:36:22 +01:00
Dan Cech
318f51eaee
Chore: Remove unused CacheService dependency from sqlstore (#78507)
remove unused CacheService dependency from sqlstore
2023-12-04 10:00:45 -05:00
Andres Martinez Gotor
20f3a87bf5
Bug: Fix loading behavior with FlagExternalCorePlugins (#78388) 2023-11-21 11:51:13 +01:00
Horst Gutmann
9813d17e93
Expose enterprise-commit in server version output (#75897)
* Expose enterprise-commit in server version output

* Define a DefaultCommitValue constant
2023-10-04 14:51:35 +02:00
Kristin Laemmert
0de2c9eb96
feat: add ability to launch targeted dskit modules in the grafana server CLI command (#74188)
* feat: add ability to launch targeted dskit modules in the grafana server CLI command

This commit adds a ModuleServer and ModuleRunner suitable for launching dskit services and updates the server cli command to use this instead of the full Server. The default behavior is unchanged and will launch the full Grafana server. Individual services are targeted by setting target=comma,seperated,list in the config file.

* require dev mode to target dskit modules

* remove unused type

* replace setting.CommandLineArgs w/setting.Cfg; the caller can deal with calling setting.NewCfg

* Update pkg/server/module_server.go

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>

---------

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
2023-09-01 08:09:54 -04:00
Ryan McKinley
025b2f3011
Chore: use any rather than interface{} (#74066) 2023-08-30 18:46:47 +03:00
Hugo Kiyodi Oshiro
bc3d22ec48
Plugin: Remove error on invalid version (#71951)
* Remove error on invalid version

* Skip test case
2023-07-19 16:55:31 +02:00
Hugo Kiyodi Oshiro
2776a000ab
Plugin: Validate plugin version on installation (#71488) 2023-07-17 10:22:28 +02:00
Will Browne
162dde5bdd
Plugins: Use suffix for plugin directory (#71375)
* plugin dir suffix

* fix whitespace

* fix cli

* fix tests

* fixup

* simplify

* undo uninstall changes
2023-07-14 11:49:05 +02:00
Hugo Kiyodi Oshiro
fe4a932c6e
Plugins: Fail plugins installation on wrong args provided (#71355)
* Return error on plugin install extra args

* Remove unused valid argument

* Add log for wrong installation args
2023-07-12 13:52:12 +02:00
Serge Zaitsev
47b2e7f1d7
Fix: Create store only once in cli mode (#70391)
fix: create store only once in cli mode
2023-06-20 17:28:42 +02:00
Will Browne
a221e1d226
Plugins: Standardize Golang enum naming convention (#69449)
* standardize enum pattern

* fix up
2023-06-08 12:21:19 +02:00
Will Browne
12dc56ad0c
Plugins: Refactor plugin repository API (#69063)
* support grafana wildcard version

* undo go.mod changes

* tidy

* flesh out tests

* refactor

* add tests

* tidy naming

* undo some changes

* split interfaces

* separation

* update new signature

* simplify

* update var namings

* unexport types

* introduce opts pattern

* reorder test

* fix compat checks

* middle ground

* unexport client

* move back

* fix tests

* inline logger

* make client usable

* use fake logger

* tidy errors

* remove unused types

* fix test

* review fixes

* rework compatibility

* adjust installer

* fix tests

* opts => cfg

* remove unused var

* fix var name
2023-05-30 11:48:52 +02:00
Eng Zer Jun
7f7b03d794
Chore: Avoid unnecessary byte/string conversions (#69001)
Avoid unnecessary byte/string conversion

We can use alternative functions/methods to avoid unnecessary
byte/string conversion calls.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-05-26 10:08:50 +00:00