mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-21 20:38:47 +00:00
fix(zitadelctl): implementation for commands in crd mode (#1685)
* fix(zitadelctl): implement takedown command * fix(zitadelctl): correct destroy flow * fix(zitadelctl): correct backup commands to read crds beforehand * fix: add of destroyfile * fix: clean for userlist * fix: determine mode by --gitops flag for backups * refactor: return error instead of higher order function * fix(destroy): needs no self-reconciling Co-authored-by: Elio Bischof <[email protected]> * fix(destroy): needs no self-reconciling Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <[email protected]> Co-authored-by: Elio Bischof <[email protected]>
This commit is contained in:
co-authored by
Elio Bischof
parent
413ed80611
commit
25c9d7371d
+23
-24
@@ -5,10 +5,11 @@ import (
|
||||
"github.com/caos/orbos/pkg/git"
|
||||
"github.com/caos/orbos/pkg/kubernetes"
|
||||
"github.com/caos/orbos/pkg/tree"
|
||||
"github.com/caos/zitadel/operator/api/database"
|
||||
orbdb "github.com/caos/zitadel/operator/database/kinds/orb"
|
||||
)
|
||||
|
||||
func InstantBackup(
|
||||
func GitOpsInstantBackup(
|
||||
monitor mntr.Monitor,
|
||||
k8sClient kubernetes.ClientInt,
|
||||
gitClient *git.Client,
|
||||
@@ -16,9 +17,29 @@ func InstantBackup(
|
||||
) error {
|
||||
desired, err := gitClient.ReadTree(git.DatabaseFile)
|
||||
if err != nil {
|
||||
monitor.Error(err)
|
||||
return err
|
||||
}
|
||||
return instantBackup(monitor, k8sClient, desired, name)
|
||||
}
|
||||
|
||||
func CrdInstantBackup(
|
||||
monitor mntr.Monitor,
|
||||
k8sClient kubernetes.ClientInt,
|
||||
name string,
|
||||
) error {
|
||||
desired, err := database.ReadCrd(k8sClient)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return instantBackup(monitor, k8sClient, desired, name)
|
||||
}
|
||||
|
||||
func instantBackup(
|
||||
monitor mntr.Monitor,
|
||||
k8sClient kubernetes.ClientInt,
|
||||
desired *tree.Tree,
|
||||
name string,
|
||||
) error {
|
||||
current := &tree.Tree{}
|
||||
|
||||
query, _, _, _, _, _, err := orbdb.AdaptFunc(name, nil, false, "instantbackup")(monitor, desired, current)
|
||||
@@ -40,25 +61,3 @@ func InstantBackup(
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ListBackups(
|
||||
monitor mntr.Monitor,
|
||||
gitClient *git.Client,
|
||||
) (
|
||||
[]string,
|
||||
error,
|
||||
) {
|
||||
desired, err := gitClient.ReadTree(git.DatabaseFile)
|
||||
if err != nil {
|
||||
monitor.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
backups, err := orbdb.BackupListFunc()(monitor, desired)
|
||||
if err != nil {
|
||||
monitor.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return backups, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user