marshal patch when setting status

This commit is contained in:
Felix Kunde 2019-04-16 15:38:22 +02:00
parent 487c16a30e
commit 11f899367c
1 changed files with 2 additions and 7 deletions

View File

@ -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.