Skip to content

Commit

Permalink
[FEATURE] Optional IOPS option in aws volume (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
citrocity authored Jan 26, 2022
1 parent 26c628d commit af81bb8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cluster_vars:
auto_volumes:
- { device_name: "/dev/sda1", mountpoint: "/", fstype: "ext4", volume_type: "gp2", volume_size: 8, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdf", mountpoint: "/media/mysvc", fstype: "ext4", volume_type: "gp2", volume_size: 1, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdg", mountpoint: "/media/mysvc", fstype: "ext4", volume_type: "gp2", volume_size: 1, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdg", mountpoint: "/media/mysvc", fstype: "ext4", volume_type: "gp2", volume_size: 1, iops: 100, encrypted: True, delete_on_termination: true }
lvmparams: { vg_name: "vg0", lv_name: "lv0", lv_size: "100%VG" }
flavor: t4g.nano
# image: "ami-0c28049fa5618bca4" # eu-west-1 20.04 arm64 hvm-ssd 20210820. Ubuntu images can be located at https://cloud-images.ubuntu.com/locator/
Expand All @@ -61,15 +61,15 @@ cluster_vars:
auto_volumes:
- { device_name: "/dev/sda1", mountpoint: "/", fstype: "ext4", volume_type: "gp2", volume_size: 8, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdf", mountpoint: "/media/mysvc", fstype: "ext4", volume_type: "gp2", volume_size: 1, encrypted: True, delete_on_termination: true, perms: { owner: "root", group: "root", mode: "775" } }
- { device_name: "/dev/sdg", mountpoint: "/media/mysvc2", fstype: "ext4", volume_type: "gp2", volume_size: 1, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdg", mountpoint: "/media/mysvc2", fstype: "ext4", volume_type: "gp2", volume_size: 1, iops: 100, encrypted: True, delete_on_termination: true }
flavor: t3a.nano
version: "{{sysdisks_version | default('')}}"
vms_by_az: { a: 1, b: 1, c: 0 }

sysdiskslvm:
auto_volumes:
- { device_name: "/dev/sda1", mountpoint: "/", fstype: "ext4", volume_type: "gp2", volume_size: 8, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdf", mountpoint: "/media/mysvc", fstype: "ext4", volume_type: "gp2", volume_size: 1, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdf", mountpoint: "/media/mysvc", fstype: "ext4", volume_type: "gp2", volume_size: 1, iops: 100, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdg", mountpoint: "/media/mysvc", fstype: "ext4", volume_type: "gp2", volume_size: 1, encrypted: True, delete_on_termination: true }
lvmparams: { vg_name: "vg0", lv_name: "lv0", lv_size: "100%VG" }
flavor: t3a.nano
Expand All @@ -85,7 +85,7 @@ cluster_vars:

hostnvme-multi:
auto_volumes:
- { device_name: "/dev/sda1", mountpoint: "/", fstype: "ext4", volume_type: "gp2", volume_size: 8, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sda1", mountpoint: "/", fstype: "ext4", volume_type: "gp2", volume_size: 8, iops: 100, encrypted: True, delete_on_termination: true }
- { device_name: "/dev/sdb", mountpoint: "/media/mysvc", fstype: "ext4", volume_type: "ephemeral", ephemeral: ephemeral0 }
- { device_name: "/dev/sdc", mountpoint: "/media/mysvc2", fstype: "ext4", volume_type: "ephemeral", ephemeral: ephemeral1 }
- { device_name: "/dev/sdf", mountpoint: "/media/mysvc8", fstype: "ext4", volume_type: "gp2", volume_size: 1, encrypted: True, delete_on_termination: true }
Expand Down
4 changes: 2 additions & 2 deletions EXAMPLE/cluster_defs/test_aws_euw1/cluster_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ cluster_vars:
sandbox:
hosttype_vars:
sys: {auto_volumes: [], flavor: t3a.nano, version: '{{sys_version | default('''')}}', vms_by_az: {a: 1, b: 1, c: 0}}
sysdisks2: {auto_volumes: [{device_name: /dev/sda1, mountpoint: /, fstype: ext4, volume_type: gp2, volume_size: 9, encrypted: true, delete_on_termination: true}, {device_name: /dev/sdf, mountpoint: /media/mysvc, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true, perms: {owner: root, group: root, mode: '775'}}, {device_name: /dev/sdg, mountpoint: /media/mysvc2, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true}], flavor: t3a.nano, version: '{{sysdisks_version | default('''')}}', vms_by_az: {a: 1, b: 1, c: 0}}
sysdisks3: {auto_volumes: [{device_name: /dev/sdf, mountpoint: /media/mysvc, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true}, {device_name: /dev/sdg, mountpoint: /media/mysvc2, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true}, {device_name: /dev/sdh, mountpoint: /media/mysvc3, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true}], flavor: t3a.nano, version: '{{sysdisks_version | default('''')}}', vms_by_az: {a: 1, b: 1, c: 0}}
sysdisks2: {auto_volumes: [{device_name: /dev/sda1, mountpoint: /, fstype: ext4, volume_type: gp2, volume_size: 9, encrypted: true, delete_on_termination: true}, {device_name: /dev/sdf, mountpoint: /media/mysvc, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true, perms: {owner: root, group: root, mode: '775'}}, {device_name: /dev/sdg, mountpoint: /media/mysvc2, fstype: ext4, volume_type: gp2, volume_size: 1, iops: 100, encrypted: true, delete_on_termination: true}], flavor: t3a.nano, version: '{{sysdisks_version | default('''')}}', vms_by_az: {a: 1, b: 1, c: 0}}
sysdisks3: {auto_volumes: [{device_name: /dev/sdf, mountpoint: /media/mysvc, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true}, {device_name: /dev/sdg, mountpoint: /media/mysvc2, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true}, {device_name: /dev/sdh, mountpoint: /media/mysvc3, fstype: ext4, volume_type: gp2, volume_size: 1, iops: 100, encrypted: true, delete_on_termination: true}], flavor: t3a.nano, version: '{{sysdisks_version | default('''')}}', vms_by_az: {a: 1, b: 1, c: 0}}
hostnvme-multi: {auto_volumes: [{device_name: "/dev/sda1", mountpoint: "/", fstype: "ext4", volume_type: "gp2", volume_size: 8, encrypted: True, delete_on_termination: true}, {device_name: /dev/sdb, mountpoint: /media/mysvc, fstype: ext4, volume_type: ephemeral, ephemeral: ephemeral0}, {device_name: /dev/sdc, mountpoint: /media/mysvc2, fstype: ext4, volume_type: ephemeral, ephemeral: ephemeral1}, {device_name: /dev/sdf, mountpoint: /media/mysvc8, fstype: ext4, volume_type: gp2, volume_size: 1, encrypted: true, delete_on_termination: true}], flavor: i3en.2xlarge, version: '{{sys_version | default('''')}}', vms_by_az: {a: 1, b: 1, c: 0}}
hostnvme-lvm: {auto_volumes: [{device_name: "/dev/sda1", mountpoint: "/", fstype: "ext4", volume_type: "gp2", volume_size: 8, encrypted: True, delete_on_termination: true}, {device_name: /dev/sdb, mountpoint: /media/data, fstype: ext4, volume_type: ephemeral, ephemeral: ephemeral0}, {device_name: /dev/sdc, mountpoint: /media/data, fstype: ext4, volume_type: ephemeral, ephemeral: ephemeral1}], lvmparams: {vg_name: vg0, lv_name: lv0, lv_size: 100%VG}, flavor: i3en.2xlarge, version: '{{sys_version | default('''')}}', vms_by_az: {a: 1, b: 1, c: 0}}
hosthdd-multi: {auto_volumes: [{device_name: /dev/sdb, mountpoint: /media/mysvc, fstype: ext4, volume_type: ephemeral, ephemeral: ephemeral0}, {device_name: /dev/sdc, mountpoint: /media/mysvc2, fstype: ext4, volume_type: ephemeral, ephemeral: ephemeral1}, {device_name: /dev/sdd, mountpoint: /media/mysvc3, fstype: ext4, volume_type: ephemeral, ephemeral: ephemeral2}], flavor: d2.xlarge, version: '{{sys_version | default('''')}}', vms_by_az: {a: 1, b: 1, c: 0}}
Expand Down
2 changes: 2 additions & 0 deletions _dependencies/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
that: "'{%- for hosttype in cluster_vars[buildenv].hosttype_vars | dict2items -%}{%- if ('lvmparams' not in hosttype.value and (hosttype.value.auto_volumes | length) == (hosttype.value.auto_volumes | map(attribute='mountpoint') | list | unique | count)) or ('lvmparams' in hosttype.value and (hosttype.value.auto_volumes | selectattr('mountpoint', '!=', '/') | map(attribute='mountpoint') | list | unique | count == 1)) -%}{%- else -%}{{hosttype.key}}{%- endif -%}{%- endfor -%}' == ''"
fail_msg: "All non-root volume mountpoints must either be all different (in which case 'lvmparams' must not be set), or all the same (in which case, 'lvmparams' must be set)"

- assert: { that: "cluster_vars[buildenv] | json_query(\"hosttype_vars.*.auto_volumes[] | [?iops > `16000`] && [?starts_with(volume_type, `gp`)]\") | length == 0", fail_msg: "Volume iops is too high; maximum is 16000" }
when: cluster_vars.type == "aws"

- name: Create gcp service account contents file from cluster_vars[buildenv].gcp_service_account_rawtext (unless already defined by user)
block:
Expand Down
1 change: 1 addition & 0 deletions create/tasks/create_aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
encrypted: "{{item.auto_volume.encrypted}}"
volume_size: "{%- if 'src' in item.auto_volume -%}{{omit}}{%- else -%}{{item.auto_volume.volume_size}}{%- endif -%}"
volume_type: "{{item.auto_volume.volume_type}}"
iops: "{{item.auto_volume.iops | default(omit)}}"
delete_on_termination: yes
loop: "{{ cluster_hosts_target_denormalised_by_volume | selectattr('auto_volume.src', 'defined') | list }}"
async: 7200
Expand Down

0 comments on commit af81bb8

Please sign in to comment.