using status subresource
This commit is contained in:
parent
7e356a15c7
commit
407a05086e
|
|
@ -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
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue