From ed7bcf45755788e82843669bd2d400359cb53086 Mon Sep 17 00:00:00 2001 From: Vilvaramadurai Date: Fri, 14 Nov 2025 16:46:24 +0000 Subject: [PATCH] Allow distruption in single instance postgres - When PodDisruptionBudget is enabled at the controller level, it creates a PDB even for PostgreSQL deployments with numberOfInstances = 1. This prevents node draining and node rotation, since a single pod cannot meet the disruption requirements. In real HA setups, PostgreSQL should have more than one instance. For single-instance deployments, setting the PDB to minAvailable = 0 avoids unnecessary blocking and makes cluster operations easier to manage. --- pkg/cluster/k8sres.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index eb4402f03..be4015a7e 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -2212,8 +2212,8 @@ func (c *Cluster) generatePodDisruptionBudget() *policyv1.PodDisruptionBudget { pdbEnabled := c.OpConfig.EnablePodDisruptionBudget pdbMasterLabelSelector := c.OpConfig.PDBMasterLabelSelector - // if PodDisruptionBudget is disabled or if there are no DB pods, set the budget to 0. - if (pdbEnabled != nil && !(*pdbEnabled)) || c.Spec.NumberOfInstances <= 0 { + // if PodDisruptionBudget is disabled or if there are more than one DB pods, set the budget to 0. + if (pdbEnabled != nil && !(*pdbEnabled)) || c.Spec.NumberOfInstances <= 1 { minAvailable = intstr.FromInt(0) }