mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
25c9d7371d
* 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 <eliobischof@gmail.com> * fix(destroy): needs no self-reconciling Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> * fix(logs): fix double handled error Co-authored-by: Elio Bischof <eliobischof@gmail.com> Co-authored-by: Elio Bischof <eliobischof@gmail.com>
45 lines
1.5 KiB
Go
45 lines
1.5 KiB
Go
package crtlgitops
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/orbos/mntr"
|
|
"github.com/caos/orbos/pkg/git"
|
|
"github.com/caos/orbos/pkg/kubernetes"
|
|
orbconfig "github.com/caos/orbos/pkg/orb"
|
|
"github.com/caos/zitadel/operator/database"
|
|
orbdb "github.com/caos/zitadel/operator/database/kinds/orb"
|
|
"github.com/caos/zitadel/operator/zitadel"
|
|
orbz "github.com/caos/zitadel/operator/zitadel/kinds/orb"
|
|
)
|
|
|
|
func DestroyOperator(monitor mntr.Monitor, orbConfigPath string, k8sClient *kubernetes.Client, version *string, gitops bool) error {
|
|
|
|
orbConfig, err := orbconfig.ParseOrbConfig(orbConfigPath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
gitClient := git.New(context.Background(), monitor, "orbos", "orbos@caos.ch")
|
|
if err := gitClient.Configure(orbConfig.URL, []byte(orbConfig.Repokey)); err != nil {
|
|
return err
|
|
}
|
|
|
|
return zitadel.Destroy(monitor, gitClient, orbz.AdaptFunc(orbConfig, "ensure", version, gitops, []string{"zitadel", "iam"}), k8sClient)
|
|
}
|
|
|
|
func DestroyDatabase(monitor mntr.Monitor, orbConfigPath string, k8sClient *kubernetes.Client, version *string, gitops bool) error {
|
|
|
|
orbConfig, err := orbconfig.ParseOrbConfig(orbConfigPath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
gitClient := git.New(context.Background(), monitor, "orbos", "orbos@caos.ch")
|
|
if err := gitClient.Configure(orbConfig.URL, []byte(orbConfig.Repokey)); err != nil {
|
|
return err
|
|
}
|
|
|
|
return database.Destroy(monitor, gitClient, orbdb.AdaptFunc("", version, gitops, "operator", "database", "backup"), k8sClient)
|
|
}
|