Skip to content

Commit 7bd062d

Browse files
committed
fixup! fixup! fix: fall back to canonical backup auth secret name on restore
fixup\! fixup\! fix: fall back to canonical backup auth secret name on restore Use canonical name only on restore path, keep configured name on backup path Assisted-by: Claude Opus 4.6 (1M context) Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
1 parent 39879ba commit 7bd062d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pkg/secrets/backup.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,21 @@ func HandleRegistryAuthSecret(ctx context.Context, c client.Client, workspace *d
5454
return nil, nil
5555
}
5656

57-
// First check the workspace namespace for the secret.
58-
// CopySecret always writes the copy under DevWorkspaceBackupAuthSecretName,
59-
// so look it up by that canonical name.
57+
// On the restore path (operatorConfigNamespace == ""), look for the canonical name
58+
// that CopySecret always uses. On the backup path, look for the configured name
59+
// because the secret may exist directly in the workspace namespace under that name.
60+
lookupName := secretName
61+
if operatorConfigNamespace == "" {
62+
lookupName = constants.DevWorkspaceBackupAuthSecretName
63+
}
64+
6065
registryAuthSecret := &corev1.Secret{}
6166
err := c.Get(ctx, client.ObjectKey{
62-
Name: constants.DevWorkspaceBackupAuthSecretName,
67+
Name: lookupName,
6368
Namespace: workspace.Namespace}, registryAuthSecret)
6469
if err == nil {
6570
log.Info("Successfully retrieved registry auth secret for backup from workspace namespace",
66-
"secretName", constants.DevWorkspaceBackupAuthSecretName)
71+
"secretName", lookupName)
6772
return registryAuthSecret, nil
6873
}
6974
if client.IgnoreNotFound(err) != nil {

0 commit comments

Comments
 (0)