mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +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>
68 lines
1.6 KiB
Go
68 lines
1.6 KiB
Go
package zitadel
|
|
|
|
import (
|
|
"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/orbos/pkg/tree"
|
|
"github.com/caos/zitadel/operator/api/zitadel"
|
|
"github.com/caos/zitadel/operator/zitadel/kinds/orb"
|
|
)
|
|
|
|
//Take care! to use this function you have to include migration files into the binary
|
|
func CrdMigrations(
|
|
monitor mntr.Monitor,
|
|
k8sClient *kubernetes.Client,
|
|
version *string,
|
|
) error {
|
|
desired, err := zitadel.ReadCrd(k8sClient)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return migrations(monitor, nil, k8sClient, false, version, desired)
|
|
}
|
|
|
|
//Take care! to use this function you have to include migration files into the binary
|
|
func GitOpsMigrations(
|
|
monitor mntr.Monitor,
|
|
orbCfg *orbconfig.Orb,
|
|
gitClient *git.Client,
|
|
k8sClient *kubernetes.Client,
|
|
version *string,
|
|
) error {
|
|
desired, err := gitClient.ReadTree(git.ZitadelFile)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return migrations(monitor, orbCfg, k8sClient, true, version, desired)
|
|
}
|
|
|
|
//Take care! to use this function you have to include migration files into the binary
|
|
func migrations(
|
|
monitor mntr.Monitor,
|
|
orbCfg *orbconfig.Orb,
|
|
k8sClient *kubernetes.Client,
|
|
gitops bool,
|
|
version *string,
|
|
desired *tree.Tree,
|
|
) error {
|
|
current := &tree.Tree{}
|
|
query, _, _, _, _, _, err := orb.AdaptFunc(orbCfg, "migration", version, gitops, []string{"migration"})(monitor, desired, current)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
ensure, err := query(k8sClient, map[string]interface{}{})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := ensure(k8sClient); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|