Secrets: Refactor data_key_id out of the encoded secure value payload (#112077)

* Secrets: Refactor data_key_id out of the encoded secure value payload (#111852)

* everything compiles

* tests pass

* remove file included by accident

* add entry to gitignore

* some scaffolding for the migration executor

* remove file

* implement and test the migration

* use xkube.Namespace in our interfaces

* add todo

* update wire deps

* add some logs

* fix wire dependency ordering

* create tests to validate error conditions during migrations

* only run the migration as an MT api server

* formatting issues

* change detection of secrets running as MT server

* add todo

* use more specific initializer flags

* make secrets playwright tests work

* set new properties to true by default

* remove developer mode flag

* fix unit tests
This commit is contained in:
Michael Mandrus
2025-10-30 23:04:32 -04:00
committed by GitHub
parent f61578a50f
commit cf242def3a
57 changed files with 943 additions and 249 deletions
+4 -1
View File
@@ -6,6 +6,7 @@ import (
"testing"
"time"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
"github.com/stretchr/testify/require"
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -16,7 +17,9 @@ import (
func TestIntegrationProvisioning_InlineSecrets(t *testing.T) {
testutil.SkipIntegrationTestInShortMode(t)
helper := runGrafana(t)
helper := runGrafana(t, func(opts *testinfra.GrafanaOpts) {
opts.SecretsManagerEnableDBMigrations = true
})
createOptions := metav1.CreateOptions{FieldValidation: "Strict"}
ctx := context.Background()
+8
View File
@@ -552,6 +552,13 @@ func CreateGrafDir(t *testing.T, opts GrafanaOpts) (string, string) {
require.NoError(t, err)
}
if opts.SecretsManagerEnableDBMigrations {
apiserverSection, err := getOrCreateSection("secrets_manager")
require.NoError(t, err)
_, err = apiserverSection.NewKey("run_secrets_db_migrations", "true")
require.NoError(t, err)
}
dashboardsSection, err := getOrCreateSection("dashboards")
require.NoError(t, err)
_, err = dashboardsSection.NewKey("min_refresh_interval", "10s")
@@ -623,6 +630,7 @@ type GrafanaOpts struct {
EnableSCIM bool
APIServerRuntimeConfig string
DisableControllers bool
SecretsManagerEnableDBMigrations bool
// When "unified-grpc" is selected it will also start the grpc server
APIServerStorageType options.StorageType