zitadel/operator/database/kinds/orb/desired.go
Livio Amstutz c9b3839f3d
fix: operator reconciling (#1478)
* fix(operator): align backup and restore commands (#1465)

* fix: crd mode broke backup and restore commands

* fix: remove obscure gitops-per-operator flags

(cherry picked from commit 041cacc4af)

* fix: gitops backup and restore need a kubernetes client too (#1475)

(cherry picked from commit 50bc317d27)

Co-authored-by: Elio Bischof <eliobischof@gmail.com>
2021-03-25 16:39:19 +01:00

37 lines
1.2 KiB
Go

package orb
import (
"github.com/caos/orbos/pkg/tree"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
)
type DesiredV0 struct {
Common *tree.Common `json:",inline" yaml:",inline"`
Spec *Spec `json:"spec" yaml:"spec"`
Database *tree.Tree
}
// +kubebuilder:object:generate=true
type Spec struct {
Verbose bool `json:"verbose" json:"verbose"`
NodeSelector map[string]string `json:"nodeSelector,omitempty" yaml:"nodeSelector,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty" yaml:"tolerations,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
SelfReconciling bool `json:"selfReconciling" yaml:"selfReconciling"`
//Use this registry to pull the Database operator image from
//@default: ghcr.io
CustomImageRegistry string `json:"customImageRegistry,omitempty" yaml:"customImageRegistry,omitempty"`
}
func ParseDesiredV0(desiredTree *tree.Tree) (*DesiredV0, error) {
desiredKind := &DesiredV0{Common: desiredTree.Common}
if err := desiredTree.Original.Decode(desiredKind); err != nil {
return nil, errors.Wrap(err, "parsing desired state failed")
}
desiredKind.Common.Version = "v0"
return desiredKind, nil
}