mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
b2b53ae9e1
* feat: enable running ZITADEL offline * refactor: move operator image to common images * test: remove empty test
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package orb
|
|
|
|
import (
|
|
"github.com/caos/orbos/mntr"
|
|
"github.com/caos/orbos/pkg/kubernetes"
|
|
"github.com/caos/orbos/pkg/tree"
|
|
"github.com/caos/orbos/pkg/treelabels"
|
|
"github.com/caos/zitadel/operator"
|
|
zitadelKubernetes "github.com/caos/zitadel/pkg/kubernetes"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func Reconcile(
|
|
monitor mntr.Monitor,
|
|
spec *Spec,
|
|
gitops bool,
|
|
) operator.EnsureFunc {
|
|
return func(k8sClient kubernetes.ClientInt) (err error) {
|
|
recMonitor := monitor.WithField("version", spec.Version)
|
|
|
|
if spec.Version == "" {
|
|
err := errors.New("No version provided for self-reconciling")
|
|
recMonitor.Error(err)
|
|
return err
|
|
}
|
|
|
|
if spec.SelfReconciling {
|
|
desiredTree := &tree.Tree{
|
|
Common: &tree.Common{
|
|
Kind: "databases.caos.ch/Orb",
|
|
Version: "v0",
|
|
},
|
|
}
|
|
|
|
if err := zitadelKubernetes.EnsureDatabaseArtifacts(monitor, treelabels.MustForAPI(desiredTree, mustDatabaseOperator(&spec.Version)), k8sClient, spec.Version, spec.NodeSelector, spec.Tolerations, spec.CustomImageRegistry, gitops); err != nil {
|
|
recMonitor.Error(errors.Wrap(err, "Failed to deploy database-operator into k8s-cluster"))
|
|
return err
|
|
}
|
|
recMonitor.Info("Applied database-operator")
|
|
}
|
|
return nil
|
|
|
|
}
|
|
}
|