respond to review
This commit is contained in:
parent
efbfb2ef7c
commit
63fbab20af
|
|
@ -64,7 +64,7 @@ spec:
|
||||||
type: boolean
|
type: boolean
|
||||||
enable_shm_volume:
|
enable_shm_volume:
|
||||||
type: boolean
|
type: boolean
|
||||||
should_delete_unused_pvc:
|
enable_unused_pvc_deletion:
|
||||||
type: boolean
|
type: boolean
|
||||||
etcd_host:
|
etcd_host:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ configGeneral:
|
||||||
# start any new database pod without limitations on shm memory
|
# start any new database pod without limitations on shm memory
|
||||||
enable_shm_volume: true
|
enable_shm_volume: true
|
||||||
# delete PVCs of shutdown pods
|
# delete PVCs of shutdown pods
|
||||||
should_delete_unused_pvc: false
|
enable_unused_pvc_deletion: false
|
||||||
# etcd connection string for Patroni. Empty uses K8s-native DCS.
|
# etcd connection string for Patroni. Empty uses K8s-native DCS.
|
||||||
etcd_host: ""
|
etcd_host: ""
|
||||||
# Spilo docker image
|
# Spilo docker image
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ configGeneral:
|
||||||
# start any new database pod without limitations on shm memory
|
# start any new database pod without limitations on shm memory
|
||||||
enable_shm_volume: "true"
|
enable_shm_volume: "true"
|
||||||
# delete PVCs of shutdown pods
|
# delete PVCs of shutdown pods
|
||||||
should_delete_unused_pvc: "false"
|
enable_unused_pvc_deletion: "false"
|
||||||
# etcd connection string for Patroni. Empty uses K8s-native DCS.
|
# etcd connection string for Patroni. Empty uses K8s-native DCS.
|
||||||
etcd_host: ""
|
etcd_host: ""
|
||||||
# Spilo docker image
|
# Spilo docker image
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ Those are top-level keys, containing both leaf keys and groups.
|
||||||
container, change the [operator deployment manually](../../manifests/postgres-operator.yaml#L20).
|
container, change the [operator deployment manually](../../manifests/postgres-operator.yaml#L20).
|
||||||
The default is `false`.
|
The default is `false`.
|
||||||
|
|
||||||
* **should_delete_unused_pvc**
|
* **enable_unused_pvc_deletion**
|
||||||
Tells the operator to delete persistent volume claims of no longer running pods. That removes respective persistent volumes because operator configures them with the 'Delete' reclaim policy. Note operator deletes unused PVCs for clusters created both before and after this option is turned on. Deletion is not guaranteed: When it fails, operator retries at next Sync() event.
|
Tells the operator to delete persistent volume claims of no longer running pods. That removes respective persistent volumes because operator configures them with the 'Delete' reclaim policy. Note operator deletes unused PVCs for clusters created both before and after this option is turned on. Deletion is not guaranteed: When it fails, operator retries at next Sync() event.
|
||||||
The default is `false`.
|
The default is `false`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -504,7 +504,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
# enable pvc deletion
|
# enable pvc deletion
|
||||||
patch = {
|
patch = {
|
||||||
"data": {
|
"data": {
|
||||||
"should_delete_unused_pvc": "true"
|
"enable_unused_pvc_deletion": "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
k8s.update_config(patch)
|
k8s.update_config(patch)
|
||||||
|
|
@ -542,7 +542,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
# clean up
|
# clean up
|
||||||
patch = {
|
patch = {
|
||||||
"data": {
|
"data": {
|
||||||
"should_delete_unused_pvc": "false"
|
"enable_unused_pvc_deletion": "false"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
k8s.update_config(patch)
|
k8s.update_config(patch)
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,6 @@ data:
|
||||||
# teams_api_url: http://fake-teams-api.default.svc.cluster.local
|
# teams_api_url: http://fake-teams-api.default.svc.cluster.local
|
||||||
# toleration: ""
|
# toleration: ""
|
||||||
# wal_s3_bucket: ""
|
# wal_s3_bucket: ""
|
||||||
# should_delete_unused_pvc: "false"
|
# enable_unused_pvc_deletion: "false"
|
||||||
watched_namespace: "*" # listen to all namespaces
|
watched_namespace: "*" # listen to all namespaces
|
||||||
workers: "4"
|
workers: "4"
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ spec:
|
||||||
type: boolean
|
type: boolean
|
||||||
enable_shm_volume:
|
enable_shm_volume:
|
||||||
type: boolean
|
type: boolean
|
||||||
should_delete_unused_pvc:
|
enable_unused_pvc_deletion:
|
||||||
type: boolean
|
type: boolean
|
||||||
etcd_host:
|
etcd_host:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ configuration:
|
||||||
etcd_host: ""
|
etcd_host: ""
|
||||||
docker_image: registry.opensource.zalan.do/acid/spilo-12:1.6-p2
|
docker_image: registry.opensource.zalan.do/acid/spilo-12:1.6-p2
|
||||||
# enable_shm_volume: true
|
# enable_shm_volume: true
|
||||||
# should_delete_unused_pvc: false
|
# enable_unused_pvc_deletion: false
|
||||||
max_instances: -1
|
max_instances: -1
|
||||||
min_instances: -1
|
min_instances: -1
|
||||||
resync_period: 30m
|
resync_period: 30m
|
||||||
|
|
|
||||||
|
|
@ -679,7 +679,7 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if c.OpConfig.ShouldDeleteUnusedPVC && oldSpec.Spec.NumberOfInstances > newSpec.Spec.NumberOfInstances {
|
if c.OpConfig.EnableUnusedPVCDeletion && oldSpec.Spec.NumberOfInstances > newSpec.Spec.NumberOfInstances {
|
||||||
c.logger.Debug("deleting pvc of shut down pods")
|
c.logger.Debug("deleting pvc of shut down pods")
|
||||||
|
|
||||||
for i := oldSpec.Spec.NumberOfInstances - 1; i >= newSpec.Spec.NumberOfInstances; i-- {
|
for i := oldSpec.Spec.NumberOfInstances - 1; i >= newSpec.Spec.NumberOfInstances; i-- {
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
|
||||||
|
|
||||||
// remove unused PVCs in case deleting them during scale down failed; see Update()
|
// remove unused PVCs in case deleting them during scale down failed; see Update()
|
||||||
// the last pvc stays until the cluster is explicitly deleted as opposed to being scaled down to 0 pods
|
// the last pvc stays until the cluster is explicitly deleted as opposed to being scaled down to 0 pods
|
||||||
if c.OpConfig.ShouldDeleteUnusedPVC && c.getNumberOfInstances(&c.Spec) > 0 {
|
if c.OpConfig.EnableUnusedPVCDeletion && c.getNumberOfInstances(&c.Spec) > 0 {
|
||||||
|
|
||||||
// XXX that also deletes PVC of pods shut down before this change is deployed
|
// XXX that also deletes PVC of pods shut down before this change is deployed
|
||||||
for i := c.getNumberOfInstances(&c.Spec); ; i++ {
|
for i := c.getNumberOfInstances(&c.Spec); ; i++ {
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ type Config struct {
|
||||||
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" default:"false"`
|
SetMemoryRequestToLimit bool `name:"set_memory_request_to_limit" default:"false"`
|
||||||
ShouldDeleteUnusedPVC bool `name:"should_delete_unused_pvc" default:"false"`
|
EnableUnusedPVCDeletion bool `name:"enable_unused_pvc_deletion" default:"false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MustMarshal marshals the config or panics
|
// MustMarshal marshals the config or panics
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue