Corrections
- set the type of the new configuration parameter to be array of strings - propagate the annotations to statefulset at sync
This commit is contained in:
		
							parent
							
								
									5373b085d8
								
							
						
					
					
						commit
						dd2381174c
					
				|  | @ -838,8 +838,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation | |||
| 								}, | ||||
| 							}, | ||||
| 							"statefulset_propagate_annotations": { | ||||
| 								Type: "object", | ||||
| 								AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ | ||||
| 								Type: "array", | ||||
| 								Items: &apiextv1beta1.JSONSchemaPropsOrArray{ | ||||
| 									Schema: &apiextv1beta1.JSONSchemaProps{ | ||||
| 										Type: "string", | ||||
| 									}, | ||||
|  |  | |||
|  | @ -1150,18 +1150,6 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef | |||
| 
 | ||||
| 	annotations = make(map[string]string) | ||||
| 
 | ||||
| 	ToPropagateAnnotations := c.OpConfig.StatefulsetPropAnnotations | ||||
| 	if ToPropagateAnnotations != nil { | ||||
| 		PgCRDAnnotations := c.Postgresql.ObjectMeta.GetAnnotations() | ||||
| 		for _, anno := range ToPropagateAnnotations { | ||||
| 			for k, v := range PgCRDAnnotations { | ||||
| 				if k == anno { | ||||
| 					annotations[k] = v | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	statefulSet := &appsv1.StatefulSet{ | ||||
| 		ObjectMeta: metav1.ObjectMeta{ | ||||
| 			Name:        c.statefulSetName(), | ||||
|  | @ -1545,7 +1533,6 @@ func (c *Cluster) generateService(role PostgresRole, spec *acidv1.PostgresSpec) | |||
| 		}, | ||||
| 		Spec: serviceSpec, | ||||
| 	} | ||||
| 	c.logger.Warningln("Rafia get service annotations", service.GetObjectMeta) | ||||
| 
 | ||||
| 	return service | ||||
| } | ||||
|  |  | |||
|  | @ -330,6 +330,20 @@ func (c *Cluster) syncStatefulSet() error { | |||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		ToPropagateAnnotations := c.OpConfig.StatefulsetPropAnnotations | ||||
| 		PgCRDAnnotations := c.Postgresql.ObjectMeta.GetAnnotations() | ||||
| 		annotations := make(map[string]string) | ||||
| 
 | ||||
| 		if ToPropagateAnnotations != nil && PgCRDAnnotations != nil { | ||||
| 			for _, anno := range ToPropagateAnnotations { | ||||
| 				for k, v := range PgCRDAnnotations { | ||||
| 					if k == anno { | ||||
| 						annotations[k] = v | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			c.updateStatefulSetAnnotations(annotations) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// Apply special PostgreSQL parameters that can only be set via the Patroni API.
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue