mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-23 23:40:44 -04:00
cli: create namespaced folders for upgrade backups (#1702)
Resource names are only unique per kind+ns. Without this patch it might happen that there are two resources with the same name in different namespaces. Upgrade might fail in that case. Co-authored-by: Otto Bittner <cobittner@posteo.net>
This commit is contained in:
parent
3a9291499b
commit
b4a6ee963c
2 changed files with 6 additions and 2 deletions
|
@ -63,7 +63,11 @@ func (c *Client) backupCRs(ctx context.Context, crds []apiextensionsv1.CustomRes
|
|||
}
|
||||
|
||||
for _, cr := range crs {
|
||||
path := filepath.Join(backupFolder, cr.GetName()+".yaml")
|
||||
targetFolder := filepath.Join(backupFolder, cr.GetKind(), cr.GetNamespace())
|
||||
if err := c.fs.MkdirAll(targetFolder); err != nil {
|
||||
return fmt.Errorf("creating resource dir: %w", err)
|
||||
}
|
||||
path := filepath.Join(targetFolder, cr.GetName()+".yaml")
|
||||
yamlBytes, err := yaml.Marshal(cr.Object)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue