File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
pkg/controller/mysqlbackup/internal/syncer Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -135,24 +135,24 @@ func (s *jobSyncer) ensurePodSpec(in core.PodSpec) core.PodSpec {
135135
136136 boolTrue := true
137137 in .Containers [0 ].Env = []core.EnvVar {
138- core. EnvVar {
139- Name : "MYSQL_BACKUP_USER " ,
138+ {
139+ Name : "BACKUP_USER " ,
140140 ValueFrom : & core.EnvVarSource {
141141 SecretKeyRef : & core.SecretKeySelector {
142142 LocalObjectReference : core.LocalObjectReference {
143- Name : s .cluster .Spec . SecretName ,
143+ Name : s .cluster .GetNameForResource ( mysqlcluster . Secret ) ,
144144 },
145145 Key : "BACKUP_USER" ,
146146 Optional : & boolTrue ,
147147 },
148148 },
149149 },
150- core. EnvVar {
151- Name : "MYSQL_BACKUP_PASSWORD " ,
150+ {
151+ Name : "BACKUP_PASSWORD " ,
152152 ValueFrom : & core.EnvVarSource {
153153 SecretKeyRef : & core.SecretKeySelector {
154154 LocalObjectReference : core.LocalObjectReference {
155- Name : s .cluster .Spec . SecretName ,
155+ Name : s .cluster .GetNameForResource ( mysqlcluster . Secret ) ,
156156 },
157157 Key : "BACKUP_PASSWORD" ,
158158 Optional : & boolTrue ,
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package framework
1818
1919import (
2020 "context"
21+ "encoding/json"
2122 "fmt"
2223 "os"
2324
@@ -46,13 +47,18 @@ func (f *Framework) NewGCSBackupSecret() *corev1.Secret {
4647 Logf ("GOOGLE_CREDENTIALS is not set! Backups tests will not work" )
4748 }
4849
50+ jk := make (map [string ]string )
51+ if err := json .Unmarshal ([]byte (json_key ), & jk ); err != nil {
52+ panic ("Failed to unmarshal GOOGLE_CREDENTIALS env value" )
53+ }
4954 return & corev1.Secret {
5055 ObjectMeta : metav1.ObjectMeta {
5156 Name : fmt .Sprintf ("backup-secret-%s" , f .BaseName ),
5257 Namespace : f .Namespace .Name ,
5358 },
5459 StringData : map [string ]string {
5560 "GCS_SERVICE_ACCOUNT_JSON_KEY" : json_key ,
61+ "GCS_PROJECT_ID" : jk ["project_id" ],
5662 },
5763 }
5864}
@@ -83,7 +89,7 @@ func (f *Framework) RefreshBackupFn(backup *api.MysqlBackup) func() *api.MysqlBa
8389 }
8490}
8591
86- // BackupCompleted a matcher to check cluster complition
92+ // BackupCompleted a matcher to check cluster completion
8793func BackupCompleted () gomegatypes.GomegaMatcher {
8894 return PointTo (MatchFields (IgnoreExtras , Fields {
8995 "Status" : MatchFields (IgnoreExtras , Fields {
You can’t perform that action at this time.
0 commit comments