File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,8 @@ func (c *Cluster) generateConnectionPoolerPodTemplate(role PostgresRole) (
285285 },
286286 }
287287
288+ tolerationsSpec := tolerations (& spec .Tolerations , c .OpConfig .PodToleration )
289+
288290 podTemplate := & v1.PodTemplateSpec {
289291 ObjectMeta : metav1.ObjectMeta {
290292 Labels : c .connectionPoolerLabels (role , true ).MatchLabels ,
@@ -294,12 +296,18 @@ func (c *Cluster) generateConnectionPoolerPodTemplate(role PostgresRole) (
294296 Spec : v1.PodSpec {
295297 TerminationGracePeriodSeconds : & gracePeriod ,
296298 Containers : []v1.Container {poolerContainer },
297- // TODO: add tolerations to scheduler pooler on the same node
298- // as database
299- //Tolerations: *tolerationsSpec,
299+ Tolerations : tolerationsSpec ,
300300 },
301301 }
302302
303+ nodeAffinity := nodeAffinity (c .OpConfig .NodeReadinessLabel , spec .NodeAffinity )
304+ if c .OpConfig .EnablePodAntiAffinity {
305+ labelsSet := labels .Set (c .connectionPoolerLabels (role , false ).MatchLabels )
306+ podTemplate .Spec .Affinity = generatePodAffinity (labelsSet , c .OpConfig .PodAntiAffinityTopologyKey , nodeAffinity )
307+ } else if nodeAffinity != nil {
308+ podTemplate .Spec .Affinity = nodeAffinity
309+ }
310+
303311 return podTemplate , nil
304312}
305313
You can’t perform that action at this time.
0 commit comments