Secrets: Add logging to track secrets migration (#52481)

* add logging to track migration

* fix lint problem
pull/52489/head
Michael Mandrus 3 years ago committed by GitHub
parent 20907d0635
commit acd85314b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      pkg/services/secrets/kvstore/plugin_mig.go

@ -41,6 +41,7 @@ func (s *PluginSecretMigrationService) Migrate(ctx context.Context) error {
// Check if we should migrate to plugin - default false
if s.cfg.SectionWithEnvOverrides("secrets").Key("migrate_to_plugin").MustBool(false) &&
s.remoteCheck.ShouldUseRemoteSecretsPlugin() {
s.logger.Debug("starting migration of unified secrets to the plugin")
// we need to instantiate the secretsKVStore as this is not on wire, and in this scenario,
// the secrets store would be the plugin.
secretsSql := &secretsKVStoreSQL{
@ -63,6 +64,7 @@ func (s *PluginSecretMigrationService) Migrate(ctx context.Context) error {
return err
}
}
s.logger.Debug("migrated unified secrets to plugin", "number of secrets", len(allSec))
// as no err was returned, when we delete all the secrets from the sql store
for _, sec := range allSec {
err = secretsSql.Del(ctx, *sec.OrgId, *sec.Namespace, *sec.Type)
@ -70,6 +72,7 @@ func (s *PluginSecretMigrationService) Migrate(ctx context.Context) error {
return err
}
}
s.logger.Debug("deleted unified secrets after migration", "number of secrets", len(allSec))
}
return nil
}

Loading…
Cancel
Save