Skip to content

Commit

Permalink
fix: ensure rollout is triggered only when needed
Browse files Browse the repository at this point in the history
This patch ensures that we trigger the rollout only needed, the only drawback is that we cannot evaluate the empty string

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
  • Loading branch information
armru committed May 18, 2023
1 parent b84527d commit 3f47517
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions api/v1/cluster_types.go
Expand Up @@ -550,6 +550,9 @@ type ClusterStatus struct {

// List of instance names in the cluster
InstanceNames []string `json:"instanceNames,omitempty"`

// LastObservedSchedulerName the last schedulerName reconciled from the spec
LastObservedSchedulerName string `json:"lastObservedSchedulerName,omitempty"`
}

// InstanceReportedState describes the last reported state of an instance during a reconciliation loop
Expand Down
2 changes: 1 addition & 1 deletion controllers/cluster_upgrade.go
Expand Up @@ -312,7 +312,7 @@ func IsPodNeedingRollout(status postgres.PostgresqlStatus, cluster *apiv1.Cluste

// isPodNeedingUpdatedScheduler returns a boolean indicating if a restart is required and the relative message
func isPodNeedingUpdatedScheduler(cluster *apiv1.Cluster, pod corev1.Pod) (bool, string) {
if pod.Spec.SchedulerName == cluster.Spec.SchedulerName {
if cluster.Spec.SchedulerName == "" || cluster.Spec.SchedulerName == pod.Spec.SchedulerName {
return false, ""
}

Expand Down

0 comments on commit 3f47517

Please sign in to comment.