marshal patch when setting status
This commit is contained in:
parent
487c16a30e
commit
11f899367c
|
|
@ -151,16 +151,11 @@ func (c *Cluster) setProcessName(procName string, args ...interface{}) {
|
||||||
|
|
||||||
func (c *Cluster) setStatus(status string) {
|
func (c *Cluster) setStatus(status string) {
|
||||||
// TODO: eventually switch to updateStatus() for kubernetes 1.11 and above
|
// TODO: eventually switch to updateStatus() for kubernetes 1.11 and above
|
||||||
var (
|
patch, err := json.Marshal(acidv1.PostgresStatus{PostgresClusterStatus: status})
|
||||||
err error
|
if err != nil {
|
||||||
b []byte
|
|
||||||
)
|
|
||||||
if b, err = json.Marshal(status); err != nil {
|
|
||||||
c.logger.Errorf("could not marshal status: %v", err)
|
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),
|
// 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)
|
// 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.
|
// we should take advantage of it.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue