add variable from secret when applying istio cr (#1877)

This commit is contained in:
Jun
2025-03-17 10:59:05 +08:00
committed by GitHub
parent 34b3fc3114
commit 4a82d50d80
8 changed files with 927 additions and 1 deletions

View File

@@ -144,3 +144,15 @@ func ApplyConfigmapDataWithYaml(t *testing.T, c client.Client, namespace string,
t.Logf("🏗 Updating %s %s", name, namespace)
return c.Update(ctx, cm)
}
func ApplySecret(t *testing.T, c client.Client, namespace string, name string, key string, val string) error {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
cm := &v1.Secret{}
if err := c.Get(ctx, client.ObjectKey{Namespace: namespace, Name: name}, cm); err != nil {
return err
}
cm.Data[key] = []byte(val)
t.Logf("🏗 Updating Secret %s %s", name, namespace)
return c.Update(ctx, cm)
}