mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-18 03:07:33 +02:00
check resize mode on update events (#1194)
* check resize mode on update events * add unit test for PVC resizing * set resize mode to pvc in charts and manifests * add test for quantityToGigabyte * just one debug line for syncing volumes * extend test and update log msg
This commit is contained in:
+14
-6
@@ -140,7 +140,7 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec acidv1.Postgres
|
||||
Secrets: make(map[types.UID]*v1.Secret),
|
||||
Services: make(map[PostgresRole]*v1.Service),
|
||||
Endpoints: make(map[PostgresRole]*v1.Endpoints)},
|
||||
userSyncStrategy: users.DefaultUserSyncStrategy{password_encryption},
|
||||
userSyncStrategy: users.DefaultUserSyncStrategy{PasswordEncryption: password_encryption},
|
||||
deleteOptions: metav1.DeleteOptions{PropagationPolicy: &deletePropagationPolicy},
|
||||
podEventsQueue: podEventsQueue,
|
||||
KubeClient: kubeClient,
|
||||
@@ -671,13 +671,21 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
|
||||
|
||||
// Volume
|
||||
if oldSpec.Spec.Size != newSpec.Spec.Size {
|
||||
c.logger.Debugf("syncing persistent volumes")
|
||||
c.logVolumeChanges(oldSpec.Spec.Volume, newSpec.Spec.Volume)
|
||||
|
||||
if err := c.syncVolumes(); err != nil {
|
||||
c.logger.Errorf("could not sync persistent volumes: %v", err)
|
||||
updateFailed = true
|
||||
c.logger.Debugf("syncing volumes using %q storage resize mode", c.OpConfig.StorageResizeMode)
|
||||
if c.OpConfig.StorageResizeMode == "pvc" {
|
||||
if err := c.syncVolumeClaims(); err != nil {
|
||||
c.logger.Errorf("could not sync persistent volume claims: %v", err)
|
||||
updateFailed = true
|
||||
}
|
||||
} else if c.OpConfig.StorageResizeMode == "ebs" {
|
||||
if err := c.syncVolumes(); err != nil {
|
||||
c.logger.Errorf("could not sync persistent volumes: %v", err)
|
||||
updateFailed = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
c.logger.Infof("Storage resize is disabled (storage_resize_mode is off). Skipping volume sync.")
|
||||
}
|
||||
|
||||
// Statefulset
|
||||
|
||||
Reference in New Issue
Block a user