From 48e184d98e6d99cc561fba9f9f306236b3c59cbb Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Tue, 9 Apr 2019 11:30:12 +0200 Subject: [PATCH] marshal nested status field --- pkg/cluster/cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index a9bb79c7f..8b68eb071 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -159,13 +159,13 @@ func (c *Cluster) setStatus(status acidv1.PostgresClusterStatus) { c.logger.Errorf("could not marshal status: %v", err) } - patch := []byte(fmt.Sprintf(`{"Postgres cluster status": %s}`, string(b))) + patch := []byte(fmt.Sprintf(`{"status":{"PostgresClusterStatus": %s}}`, string(b))) // we cannot do a full scale update here without fetching the previous manifest (as the resourceVersion may differ), // however, we could do patch without it. In the future, once /status subresource is there (starting Kubernets 1.11) // we should take advantage of it. newspec, err := c.KubeClient.AcidV1ClientSet.AcidV1().Postgresqls(c.clusterNamespace()).Patch(c.Name, types.MergePatchType, patch) if err != nil { - c.logger.Errorf("could not update Postgres cluster status: %v", err) + c.logger.Errorf("could not update status: %v", err) } // update the spec, maintaining the new resourceVersion. c.setSpec(newspec)