diff --git a/manifests/operator-service-account-rbac.yaml b/manifests/operator-service-account-rbac.yaml index 7bd539ac5..4fd4676cc 100644 --- a/manifests/operator-service-account-rbac.yaml +++ b/manifests/operator-service-account-rbac.yaml @@ -14,6 +14,7 @@ rules: - acid.zalan.do resources: - postgresqls + - postgresqls/status - operatorconfigurations verbs: - "*" @@ -137,7 +138,7 @@ rules: - clusterroles verbs: - bind - resourceNames: + resourceNames: - zalando-postgres-operator --- diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 52118b9d0..fad3f0a79 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -159,12 +159,12 @@ func (c *Cluster) setStatus(status acidv1.PostgresClusterStatus) { c.logger.Errorf("could not marshal status: %v", err) } - subresource := fmt.Sprintf(`{"status":{"PostgresClusterStatus": %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, make([]byte, 0), subresource) + newspec, err := c.KubeClient.AcidV1ClientSet.AcidV1().Postgresqls(c.clusterNamespace()).Patch(c.Name, types.MergePatchType, patch, "status") if err != nil { c.logger.Errorf("could not update status: %v", err) }