Commit Graph

632 Commits

Author SHA1 Message Date
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
Will Browne
8a5c0cfdc0
Plugins: Pass cancellable context during API server creation (#86545) 2024-04-19 09:22:14 +03: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
44adfea049
Server: Fix 'server' subcommand double-registration (#86083)
fix 'server' subcommand double-registration

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
2024-04-15 08:21:03 -04:00
Charandas
a39fe593c2
K8s: remove standalone authenticator in favor of providing one through the factory (#85901) 2024-04-11 21:30:23 +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
Charandas
0f1151964c
K8s: standalone authenticator that allows a type of downstream forwarding (#85130) 2024-03-28 20:52:28 +02: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
488bbaacab
Chore: Remove unused dependenices in plugin client middlewares (#84624)
* Chore: Remove unused dependenices in plugin client middlewares

* refactor logger middleware to remove cfg dependency

* hack to make tracing work in api group builders
2024-03-22 12:54:35 +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
Charandas
2d1cd82a98
K8s: standalone: use Grafana's logger to stream all logs (#84530)
---
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2024-03-18 19:25:30 +02:00
Will Browne
9d453d0dcc
Plugins: Remove direct featuremgmt.FeatureToggles dependency from plugins config (#84482) 2024-03-15 10:58:51 +01:00
Gilles De Mey
8765c48389
Alerting: Remove legacy alerting (#83671)
Removes legacy alerting, so long and thanks for all the fish! 🐟

---------

Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
Co-authored-by: Sonia Aguilar <soniaAguilarPeiron@users.noreply.github.com>
Co-authored-by: Armand Grillet <armandgrillet@users.noreply.github.com>
Co-authored-by: William Wernert <rwwiv@users.noreply.github.com>
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-03-14 15:36:35 +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
Todd Treece
e5a26a3f7c
K8s: Add apimachinery and apiserver packages (#83190) 2024-02-23 15:15:43 -05:00
Charandas
0bd009fb53
K8s: fix nil deref from dummy factory for API Server options (#83132) 2024-02-20 23:00:02 +02: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
Ryan McKinley
c879588332
APIServer: Use options pattern in standalone mode (#82760)
use options
2024-02-15 12:00:20 -08: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
40a08a7720
K8s: use +enum tag in playlist and unstructured dummy (#82022) 2024-02-06 16:10:32 -08:00
Ryan McKinley
91754bcda5
K8s: Refactor standalone apiserver initialization (#81932) 2024-02-06 08:40:35 -08:00
Ryan McKinley
810d14d88f
K8s: use --runtime-config={group}/{version}=true to enabled APIs (#81614) 2024-02-01 22:06:28 -08:00
Michael Mandrus
7464ea4346
Feature Toggles: Switch feature toggle admin page over to k8s API (#80854)
* add handling for legacy and k8s apis to frontend

* use backend srv directly not redux

* add unit test to make sure the correct apis are being called

* require api server flag

* fix feature toggle name

* ensure both pages work correctly

* make consistent with legacy api

* implement webhook update

* fix unit test

* remove old apis and update

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2024-02-01 23:52:02 -05:00
Todd Treece
67b6be5515
K8s: Refactor config/options for aggregation (#81739) 2024-02-01 17:27:30 -05:00
Ryan McKinley
e013cd427c
K8s: Add basic query service (#80325) 2024-01-31 20:36:51 +02: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
Will Browne
2a0f1900d5
Datasources: Add wireset for datasource.DataSourceAPIBuilder (#80914)
tidy up
2024-01-22 15:21:27 +01:00
Ryan McKinley
41e523bde7
K8s/FeatureFlags: Add an apiserver to manage feature flags (dev only) (#80501)
* add deployment registry API cloud only

* update versions

* add feature flag endpoints

* use helpers

* merge main

* update AllowSelfServie and re-run code gen

* fix package name

* add allowselfserve flag to payload

* remove config

* update list api to return the full registry including states

* change enabled check

* fix compile error

* add feature toggle and split path in frontend

* changes

* with status

* add more status/state

* add back config thing

* add back config thing

* merge main

* merge main

* now on the /current api endpoint

* now on the /current api endpoint

* drop frontend changes

* change group name to featuretoggle (singular)

* use the same settings

* now with patch

* more common refs

* more common refs

* WIP actually do the webhook

* fix comment

* fewer imports

* registe standalone

* one less file

* fix singular name

---------

Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
2024-01-17 21:32:44 -08:00
Charandas
87c3d3b029
K8s: add the CRD server to the grafana-aggregator component (pkg/cmd) (#80759) 2024-01-17 12:21:24 -08:00
Tolya Korniltsev
b5a1a3e106
Profiling: Import godeltaprof/http/pprof (#80509)
chore: import godeltaprof/http/pprof

This adds /debug/pprof/delta_{heap,mutex,block} endpoints to DefaultServeMux
and the profiling port.
2024-01-16 17:58:35 +07:00
Ryan McKinley
6be6724433
K8s/Testdata: Expose testdata in standalone apiserver (#80248) 2024-01-10 17:45:23 +02:00
Ryan McKinley
ee7daeb2a7
APIServer: Move shared code to a utility/helper function (#80261) 2024-01-10 07:30:16 -08:00
Charandas
48612063dd
Grafana app platform: an aggregator cmd and package (#79948) 2024-01-08 22:33:42 +02:00
Todd Treece
d492100adc
Chore: Bump k8s dependencies to v0.29.0 (#79492)
* Chore: Bump k8s dependencies to v0.29.0

* update the openapi fork

* use post process spec

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-12-14 10:00:48 -05:00
Todd Treece
2a2a132c61
K8s: Refactor metrics to share k8s registry (#79106) 2023-12-06 16:34:23 -05:00
Ryan McKinley
439edebcd6
K8s: fix standalone command and add hack scripts (#79052)
Co-authored-by: Charandas Batra <charandas.batra@grafana.com>
2023-12-05 14:31:49 -08:00
Todd Treece
7e2aad1d01
Revert "K8s: Refactor metrics to share k8s registry (#77957)" (#79079)
This reverts commit 38bc41651a.
2023-12-05 09:34:07 -05:00
Todd Treece
38bc41651a
K8s: Refactor metrics to share k8s registry (#77957)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-12-04 10:54:59 -08: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