Secrets: garbage collection (#110247)

* clean up older secret versions

* start gargbage collection worker as background service

* make gen-go

* fix typo

* make update-workspace

* undo go mod changes

* undo go work sum changes

* Update pkg/registry/apis/secret/garbagecollectionworker/worker.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/registry/apis/secret/garbagecollectionworker/worker.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* default gc_worker_batch_size to 1 minute

* fix typo

* fix typo

* add test to ensure cleaning up secure values is idempotent

* make gen-go

* make update-workspace

* undo go.mod and .sum changes

* undo enterprise imports

---------

Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
This commit is contained in:
Bruno
2025-09-02 11:11:01 -03:00
committed by GitHub
co-authored by Matheus Macabu Matheus Macabu
parent d5eb3e291a
commit f8cd7049e8
30 changed files with 1069 additions and 35 deletions
+5
View File
@@ -42,10 +42,12 @@ import (
"github.com/grafana/grafana/pkg/middleware/loggermw"
apiregistry "github.com/grafana/grafana/pkg/registry/apis"
"github.com/grafana/grafana/pkg/registry/apis/dashboard/legacy"
secretclock "github.com/grafana/grafana/pkg/registry/apis/secret/clock"
secretcontracts "github.com/grafana/grafana/pkg/registry/apis/secret/contracts"
secretdecrypt "github.com/grafana/grafana/pkg/registry/apis/secret/decrypt"
cipher "github.com/grafana/grafana/pkg/registry/apis/secret/encryption/cipher/service"
encryptionManager "github.com/grafana/grafana/pkg/registry/apis/secret/encryption/manager"
secretsgarbagecollectionworker "github.com/grafana/grafana/pkg/registry/apis/secret/garbagecollectionworker"
secretinline "github.com/grafana/grafana/pkg/registry/apis/secret/inline"
secretmutator "github.com/grafana/grafana/pkg/registry/apis/secret/mutator"
secretsecurevalueservice "github.com/grafana/grafana/pkg/registry/apis/secret/service"
@@ -312,6 +314,7 @@ var wireBasicSet = wire.NewSet(
wire.Bind(new(secrets.Service), new(*secretsManager.SecretsService)),
secretsDatabase.ProvideSecretsStore,
wire.Bind(new(secrets.Store), new(*secretsDatabase.SecretsStoreImpl)),
secretsgarbagecollectionworker.ProvideWorker,
grafanads.ProvideService,
wire.Bind(new(dashboardsnapshots.Store), new(*dashsnapstore.DashboardSnapshotStore)),
dashsnapstore.ProvideStore,
@@ -442,7 +445,9 @@ var wireBasicSet = wire.NewSet(
secretmutator.ProvideSecureValueMutator,
secretmigrator.NewWithEngine,
secretdatabase.ProvideDatabase,
secretclock.ProvideClock,
wire.Bind(new(secretcontracts.Database), new(*secretdatabase.Database)),
wire.Bind(new(secretcontracts.Clock), new(*secretclock.Clock)),
encryptionManager.ProvideEncryptionManager,
cipher.ProvideAESGCMCipherService,
// Unified storage
+11 -5
View File
File diff suppressed because one or more lines are too long