mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-06 14:51:49 +02:00
Set statefulset update and management policy explicitly (#515)
* fix logging in retry * explicitly set the stateful set update strategy to onDelete * add podManagementPolicy
This commit is contained in:
@@ -858,6 +858,20 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*v1beta1.State
|
||||
|
||||
numberOfInstances := c.getNumberOfInstances(spec)
|
||||
|
||||
// the operator has domain-specific logic on how to do rolling updates of PG clusters
|
||||
// so we do not use default rolling updates implemented by stateful sets
|
||||
// that leaves the legacy "OnDelete" update strategy as the only option
|
||||
updateStrategy := v1beta1.StatefulSetUpdateStrategy{Type: v1beta1.OnDeleteStatefulSetStrategyType}
|
||||
|
||||
var podManagementPolicy v1beta1.PodManagementPolicyType
|
||||
if c.OpConfig.PodManagementPolicy == "ordered_ready" {
|
||||
podManagementPolicy = v1beta1.OrderedReadyPodManagement
|
||||
} else if c.OpConfig.PodManagementPolicy == "parallel" {
|
||||
podManagementPolicy = v1beta1.ParallelPodManagement
|
||||
} else {
|
||||
return nil, fmt.Errorf("could not set the pod management policy to the unknown value: %v", c.OpConfig.PodManagementPolicy)
|
||||
}
|
||||
|
||||
statefulSet := &v1beta1.StatefulSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: c.statefulSetName(),
|
||||
@@ -871,6 +885,8 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*v1beta1.State
|
||||
ServiceName: c.serviceName(Master),
|
||||
Template: *podTemplate,
|
||||
VolumeClaimTemplates: []v1.PersistentVolumeClaim{*volumeClaimTemplate},
|
||||
UpdateStrategy: updateStrategy,
|
||||
PodManagementPolicy: podManagementPolicy,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user