Skip to content

Commit 7503f29

Browse files
authored
feat: Use block storage for Crunchy Postgres and RabbitMQ for AWS (PSKD-1282) (#594)
Signed-off-by: David.Houck <[email protected]>
1 parent 4a59ffb commit 7503f29

File tree

6 files changed

+134
-7
lines changed

6 files changed

+134
-7
lines changed

docs/CONFIG-VARS.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Supported configuration variables are listed in the table below. All variables
77
- [Cloud](#cloud)
88
- [Authentication](#authentication)
99
- [Jump Server](#jump-server)
10-
- [Storage](#storage)
10+
- [Storage for AWS](#storage-for-aws)
11+
- [Storage for Azure and Google Cloud](#storage-for-azure-and-google-cloud)
1112
- [RWX Filestore](#rwx-filestore)
1213
- [Azure](#azure)
1314
- [AWS](#aws)
@@ -85,7 +86,11 @@ Viya4-deployment uses the jump server to interact with the RWX filestore, which
8586
| JUMP_SVR_PRIVATE_KEY | Path to the SSH user's private key to access the jump server host | string | | true | | baseline, viya |
8687
| JUMP_SVR_RWX_FILESTORE_PATH | Path on the jump server to the NFS mount | string | /viya-share | false | | viya |
8788

88-
## Storage
89+
## Storage for AWS
90+
When `V4_CFG_MANAGE_STORAGE` is set to `true`, viya4-deployment uses the [EBS CSI driver](#ebs-csi-driver) to create two elastic block storage based storage classes with the default names of `io2-vol-mq` and `io2-vol-pg`. The volume type for both storage classes defaults to `io2`. For EKS clusters, RabbitMQ makes PVC requests to create block storage persistent volumes using the `io2-vol-mq` storage class while Crunchy Postgres makes PVC requests to create block storage persistent volumes using the `io2-vol-pg` storage class. Viya4-deployment also creates the `sas` storage class using the nfs-subdir-external-provisioner Helm chart. If a jump server is used, viya4-deployment uses that server to create the folders for the `astores`, `bin`, `data` and `homes` RWX Filestore NFS paths that are outlined below in the [RWX Filestore](#rwx-filestore) section.
91+
92+
93+
## Storage for Azure and Google Cloud
8994
When `V4_CFG_MANAGE_STORAGE` is set to `true`, viya4-deployment creates the `sas` and `pg-storage` storage classes using the nfs-subdir-external-provisioner Helm chart. If a jump server is used, viya4-deployment uses that server to create the folders for the `astores`, `bin`, `data` and `homes` RWX Filestore NFS paths that are outlined below in the [RWX Filestore](#rwx-filestore) section.
9095

9196
When `V4_CFG_MANAGE_STORAGE` is set to `false`, viya4-deployment does not create the `sas` or `pg-storage` storage classes for you. In addition, viya4-deployment does not create or manage the RWX Filestore NFS paths. Before you run the SAS Viya deployment, you must set the values for `V4_CFG_RWX_FILESTORE_DATA_PATH` and `V4_CFG_RWX_FILESTORE_HOMES_PATH` to specify existing NFS folder locations. The viya4-deployment user can create the required NFS folders from the jump server before starting the deployment. Recommended attribute settings for each folder are as follows:
@@ -401,7 +406,7 @@ If you used [viya4-iac-aws:5.6.0](https://github.com/sassoftware/viya4-iac-aws/r
401406

402407
### EBS CSI Driver
403408

404-
The EBS CSI driver is currently only used for kubernetes v1.23 or later AWS EKS clusters.
409+
The EBS CSI driver is only used for kubernetes v1.23 or later AWS EKS clusters.
405410

406411
| Name | Description | Type | Default | Required | Notes | Tasks |
407412
| :--- | ---: | ---: | ---: | ---: | ---: | ---: |
@@ -411,6 +416,16 @@ The EBS CSI driver is currently only used for kubernetes v1.23 or later AWS EKS
411416
| EBS_CSI_DRIVER_CONFIG | aws ebs csi driver helm values | string | see [here](../roles/baseline/defaults/main.yml) | false | | baseline |
412417
| EBS_CSI_DRIVER_ACCOUNT | cluster autoscaler aws role arn | string | | false | Required to enable the aws ebs csi driver on AWS | baseline |
413418
| EBS_CSI_DRIVER_LOCATION | aws region where kubernetes cluster resides | string | us-east-1 | false | | baseline |
419+
|EBS_CSI_RABBITMQ_STORAGE_CLASS_NAME| The EBS CSI storage class name for RabbitMQ | string | io2-vol-mq | false | | baseline |
420+
|EBS_CSI_RABBITMQ_STORAGE_CLASS_VOLUME_TYPE| The EBS CSI volume type to use for RabbitMQ persistent volumes| string | io2 | false | Supported values: [`io2`, `io1`, `gp3`] | baseline |
421+
|EBS_CSI_RABBITMQ_STORAGE_CLASS_IOPSPERGB | IOPs per GB parameter for the `EBS_CSI_RABBITMQ_STORAGE_CLASS_NAME` storage class|string|1250|false |Multiply this value by the volume size in GiB to obtain total IOPS per volume | baseline |
422+
|EBS_CSI_RABBITMQ_STORAGE_CLASS_THROUGHPUT| Maximum volume throughput in MiB/s for the `EBS_CSI_RABBITMQ_STORAGE_CLASS_NAME` storage class| string| 400 | false | The maximum value for io2, io1 and gp3 volume types is 1000.| baseline |
423+
|EBS_CSI_CRUNCHY_STORAGE_CLASS_NAME| The EBS CSI storage class name for Crunchy Postgres use| string| io2-vol-pg | false | | baseline |
424+
|EBS_CSI_CRUNCHY_STORAGE_CLASS_VOLUME_TYPE| The EBS CSI volume type to use for Crunchy Postgres persistent volumes | string | io2 | false | Supported values: [`io2`, `io1`, `gp3`] | baseline |
425+
|EBS_CSI_CRUNCHY_STORAGE_CLASS_IOPSPERGB | IOPs per GB parameter for the `EBS_CSI_CRUNCHY_STORAGE_CLASS_NAME` storage class | string | 40 | false |Multiply this value by the volume size in GiB to obtain total IOPS per volume | baseline |
426+
|EBS_CSI_CRUNCHY_STORAGE_CLASS_THROUGHPUT | Maximum volume throughput in MiB/s for the `EBS_CSI_CRUNCHY_STORAGE_CLASS_NAME` storage class | string| 400 | false | The maximum value for io2, io1 and gp3 volume types is 1000.| baseline |
427+
|EBS_CSI_CRUNCHY_STORAGE_CLASS_RECLAIM_POLICY | The ReclaimPolicy for the `EBS_CSI_CRUNCHY_STORAGE_CLASS_NAME` storage class | string | Delete | false | Supported values: [`Delete`, `Retain`] | baseline |
428+
414429

415430
### Ingress-nginx
416431

roles/baseline/defaults/main.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ EBS_CSI_DRIVER_CHART_URL: https://kubernetes-sigs.github.io/aws-ebs-csi-driver
199199
EBS_CSI_DRIVER_CHART_VERSION: 2.38.1
200200
EBS_CSI_DRIVER_ACCOUNT: null
201201
EBS_CSI_DRIVER_LOCATION: us-east-1
202+
EBS_CSI_RABBITMQ_STORAGE_CLASS_NAME: io2-vol-mq
203+
EBS_CSI_RABBITMQ_STORAGE_CLASS_VOLUME_TYPE: io2
204+
EBS_CSI_RABBITMQ_STORAGE_CLASS_IOPSPERGB: 1250
205+
EBS_CSI_RABBITMQ_STORAGE_CLASS_THROUGHPUT: 400
206+
207+
EBS_CSI_CRUNCHY_STORAGE_CLASS_NAME: io2-vol-pg
208+
EBS_CSI_CRUNCHY_STORAGE_CLASS_VOLUME_TYPE: io2
209+
EBS_CSI_CRUNCHY_STORAGE_CLASS_IOPSPERGB: 40
210+
EBS_CSI_CRUNCHY_STORAGE_CLASS_THROUGHPUT: 400
211+
EBS_CSI_CRUNCHY_STORAGE_CLASS_RECLAIM_POLICY: Delete
212+
202213
EBS_CSI_DRIVER_CONFIG:
203214
controller:
204215
k8sTagClusterId: "{{ CLUSTER_NAME }}"
@@ -208,6 +219,25 @@ EBS_CSI_DRIVER_CONFIG:
208219
name: ebs-csi-controller-sa
209220
annotations:
210221
eks.amazonaws.com/role-arn: "{{ EBS_CSI_DRIVER_ACCOUNT }}"
222+
storageClasses:
223+
- name: "{{ EBS_CSI_RABBITMQ_STORAGE_CLASS_NAME }}"
224+
parameters:
225+
type: "{{ EBS_CSI_RABBITMQ_STORAGE_CLASS_VOLUME_TYPE }}"
226+
fstype: ext4
227+
iopsPerGB: "{{ EBS_CSI_RABBITMQ_STORAGE_CLASS_IOPSPERGB | int }}"
228+
throughput: "{{ EBS_CSI_RABBITMQ_STORAGE_CLASS_THROUGHPUT | int }}"
229+
reclaimPolicy: Delete
230+
volumeBindingMode: WaitForFirstConsumer
231+
allowVolumeExpansion: true
232+
- name: "{{ EBS_CSI_CRUNCHY_STORAGE_CLASS_NAME }}"
233+
parameters:
234+
type: "{{ EBS_CSI_CRUNCHY_STORAGE_CLASS_VOLUME_TYPE }}"
235+
fstype: ext4
236+
iopsPerGB: "{{ EBS_CSI_CRUNCHY_STORAGE_CLASS_IOPSPERGB | int }}"
237+
throughput: "{{ EBS_CSI_CRUNCHY_STORAGE_CLASS_THROUGHPUT | int }}"
238+
reclaimPolicy: "{{ EBS_CSI_CRUNCHY_STORAGE_CLASS_RECLAIM_POLICY }}"
239+
volumeBindingMode: WaitForFirstConsumer
240+
allowVolumeExpansion: true
211241

212242
private_ingress:
213243
aws:

roles/baseline/tasks/nfs-subdir-external-provisioner.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
- update
6565

6666
- name: Deploy nfs-subdir-external-provisioner-pg-storage
67+
when:
68+
- PROVIDER != "aws"
6769
kubernetes.core.helm:
6870
name: "{{ PG_NFS_CLIENT_NAME }}"
6971
namespace: "{{ PG_NFS_CLIENT_NAMESPACE }}"
@@ -89,6 +91,8 @@
8991
- uninstall
9092

9193
- name: Remove nfs-subdir-external-provisioner-pg-storage
94+
when:
95+
- PROVIDER != "aws"
9296
kubernetes.core.helm:
9397
name: "{{ PG_NFS_CLIENT_NAME }}"
9498
namespace: "{{ NFS_CLIENT_NAMESPACE }}"

roles/vdm/tasks/postgres/postgres-instance.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,20 @@
206206
block:
207207
- name: Postgres instance - save default role map values
208208
set_fact:
209-
default_postgres_storage_class: "{{ settings.postgres_storage_class | default('pg-storage', true) }}"
210209
default_postgres_pvc_access_mode: "{{ settings.postgres_pvc_access_mode | default('ReadWriteOnce', true) }}"
211-
default_backrest_storage_class: "{{ settings.backrest_storage_class | default('pg-storage', true) }}"
212210
default_backrest_pvc_access_mode: "{{ settings.backrest_pvc_access_mode | default('ReadWriteOnce', true) }}"
211+
- name: Postgres instance - save default role map values for AWS
212+
when:
213+
- PROVIDER == "aws"
214+
set_fact:
215+
default_postgres_storage_class: "{{ settings.postgres_storage_class | default('io2-vol-pg', true) }}"
216+
default_backrest_storage_class: "{{ settings.backrest_storage_class | default('io2-vol-pg', true) }}"
217+
- name: Postgres instance - save default role map values for non-AWS
218+
when:
219+
- PROVIDER != "aws"
220+
set_fact:
221+
default_postgres_storage_class: "{{ settings.postgres_storage_class | default('pg-storage', true) }}"
222+
default_backrest_storage_class: "{{ settings.backrest_storage_class | default('pg-storage', true) }}"
213223
- name: Postgres instance - Create deployment namespace
214224
kubernetes.core.k8s:
215225
kubeconfig: "{{ KUBECONFIG }}"
@@ -240,10 +250,20 @@
240250
block:
241251
- name: Postgres instance - save cds role map values
242252
set_fact:
243-
cds_postgres_storage_class: "{{ settings.postgres_storage_class | default('pg-storage', true) }}"
244253
cds_postgres_pvc_access_mode: "{{ settings.postgres_pvc_access_mode | default('ReadWriteOnce', true) }}"
245-
cds_backrest_storage_class: "{{ settings.backrest_storage_class | default('pg-storage', true) }}"
246254
cds_backrest_pvc_access_mode: "{{ settings.backrest_pvc_access_mode | default('ReadWriteOnce', true) }}"
255+
- name: Postgres instance - save cds role map values for AWS
256+
when:
257+
- PROVIDER == "aws"
258+
set_fact:
259+
cds_postgres_storage_class: "{{ settings.postgres_storage_class | default('io2-vol-pg', true) }}"
260+
cds_backrest_storage_class: "{{ settings.backrest_storage_class | default('io2-vol-pg', true) }}"
261+
- name: Postgres instance - save cds role map values for non-AWS
262+
when:
263+
- PROVIDER != "aws"
264+
set_fact:
265+
cds_postgres_storage_class: "{{ settings.postgres_storage_class | default('pg-storage', true) }}"
266+
cds_backrest_storage_class: "{{ settings.backrest_storage_class | default('pg-storage', true) }}"
247267
- name: Postgres instance - Update ConfigMap
248268
kubernetes.core.k8s:
249269
kubeconfig: "{{ KUBECONFIG }}"

roles/vdm/templates/transformers/crunchy-storage-transformer.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ patch: |-
2929
value:
3030
- {{ default_backrest_pvc_access_mode if (default_backrest_pvc_access_mode is defined) else settings.backrest_pvc_access_mode|default('ReadWriteOnce', true) }}
3131

32+
{% if PROVIDER == "aws" %}
33+
# This value cannot be changed after the initial deployment
34+
- op: replace
35+
path: /spec/instances/0/dataVolumeClaimSpec/storageClassName
36+
value: {{ default_postgres_storage_class if (default_postgres_storage_class is defined) else settings.postgres_storage_class|default('io2-vol-pg', true) }}
37+
38+
# This value cannot be changed after the initial deployment
39+
- op: replace
40+
path: /spec/backups/pgbackrest/repos/0/volume/volumeClaimSpec/storageClassName
41+
value: {{ default_backrest_storage_class if (default_backrest_storage_class is defined) else settings.backrest_storage_class|default('io2-vol-pg', true) }}
42+
43+
{% else %}
3244
# This value cannot be changed after the initial deployment
3345
- op: replace
3446
path: /spec/instances/0/dataVolumeClaimSpec/storageClassName
@@ -38,6 +50,7 @@ patch: |-
3850
- op: replace
3951
path: /spec/backups/pgbackrest/repos/0/volume/volumeClaimSpec/storageClassName
4052
value: {{ default_backrest_storage_class if (default_backrest_storage_class is defined) else settings.backrest_storage_class|default('pg-storage', true) }}
53+
{% endif %}
4154

4255
{% elif role == "cds-postgres" %}
4356
# This value cannot be changed after the initial deployment
@@ -52,6 +65,18 @@ patch: |-
5265
value:
5366
- {{ cds_backrest_pvc_access_mode if (cds_backrest_pvc_access_mode is defined) else settings.backrest_pvc_access_mode|default('ReadWriteOnce', true) }}
5467

68+
{% if PROVIDER == "aws" %}
69+
# This value cannot be changed after the initial deployment
70+
- op: replace
71+
path: /spec/instances/0/dataVolumeClaimSpec/storageClassName
72+
value: {{ cds_postgres_storage_class if (cds_postgres_storage_class is defined) else settings.postgres_storage_class|default('io2-vol-pg', true) }}
73+
74+
# This value cannot be changed after the initial deployment
75+
- op: replace
76+
path: /spec/backups/pgbackrest/repos/0/volume/volumeClaimSpec/storageClassName
77+
value: {{ cds_backrest_storage_class if (cds_backrest_storage_class is defined) else settings.backrest_storage_class|default('io2-vol-pg', true) }}
78+
79+
{% else %}
5580
# This value cannot be changed after the initial deployment
5681
- op: replace
5782
path: /spec/instances/0/dataVolumeClaimSpec/storageClassName
@@ -61,6 +86,7 @@ patch: |-
6186
- op: replace
6287
path: /spec/backups/pgbackrest/repos/0/volume/volumeClaimSpec/storageClassName
6388
value: {{ cds_backrest_storage_class if (cds_backrest_storage_class is defined) else settings.backrest_storage_class|default('pg-storage', true) }}
89+
{% endif %}
6490

6591
{% endif %}
6692
target:

roles/vdm/templates/transformers/sas-storageclass.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,37 @@ patch: |-
1111
storageClassName: "{{ V4_CFG_STORAGECLASS }}"
1212
target:
1313
kind: PersistentVolumeClaim
14+
{% if PROVIDER == "aws" %}
15+
---
16+
apiVersion: builtin
17+
kind: PatchTransformer
18+
metadata:
19+
name: sas-ss-storageclass
20+
patch: |-
21+
- op: add
22+
path: /spec/volumeClaimTemplates/0/spec/storageClassName
23+
value: {{ V4_CFG_STORAGECLASS }}
24+
target:
25+
group: apps
26+
kind: StatefulSet
27+
annotationSelector: sas.com/component-name notin (sas-rabbitmq-server,sas-airflow,sas-risk-cirrus-search,sas-workload-orchestrator,sas-data-agent-server-colocated)
28+
---
29+
apiVersion: builtin
30+
kind: PatchTransformer
31+
metadata:
32+
name: sas-ebs-storageclass
33+
patch: |-
34+
- op: add
35+
path: /spec/volumeClaimTemplates/0/spec/storageClassName
36+
value: io2-vol-mq
37+
- op: replace
38+
path: /spec/volumeClaimTemplates/0/spec/resources/requests/storage
39+
value: 4Gi
40+
target:
41+
group: apps
42+
kind: StatefulSet
43+
annotationSelector: sas.com/component-name in (sas-rabbitmq-server)
44+
{% else %}
1445
---
1546
apiVersion: builtin
1647
kind: PatchTransformer
@@ -24,3 +55,4 @@ target:
2455
group: apps
2556
kind: StatefulSet
2657
annotationSelector: sas.com/component-name notin (sas-airflow,sas-risk-cirrus-search,sas-workload-orchestrator,sas-data-agent-server-colocated)
58+
{% endif %}

0 commit comments

Comments
 (0)