add storage_resize_mode mixed to opConfig CRD (#1947)
This commit is contained in:
		
							parent
							
								
									5e4badd99c
								
							
						
					
					
						commit
						1c80ac0acd
					
				|  | @ -321,6 +321,7 @@ spec: | ||||||
|                     type: string |                     type: string | ||||||
|                     enum: |                     enum: | ||||||
|                       - "ebs" |                       - "ebs" | ||||||
|  |                       - "mixed" | ||||||
|                       - "pvc" |                       - "pvc" | ||||||
|                       - "off" |                       - "off" | ||||||
|                     default: "pvc" |                     default: "pvc" | ||||||
|  |  | ||||||
|  | @ -196,7 +196,7 @@ configKubernetes: | ||||||
|   # whether the Spilo container should run with additional permissions other than parent. |   # whether the Spilo container should run with additional permissions other than parent. | ||||||
|   # required by cron which needs setuid |   # required by cron which needs setuid | ||||||
|   spilo_allow_privilege_escalation: true |   spilo_allow_privilege_escalation: true | ||||||
|   # storage resize strategy, available options are: ebs, pvc, off |   # storage resize strategy, available options are: ebs, pvc, off or mixed | ||||||
|   storage_resize_mode: pvc |   storage_resize_mode: pvc | ||||||
|   # pod toleration assigned to instances of every Postgres cluster |   # pod toleration assigned to instances of every Postgres cluster | ||||||
|   # toleration: |   # toleration: | ||||||
|  |  | ||||||
|  | @ -486,10 +486,10 @@ configuration they are grouped under the `kubernetes` key. | ||||||
| * **storage_resize_mode** | * **storage_resize_mode** | ||||||
|   defines how operator handles the difference between the requested volume size and |   defines how operator handles the difference between the requested volume size and | ||||||
|     the actual size. Available options are: |     the actual size. Available options are: | ||||||
|     1. `ebs` : operator resizes EBS volumes directly and executes `resizefs` within a pod |     1. `ebs`   : operator resizes EBS volumes directly and executes `resizefs` within a pod | ||||||
|     2. `pvc` : operator only changes PVC definition |     2. `pvc`   : operator only changes PVC definition | ||||||
|     3. `off` : disables resize of the volumes. |     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 |     4. `mixed` : operator uses AWS API to adjust size, throughput, and IOPS, and calls pvc change for file system resize | ||||||
|     Default is "pvc". |     Default is "pvc". | ||||||
| 
 | 
 | ||||||
| ## Kubernetes resource requests | ## Kubernetes resource requests | ||||||
|  |  | ||||||
							
								
								
									
										39
									
								
								docs/user.md
								
								
								
								
							
							
						
						
									
										39
									
								
								docs/user.md
								
								
								
								
							|  | @ -1029,9 +1029,9 @@ specified but globally disabled in the configuration. The | ||||||
| 
 | 
 | ||||||
| ## Increase volume size | ## Increase volume size | ||||||
| 
 | 
 | ||||||
| Postgres operator supports statefulset volume resize if you're using the | Postgres operator supports statefulset volume resize without doing a rolling | ||||||
| operator on top of AWS. For that you need to change the size field of the | update. For that you need to change the size field of the volume description | ||||||
| volume description in the cluster manifest and apply the change: | in the cluster manifest and apply the change: | ||||||
| 
 | 
 | ||||||
| ```yaml | ```yaml | ||||||
| spec: | spec: | ||||||
|  | @ -1040,22 +1040,29 @@ spec: | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| The operator compares the new value of the size field with the previous one and | The operator compares the new value of the size field with the previous one and | ||||||
| acts on differences. | acts on differences. The `storage_resize_mode` can be configured. By default, | ||||||
|  | the operator will adjust the PVCs and leave it to K8s and the infrastructure to | ||||||
|  | apply the change. | ||||||
| 
 | 
 | ||||||
| You can only enlarge the volume with the process described above, shrinking is | When using AWS with gp3 volumes you should set the mode to `mixed` because it | ||||||
| not supported and will emit a warning. After this update all the new volumes in | will also adjust the IOPS and throughput that can be defined in the manifest. | ||||||
| the statefulset are allocated according to the new size. To enlarge persistent | Check the [AWS docs](https://aws.amazon.com/ebs/general-purpose/) to learn | ||||||
| volumes attached to the running pods, the operator performs the following | about default and maximum values. Keep in mind that AWS rate-limits updating | ||||||
| actions: | volume specs to no more than once every 6 hours.  | ||||||
| 
 | 
 | ||||||
| * call AWS API to change the volume size | ```yaml | ||||||
|  | spec: | ||||||
|  |   volume: | ||||||
|  |     size: 5Gi # new volume size | ||||||
|  |     iops: 4000 | ||||||
|  |     throughput: 500 | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| * connect to pod using `kubectl exec` and resize filesystem with `resize2fs`. | The operator can only enlarge volumes. Shrinking is not supported and will emit | ||||||
| 
 | a warning. However, it can be done manually after updating the manifest. You | ||||||
| Fist step has a limitation, AWS rate-limits this operation to no more than once | have to delete the PVC, which will hang until you also delete the corresponding | ||||||
| every 6 hours. Note, that if the statefulset is scaled down before resizing the | pod. Proceed with the next pod when the cluster is healthy again and replicas | ||||||
| new size is only applied to the volumes attached to the running pods. The | are streaming. | ||||||
| size of volumes that correspond to the previously running pods is not changed. |  | ||||||
| 
 | 
 | ||||||
| ## Logical backups | ## Logical backups | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -319,6 +319,7 @@ spec: | ||||||
|                     type: string |                     type: string | ||||||
|                     enum: |                     enum: | ||||||
|                       - "ebs" |                       - "ebs" | ||||||
|  |                       - "mixed" | ||||||
|                       - "pvc" |                       - "pvc" | ||||||
|                       - "off" |                       - "off" | ||||||
|                     default: "pvc" |                     default: "pvc" | ||||||
|  |  | ||||||
|  | @ -1428,6 +1428,9 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{ | ||||||
| 									{ | 									{ | ||||||
| 										Raw: []byte(`"ebs"`), | 										Raw: []byte(`"ebs"`), | ||||||
| 									}, | 									}, | ||||||
|  | 									{ | ||||||
|  | 										Raw: []byte(`"mixed"`), | ||||||
|  | 									}, | ||||||
| 									{ | 									{ | ||||||
| 										Raw: []byte(`"pvc"`), | 										Raw: []byte(`"pvc"`), | ||||||
| 									}, | 									}, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue