compare Postgres pod priority on Sync
This commit is contained in:
		
							parent
							
								
									d09e418b56
								
							
						
					
					
						commit
						5d58314a16
					
				| 
						 | 
					@ -85,6 +85,7 @@ data:
 | 
				
			||||||
  pod_service_account_name: "postgres-pod"
 | 
					  pod_service_account_name: "postgres-pod"
 | 
				
			||||||
  # pod_service_account_role_binding_definition: ""
 | 
					  # pod_service_account_role_binding_definition: ""
 | 
				
			||||||
  pod_terminate_grace_period: 5m
 | 
					  pod_terminate_grace_period: 5m
 | 
				
			||||||
 | 
					  # pod_priority_class_name: "postgres-pod-priority"
 | 
				
			||||||
  # postgres_superuser_teams: "postgres_superusers"
 | 
					  # postgres_superuser_teams: "postgres_superusers"
 | 
				
			||||||
  # protected_role_names: "admin"
 | 
					  # protected_role_names: "admin"
 | 
				
			||||||
  ready_wait_interval: 3s
 | 
					  ready_wait_interval: 3s
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					apiVersion: scheduling.k8s.io/v1
 | 
				
			||||||
 | 
					description: 'This priority class must be used only for databases controlled by the
 | 
				
			||||||
 | 
					  Postgres operator'
 | 
				
			||||||
 | 
					kind: PriorityClass
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  labels:
 | 
				
			||||||
 | 
					    application: postgres-operator
 | 
				
			||||||
 | 
					  name: postgres-pod-priority
 | 
				
			||||||
 | 
					preemptionPolicy: PreemptLowerPriority
 | 
				
			||||||
 | 
					globalDefault: false
 | 
				
			||||||
 | 
					value: 1000000
 | 
				
			||||||
| 
						 | 
					@ -459,6 +459,20 @@ func (c *Cluster) compareStatefulSetWith(statefulSet *appsv1.StatefulSet) *compa
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if c.Statefulset.Spec.Template.Spec.PriorityClassName != statefulSet.Spec.Template.Spec.PriorityClassName {
 | 
				
			||||||
 | 
							match = false
 | 
				
			||||||
 | 
							needsReplace = true
 | 
				
			||||||
 | 
							needsRollUpdate = true
 | 
				
			||||||
 | 
							reasons = append(reasons, "new statefulset's pod priority class in spec doesn't match the current one")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if c.Statefulset.Spec.Template.Spec.Priority != statefulSet.Spec.Template.Spec.Priority {
 | 
				
			||||||
 | 
							match = false
 | 
				
			||||||
 | 
							needsReplace = true
 | 
				
			||||||
 | 
							needsRollUpdate = true
 | 
				
			||||||
 | 
							reasons = append(reasons, "new statefulset's pod priority value in spec doesn't match the current one")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// lazy Spilo update: modify the image in the statefulset itself but let its pods run with the old image
 | 
						// lazy Spilo update: modify the image in the statefulset itself but let its pods run with the old image
 | 
				
			||||||
	// until they are re-created for other reasons, for example node rotation
 | 
						// until they are re-created for other reasons, for example node rotation
 | 
				
			||||||
	if c.OpConfig.EnableLazySpiloUpgrade && !reflect.DeepEqual(c.Statefulset.Spec.Template.Spec.Containers[0].Image, statefulSet.Spec.Template.Spec.Containers[0].Image) {
 | 
						if c.OpConfig.EnableLazySpiloUpgrade && !reflect.DeepEqual(c.Statefulset.Spec.Template.Spec.Containers[0].Image, statefulSet.Spec.Template.Spec.Containers[0].Image) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue