add podManagementPolicy
This commit is contained in:
parent
14321d599f
commit
29ef52ab74
|
|
@ -226,6 +226,11 @@ configuration they are grouped under the `kubernetes` key.
|
||||||
[topology key](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#interlude-built-in-node-labels)
|
[topology key](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#interlude-built-in-node-labels)
|
||||||
for pod anti affinity. The default is `kubernetes.io/hostname`.
|
for pod anti affinity. The default is `kubernetes.io/hostname`.
|
||||||
|
|
||||||
|
* **pod_management_policy**
|
||||||
|
specify the
|
||||||
|
[pod management policy](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies)
|
||||||
|
of stateful sets of PG clusters. The default is `ordered_ready`, the second possible value is `parallel`.
|
||||||
|
|
||||||
## Kubernetes resource requests
|
## Kubernetes resource requests
|
||||||
|
|
||||||
This group allows you to configure resource requests for the Postgres pods.
|
This group allows you to configure resource requests for the Postgres pods.
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ data:
|
||||||
pod_terminate_grace_period: 5m
|
pod_terminate_grace_period: 5m
|
||||||
pod_deletion_wait_timeout: 10m
|
pod_deletion_wait_timeout: 10m
|
||||||
pod_label_wait_timeout: 10m
|
pod_label_wait_timeout: 10m
|
||||||
|
pod_management_policy: "ordered_ready"
|
||||||
ready_wait_interval: 3s
|
ready_wait_interval: 3s
|
||||||
ready_wait_timeout: 30s
|
ready_wait_timeout: 30s
|
||||||
# master_pod_move_timeout: 10m
|
# master_pod_move_timeout: 10m
|
||||||
|
|
|
||||||
|
|
@ -860,9 +860,18 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*v1beta1.State
|
||||||
|
|
||||||
// the operator has domain-specific logic on how to do rolling updates of PG clusters
|
// 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
|
// so we do not use default rolling updates implemented by stateful sets
|
||||||
// that leaves "OnDelete" update strategy as the only option
|
// that leaves the legacy "OnDelete" update strategy as the only option
|
||||||
updateStrategy := v1beta1.StatefulSetUpdateStrategy{Type: v1beta1.OnDeleteStatefulSetStrategyType}
|
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{
|
statefulSet := &v1beta1.StatefulSet{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: c.statefulSetName(),
|
Name: c.statefulSetName(),
|
||||||
|
|
@ -877,6 +886,7 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*v1beta1.State
|
||||||
Template: *podTemplate,
|
Template: *podTemplate,
|
||||||
VolumeClaimTemplates: []v1.PersistentVolumeClaim{*volumeClaimTemplate},
|
VolumeClaimTemplates: []v1.PersistentVolumeClaim{*volumeClaimTemplate},
|
||||||
UpdateStrategy: updateStrategy,
|
UpdateStrategy: updateStrategy,
|
||||||
|
PodManagementPolicy: podManagementPolicy,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ type Config struct {
|
||||||
ClusterHistoryEntries int `name:"cluster_history_entries" default:"1000"`
|
ClusterHistoryEntries int `name:"cluster_history_entries" default:"1000"`
|
||||||
TeamAPIRoleConfiguration map[string]string `name:"team_api_role_configuration" default:"log_statement:all"`
|
TeamAPIRoleConfiguration map[string]string `name:"team_api_role_configuration" default:"log_statement:all"`
|
||||||
PodTerminateGracePeriod time.Duration `name:"pod_terminate_grace_period" default:"5m"`
|
PodTerminateGracePeriod time.Duration `name:"pod_terminate_grace_period" default:"5m"`
|
||||||
|
PodManagementPolicy string `name:"pod_management_policy" default:"ordered_ready"`
|
||||||
ProtectedRoles []string `name:"protected_role_names" default:"admin"`
|
ProtectedRoles []string `name:"protected_role_names" default:"admin"`
|
||||||
PostgresSuperuserTeams []string `name:"postgres_superuser_teams" default:""`
|
PostgresSuperuserTeams []string `name:"postgres_superuser_teams" default:""`
|
||||||
SetMemoryRequestToLimit bool `name:"set_memory_request_to_limit" defaults:"false"`
|
SetMemoryRequestToLimit bool `name:"set_memory_request_to_limit" defaults:"false"`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue