Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Commit f39c7ea

Browse files
authored
Merge pull request #25 from MikeKroell/add-max-ebs-volume-size
Updated calc_new_size and config file, confirmed working
2 parents 2be1045 + aa831ca commit f39c7ea

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

bin/ebs-autoscale

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
initialize
3434

35+
MAX_EBS_VOLUME_SIZE=$(get_config_value .limits.max_ebs_volume_size)
3536
MAX_LOGICAL_VOLUME_SIZE=$(get_config_value .limits.max_logical_volume_size)
3637
MAX_EBS_VOLUME_COUNT=$(get_config_value .limits.max_ebs_volume_count)
3738

@@ -120,13 +121,29 @@ calc_new_size() {
120121
local new_size=150
121122

122123
if [ "$num_devices" -ge "4" ] && [ "$num_devices" -le "6" ]; then
123-
new_size=300
124+
if [ "$MAX_EBS_VOLUME_SIZE" -ge "299" ]; then
125+
new_size=300
126+
else
127+
new_size=$MAX_EBS_VOLUME_SIZE
128+
fi
124129
elif [ "$num_devices" -gt "6" ] && [ "$num_devices" -le "10" ]; then
125-
new_size=1000
130+
if [ "$MAX_EBS_VOLUME_SIZE" -ge "999" ]; then
131+
new_size=1000
132+
else
133+
new_size=$MAX_EBS_VOLUME_SIZE
134+
fi
126135
elif [ "$num_devices" -gt "10" ]; then
127-
new_size=1500
136+
if [ "$MAX_EBS_VOLUME_SIZE" -ge "1499" ]; then
137+
new_size=1500
138+
else
139+
new_size=$MAX_EBS_VOLUME_SIZE
140+
fi
128141
else
129-
new_size=150
142+
if [ "$MAX_EBS_VOLUME_SIZE" -ge "149" ]; then
143+
new_size=150
144+
else
145+
new_size=$MAX_EBS_VOLUME_SIZE
146+
fi
130147
fi
131148

132149
echo ${new_size}

config/ebs-autoscale.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"detection_interval": 1,
1414
"limits": {
15+
"max_ebs_volume_size": 1500,
1516
"max_logical_volume_size": 8000,
1617
"max_ebs_volume_count": 16
1718
},

0 commit comments

Comments
 (0)