Use cluster's own namespace to patch the cluster manifest (#373)
This commit is contained in:
		
							parent
							
								
									e1ed4b847d
								
							
						
					
					
						commit
						aeae0a6ef2
					
				|  | @ -20,6 +20,7 @@ import ( | ||||||
| 	"k8s.io/client-go/tools/cache" | 	"k8s.io/client-go/tools/cache" | ||||||
| 
 | 
 | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
|  | 
 | ||||||
| 	acidv1 "github.com/zalando-incubator/postgres-operator/pkg/apis/acid.zalan.do/v1" | 	acidv1 "github.com/zalando-incubator/postgres-operator/pkg/apis/acid.zalan.do/v1" | ||||||
| 	"github.com/zalando-incubator/postgres-operator/pkg/spec" | 	"github.com/zalando-incubator/postgres-operator/pkg/spec" | ||||||
| 	"github.com/zalando-incubator/postgres-operator/pkg/util" | 	"github.com/zalando-incubator/postgres-operator/pkg/util" | ||||||
|  | @ -162,7 +163,7 @@ func (c *Cluster) setStatus(status acidv1.PostgresStatus) { | ||||||
| 	// 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.
 | ||||||
| 	newspec, err := c.KubeClient.AcidV1ClientSet.AcidV1().Postgresqls(c.OpConfig.WatchedNamespace).Patch(c.Name, types.MergePatchType, patch) | 	newspec, err := c.KubeClient.AcidV1ClientSet.AcidV1().Postgresqls(c.clusterNamespace()).Patch(c.Name, types.MergePatchType, patch) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		c.logger.Errorf("could not update status: %v", err) | 		c.logger.Errorf("could not update status: %v", err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue