skip creation later to improve visibility of errors (#1013)

* try to emit error for missing team name in cluster name

* skip creation after new cluster object

* move SetStatus to k8sclient and emit event when skipping creation and rename to SetPostgresCRDStatus

Co-authored-by: Felix Kunde <felix.kunde@zalando.de>
This commit is contained in:
Felix Kunde
2020-06-17 13:32:16 +02:00
committed by GitHub
co-authored by Felix Kunde
parent 0e3fb9ec43
commit 0c6655a22d
6 changed files with 67 additions and 44 deletions
+3 -3
View File
@@ -102,7 +102,7 @@ func (p *Postgresql) UnmarshalJSON(data []byte) error {
}
tmp.Error = err.Error()
tmp.Status = PostgresStatus{PostgresClusterStatus: ClusterStatusInvalid}
tmp.Status.PostgresClusterStatus = ClusterStatusInvalid
*p = Postgresql(tmp)
@@ -112,10 +112,10 @@ func (p *Postgresql) UnmarshalJSON(data []byte) error {
if clusterName, err := extractClusterName(tmp2.ObjectMeta.Name, tmp2.Spec.TeamID); err != nil {
tmp2.Error = err.Error()
tmp2.Status = PostgresStatus{PostgresClusterStatus: ClusterStatusInvalid}
tmp2.Status.PostgresClusterStatus = ClusterStatusInvalid
} else if err := validateCloneClusterDescription(&tmp2.Spec.Clone); err != nil {
tmp2.Error = err.Error()
tmp2.Status = PostgresStatus{PostgresClusterStatus: ClusterStatusInvalid}
tmp2.Status.PostgresClusterStatus = ClusterStatusInvalid
} else {
tmp2.Spec.ClusterName = clusterName
}