Address review input.
This commit is contained in:
parent
cccf36931f
commit
d7f2e588f0
|
|
@ -237,7 +237,7 @@ kubectl logs acid-minimal-cluster-0
|
|||
|
||||
## Unit tests with Mocks and K8s Fake API
|
||||
|
||||
When ever possible you should rely on leveraging proper mocks and K8s fake client that allows full fledged testing of K8s objects in your unit tests.
|
||||
Whenever possible you should rely on leveraging proper mocks and K8s fake client that allows full fledged testing of K8s objects in your unit tests.
|
||||
|
||||
To enable mocks, a code annotation is needed:
|
||||
[Mock code gen annotation](https://github.com/zalando/postgres-operator/blob/master/pkg/util/volumes/volumes.go#L3)
|
||||
|
|
|
|||
|
|
@ -373,12 +373,13 @@ configuration they are grouped under the `kubernetes` key.
|
|||
possible value is `parallel`.
|
||||
|
||||
* **storage_resize_mode**
|
||||
defines how operator handels the difference between requested volume size and
|
||||
actual size. Available options are: ebs - tries to resize EBS volume, pvc -
|
||||
changes PVC definition, off - disables resize of the volumes. And "mixed" mode.
|
||||
Where mixed mode is needed to support AWS EBS gp3 volumes, to adjust IOPS and Throughput.
|
||||
It relies on pvc resize to deal with file system extension. Default is "pvc".
|
||||
When using OpenShift please use one of the other available options.
|
||||
defines how operator handles the difference between the requested volume size and
|
||||
the actual size. Available options are:
|
||||
1. `ebs` : operator resizes EBS volumes directly and executes `resizefs` within a pod
|
||||
2. `pvc` : operator only changes PVC definition
|
||||
3. `off` : disables resize of the volumes.
|
||||
4. `mixed` :operator uses AWS API to adjust size, throughput, and IOPS, and calls pvc change for file system resize
|
||||
Default is "pvc".
|
||||
|
||||
## Kubernetes resource requests
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func (c *Cluster) syncVolumes() error {
|
|||
c.logger.Debugf("syncing volumes using %q storage resize mode", c.OpConfig.StorageResizeMode)
|
||||
var err error
|
||||
|
||||
// check quantity string once, and not bother with it anymore everywhwere
|
||||
// check quantity string once, and do not bother with it anymore anywhere else
|
||||
_, err = resource.ParseQuantity(c.Spec.Volume.Size)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not parse volume size from the manifest: %v", err)
|
||||
|
|
@ -157,18 +157,18 @@ func (c *Cluster) populateVolumeMetaData() error {
|
|||
volumeIds = append(volumeIds, volumeID)
|
||||
}
|
||||
|
||||
awsVolumes, err := c.VolumeResizer.DescribeVolumes(volumeIds)
|
||||
currentVolumes, err := c.VolumeResizer.DescribeVolumes(volumeIds)
|
||||
if nil != err {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(awsVolumes) != len(c.EBSVolumes) {
|
||||
c.logger.Debugf("number of ebs volumes (%d) differs from known volumes (%d)", len(awsVolumes), len(c.EBSVolumes))
|
||||
if len(currentVolumes) != len(c.EBSVolumes) {
|
||||
c.logger.Debugf("number of ebs volumes (%d) discovered differs from already known volumes (%d)", len(currentVolumes), len(c.EBSVolumes))
|
||||
}
|
||||
|
||||
// reset map, operator is not responsible for dangling ebs volumes
|
||||
c.EBSVolumes = make(map[string]volumes.VolumeProperties)
|
||||
for _, volume := range awsVolumes {
|
||||
for _, volume := range currentVolumes {
|
||||
c.EBSVolumes[volume.VolumeID] = volume
|
||||
}
|
||||
|
||||
|
|
@ -179,14 +179,16 @@ func (c *Cluster) populateVolumeMetaData() error {
|
|||
func (c *Cluster) syncVolumeClaims() error {
|
||||
c.setProcessName("syncing volume claims")
|
||||
|
||||
act, err := c.volumeClaimsNeedResizing(c.Spec.Volume)
|
||||
needsResizing, err := c.volumeClaimsNeedResizing(c.Spec.Volume)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not compare size of the volume claims: %v", err)
|
||||
}
|
||||
if !act {
|
||||
|
||||
if !needsResizing {
|
||||
c.logger.Infof("volume claims do not require changes")
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := c.resizeVolumeClaims(c.Spec.Volume); err != nil {
|
||||
return fmt.Errorf("could not sync volume claims: %v", err)
|
||||
}
|
||||
|
|
@ -325,16 +327,15 @@ func (c *Cluster) resizeVolumes() error {
|
|||
|
||||
c.setProcessName("resizing EBS volumes")
|
||||
|
||||
newQuantity, _ := resource.ParseQuantity(c.Spec.Volume.Size)
|
||||
newSize := quantityToGigabyte(newQuantity)
|
||||
resizer := c.VolumeResizer
|
||||
var totalIncompatible int
|
||||
|
||||
newQuantity, err := resource.ParseQuantity(c.Spec.Volume.Size)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not parse volume size: %v", err)
|
||||
}
|
||||
|
||||
newSize := quantityToGigabyte(newQuantity)
|
||||
resizer := c.VolumeResizer
|
||||
var totalIncompatible int
|
||||
|
||||
pvs, err := c.listPersistentVolumes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not list persistent volumes: %v", err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue