Skip to content

Commit 959c43b

Browse files
K8SPSMDB-1488: reconfigure PBM on storage secret update (#2103)
Signed-off-by: Mayank Shah <[email protected]>
1 parent c912e05 commit 959c43b

File tree

1 file changed

+30
-0
lines changed
  • pkg/controller/perconaservermongodb

1 file changed

+30
-0
lines changed

pkg/controller/perconaservermongodb/pbm.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func (r *ReconcilePerconaServerMongoDB) reconcilePBMConfig(ctx context.Context,
139139
// Hashes can be equal even if the actual PBM configuration differs from the one that was hashed
140140
// For example, a restore can modify the PBM config
141141
// We should use `isResyncNeeded` to compare the current configuration with the one we need
142+
// Also, storage credentials are not hashed since they are excluded from JSON representation. `isResyncNeeded` will handle it.
142143
if cr.Status.BackupConfigHash == hash && !isResyncNeeded(currentCfg, &main) {
143144
return nil
144145
}
@@ -192,6 +193,15 @@ func isResyncNeeded(currentCfg *config.Config, newCfg *config.Config) bool {
192193
if currentCfg.Storage.S3.Prefix != newCfg.Storage.S3.Prefix {
193194
return true
194195
}
196+
197+
if currentCfg.Storage.S3.Credentials.AccessKeyID != newCfg.Storage.S3.Credentials.AccessKeyID {
198+
return true
199+
}
200+
201+
if currentCfg.Storage.S3.Credentials.SecretAccessKey != newCfg.Storage.S3.Credentials.SecretAccessKey {
202+
return true
203+
}
204+
195205
}
196206

197207
if currentCfg.Storage.GCS != nil && newCfg.Storage.GCS != nil {
@@ -202,6 +212,22 @@ func isResyncNeeded(currentCfg *config.Config, newCfg *config.Config) bool {
202212
if currentCfg.Storage.GCS.Prefix != newCfg.Storage.GCS.Prefix {
203213
return true
204214
}
215+
216+
if currentCfg.Storage.GCS.Credentials.ClientEmail != newCfg.Storage.GCS.Credentials.ClientEmail {
217+
return true
218+
}
219+
220+
if currentCfg.Storage.GCS.Credentials.PrivateKey != newCfg.Storage.GCS.Credentials.PrivateKey {
221+
return true
222+
}
223+
224+
if currentCfg.Storage.GCS.Credentials.HMACAccessKey != newCfg.Storage.GCS.Credentials.HMACAccessKey {
225+
return true
226+
}
227+
228+
if currentCfg.Storage.GCS.Credentials.HMACSecret != newCfg.Storage.GCS.Credentials.HMACSecret {
229+
return true
230+
}
205231
}
206232

207233
if currentCfg.Storage.Azure != nil && newCfg.Storage.Azure != nil {
@@ -216,6 +242,10 @@ func isResyncNeeded(currentCfg *config.Config, newCfg *config.Config) bool {
216242
if currentCfg.Storage.Azure.Account != newCfg.Storage.Azure.Account {
217243
return true
218244
}
245+
246+
if currentCfg.Storage.Azure.Credentials.Key != newCfg.Storage.Azure.Credentials.Key {
247+
return true
248+
}
219249
}
220250

221251
if currentCfg.Storage.Filesystem != nil && newCfg.Storage.Filesystem != nil {

0 commit comments

Comments
 (0)