mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Service accounts: rename feature toggle (#48037)
* refactor: renaming service-accounts to serviceAccounts * refactor: renaming service-accounts to serviceAccounts in docs * tests
This commit is contained in:
parent
ae8038c5c6
commit
8677552dda
@ -14,7 +14,7 @@ You can create a service account token using the Grafana UI or via the API. For
|
|||||||
|
|
||||||
## Before you begin
|
## Before you begin
|
||||||
|
|
||||||
- Ensure you have added the `service-accounts` feature toggle to Grafana. For more information about adding the `service-accounts` feature toggle, refer to [Enable service accounts]({{< relref "./enable-service-accounts.md#">}}).
|
- Ensure you have added the `serviceAccounts` feature toggle to Grafana. For more information about adding the feature toggle, refer to [Enable service accounts]({{< relref "./enable-service-accounts.md#">}}).
|
||||||
- Ensure you have permission to create and edit service accounts. For more information about user roles, refer to [About users and permissions]({{< relref "../manage-users-and-permissions/about-users-and-permissions.md#">}}).
|
- Ensure you have permission to create and edit service accounts. For more information about user roles, refer to [About users and permissions]({{< relref "../manage-users-and-permissions/about-users-and-permissions.md#">}}).
|
||||||
- [Create a service account in Grafana]({{< relref "./create-service-account.md#">}}).
|
- [Create a service account in Grafana]({{< relref "./create-service-account.md#">}}).
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ For more information about creating service accounts via the API, refer to [Crea
|
|||||||
|
|
||||||
## Before you begin
|
## Before you begin
|
||||||
|
|
||||||
- Ensure you have added the feature toggle for service accounts `service-accounts`. For more information about adding the `service-account` feature toggle, refer to [Enable service accounts]({{< relref "./enable-service-accounts.md#">}}).
|
- Ensure you have added the feature toggle for service accounts `serviceAccounts`. For more information about adding the feature toggle, refer to [Enable service accounts]({{< relref "./enable-service-accounts.md#">}}).
|
||||||
- Ensure you have permission to create and edit service accounts. For more information about user permissions, refer to [About users and permissions]({{< relref "../manage-users-and-permissions/about-users-and-permissions.md#">}}).
|
- Ensure you have permission to create and edit service accounts. For more information about user permissions, refer to [About users and permissions]({{< relref "../manage-users-and-permissions/about-users-and-permissions.md#">}}).
|
||||||
|
|
||||||
**To create a service account:**
|
**To create a service account:**
|
||||||
|
@ -22,12 +22,12 @@ You can enable service accounts by:
|
|||||||
This topic shows you how to enable service accounts by modifying the Grafana configuration file.
|
This topic shows you how to enable service accounts by modifying the Grafana configuration file.
|
||||||
|
|
||||||
1. Sign in to the Grafana server and locate the configuration file. For more information about finding the configuration file, refer to LINK.
|
1. Sign in to the Grafana server and locate the configuration file. For more information about finding the configuration file, refer to LINK.
|
||||||
1. Open the configuration file and locate the [feature toggles] section. In your [config file]({{< relref "../../administration/configuration.md#config-file-locations" >}}), add `service-accounts` as a [feature_toggle]({{< relref "../../administration/configuration.md#feature_toggle" >}}).
|
1. Open the configuration file and locate the [feature toggles] section. In your [config file]({{< relref "../../administration/configuration.md#config-file-locations" >}}), add `serviceAccounts` as a [feature_toggle]({{< relref "../../administration/configuration.md#feature_toggle" >}}).
|
||||||
|
|
||||||
```
|
```
|
||||||
[feature_toggles]
|
[feature_toggles]
|
||||||
# enable features, separated by spaces
|
# enable features, separated by spaces
|
||||||
enable = service-accounts
|
enable = serviceAccounts
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Save your changes, Grafana should recognize your changes; in case of any issues we recommend restarting the Grafana server.
|
1. Save your changes, Grafana should recognize your changes; in case of any issues we recommend restarting the Grafana server.
|
||||||
@ -38,6 +38,6 @@ This topic shows you how to enable service accounts by setting environment varia
|
|||||||
|
|
||||||
> **Note:** Environment variables override any configuration file settings.
|
> **Note:** Environment variables override any configuration file settings.
|
||||||
|
|
||||||
You can use `GF_FEATURE_TOGGLES_ENABLE = service-accounts` environment variable.
|
You can use `GF_FEATURE_TOGGLES_ENABLE = serviceAccounts` environment variable.
|
||||||
|
|
||||||
For more information regarding on how to setup environment variables refer to [Configuring with environment variables]({{< relref "../../administration/configuration.md#override-configuration-with-environment-variables" >}}).
|
For more information regarding on how to setup environment variables refer to [Configuring with environment variables]({{< relref "../../administration/configuration.md#override-configuration-with-environment-variables" >}}).
|
||||||
|
@ -19,7 +19,7 @@ export interface FeatureToggles {
|
|||||||
trimDefaults?: boolean;
|
trimDefaults?: boolean;
|
||||||
envelopeEncryption?: boolean;
|
envelopeEncryption?: boolean;
|
||||||
httpclientprovider_azure_auth?: boolean;
|
httpclientprovider_azure_auth?: boolean;
|
||||||
['service-accounts']?: boolean;
|
serviceAccounts?: boolean;
|
||||||
database_metrics?: boolean;
|
database_metrics?: boolean;
|
||||||
dashboardPreviews?: boolean;
|
dashboardPreviews?: boolean;
|
||||||
dashboardPreviewsScheduler?: boolean;
|
dashboardPreviewsScheduler?: boolean;
|
||||||
|
@ -24,7 +24,7 @@ var (
|
|||||||
State: FeatureStateBeta,
|
State: FeatureStateBeta,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "service-accounts",
|
Name: "serviceAccounts",
|
||||||
Description: "support service accounts",
|
Description: "support service accounts",
|
||||||
State: FeatureStateBeta,
|
State: FeatureStateBeta,
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@ const (
|
|||||||
|
|
||||||
// FlagServiceAccounts
|
// FlagServiceAccounts
|
||||||
// support service accounts
|
// support service accounts
|
||||||
FlagServiceAccounts = "service-accounts"
|
FlagServiceAccounts = "serviceAccounts"
|
||||||
|
|
||||||
// FlagDatabaseMetrics
|
// FlagDatabaseMetrics
|
||||||
// Add prometheus metrics for database tables
|
// Add prometheus metrics for database tables
|
||||||
|
@ -11,7 +11,7 @@ func TestFeatureUsageStats(t *testing.T) {
|
|||||||
featureManagerWithAllFeatures := WithFeatures(
|
featureManagerWithAllFeatures := WithFeatures(
|
||||||
"trimDefaults",
|
"trimDefaults",
|
||||||
"httpclientprovider_azure_auth",
|
"httpclientprovider_azure_auth",
|
||||||
"service-accounts",
|
"serviceAccounts",
|
||||||
"database_metrics",
|
"database_metrics",
|
||||||
"dashboardPreviews",
|
"dashboardPreviews",
|
||||||
"live-config",
|
"live-config",
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ServiceAccountFeatureToggleNotFound = "FeatureToggle service-accounts not found, try adding it to your custom.ini"
|
ServiceAccountFeatureToggleNotFound = "FeatureToggle serviceAccounts not found, try adding it to your custom.ini"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServiceAccountsService struct {
|
type ServiceAccountsService struct {
|
||||||
|
@ -15,7 +15,7 @@ func TestProvideServiceAccount_DeleteServiceAccount(t *testing.T) {
|
|||||||
t.Run("feature toggle present, should call store function", func(t *testing.T) {
|
t.Run("feature toggle present, should call store function", func(t *testing.T) {
|
||||||
storeMock := &tests.ServiceAccountsStoreMock{Calls: tests.Calls{}}
|
storeMock := &tests.ServiceAccountsStoreMock{Calls: tests.Calls{}}
|
||||||
svc := ServiceAccountsService{
|
svc := ServiceAccountsService{
|
||||||
features: featuremgmt.WithFeatures("service-accounts", true),
|
features: featuremgmt.WithFeatures("serviceAccounts", true),
|
||||||
store: storeMock}
|
store: storeMock}
|
||||||
err := svc.DeleteServiceAccount(context.Background(), 1, 1)
|
err := svc.DeleteServiceAccount(context.Background(), 1, 1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -25,7 +25,7 @@ func TestProvideServiceAccount_DeleteServiceAccount(t *testing.T) {
|
|||||||
t.Run("no feature toggle present, should not call store function", func(t *testing.T) {
|
t.Run("no feature toggle present, should not call store function", func(t *testing.T) {
|
||||||
svcMock := &tests.ServiceAccountsStoreMock{Calls: tests.Calls{}}
|
svcMock := &tests.ServiceAccountsStoreMock{Calls: tests.Calls{}}
|
||||||
svc := ServiceAccountsService{
|
svc := ServiceAccountsService{
|
||||||
features: featuremgmt.WithFeatures("service-accounts", false),
|
features: featuremgmt.WithFeatures("serviceAccounts", false),
|
||||||
store: svcMock,
|
store: svcMock,
|
||||||
log: log.New("serviceaccounts-manager-test"),
|
log: log.New("serviceaccounts-manager-test"),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user