mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 12:14:08 -06:00
add comments (#52124)
This commit is contained in:
parent
894e519406
commit
dfc7a98d87
@ -9,9 +9,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
secretMigrationStatusKey = "secretMigrationStatus"
|
// Not set means migration has not happened
|
||||||
|
secretMigrationStatusKey = "secretMigrationStatus"
|
||||||
|
// Migration happened with disableSecretCompatibility set to false
|
||||||
compatibleSecretMigrationValue = "compatible"
|
compatibleSecretMigrationValue = "compatible"
|
||||||
completeSecretMigrationValue = "complete"
|
// Migration happened with disableSecretCompatibility set to true
|
||||||
|
completeSecretMigrationValue = "complete"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DataSourceSecretMigrationService struct {
|
type DataSourceSecretMigrationService struct {
|
||||||
@ -38,8 +41,13 @@ func (s *DataSourceSecretMigrationService) Migrate(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this flag is true, delete secrets from the legacy secrets store as they are migrated
|
||||||
disableSecretsCompatibility := s.features.IsEnabled(featuremgmt.FlagDisableSecretsCompatibility)
|
disableSecretsCompatibility := s.features.IsEnabled(featuremgmt.FlagDisableSecretsCompatibility)
|
||||||
|
// If migration hasn't happened, migrate to unified secrets and keep copy in legacy
|
||||||
|
// If a complete migration happened and now backwards compatibility is enabled, copy secrets back to legacy
|
||||||
needCompatibility := migrationStatus != compatibleSecretMigrationValue && !disableSecretsCompatibility
|
needCompatibility := migrationStatus != compatibleSecretMigrationValue && !disableSecretsCompatibility
|
||||||
|
// If migration hasn't happened, migrate to unified secrets and delete from legacy
|
||||||
|
// If a compatible migration happened and now compatibility is disabled, delete secrets from legacy
|
||||||
needMigration := migrationStatus != completeSecretMigrationValue && disableSecretsCompatibility
|
needMigration := migrationStatus != completeSecretMigrationValue && disableSecretsCompatibility
|
||||||
|
|
||||||
if needCompatibility || needMigration {
|
if needCompatibility || needMigration {
|
||||||
|
Loading…
Reference in New Issue
Block a user