From 11f899367c3b4b80143587282208ea77a1457a7a Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Tue, 16 Apr 2019 15:38:22 +0200 Subject: [PATCH] marshal patch when setting status --- pkg/cluster/cluster.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index d7a2b2897..cd0a184aa 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -151,16 +151,11 @@ func (c *Cluster) setProcessName(procName string, args ...interface{}) { func (c *Cluster) setStatus(status string) { // TODO: eventually switch to updateStatus() for kubernetes 1.11 and above - var ( - err error - b []byte - ) - if b, err = json.Marshal(status); err != nil { + patch, err := json.Marshal(acidv1.PostgresStatus{PostgresClusterStatus: status}) + if err != nil { c.logger.Errorf("could not marshal status: %v", err) } - 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.