using status subresource
This commit is contained in:
		
							parent
							
								
									7e356a15c7
								
							
						
					
					
						commit
						407a05086e
					
				|  | @ -14,6 +14,7 @@ rules: | ||||||
|   - acid.zalan.do |   - acid.zalan.do | ||||||
|   resources: |   resources: | ||||||
|   - postgresqls |   - postgresqls | ||||||
|  |   - postgresqls/status | ||||||
|   - operatorconfigurations |   - operatorconfigurations | ||||||
|   verbs: |   verbs: | ||||||
|   - "*" |   - "*" | ||||||
|  | @ -137,7 +138,7 @@ rules: | ||||||
|   - clusterroles |   - clusterroles | ||||||
|   verbs: |   verbs: | ||||||
|   - bind |   - bind | ||||||
|   resourceNames:  |   resourceNames: | ||||||
|   - zalando-postgres-operator |   - zalando-postgres-operator | ||||||
| 
 | 
 | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -159,12 +159,12 @@ func (c *Cluster) setStatus(status acidv1.PostgresClusterStatus) { | ||||||
| 		c.logger.Errorf("could not marshal status: %v", err) | 		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),
 | 	// 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.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 { | 	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