Skip to content

Commit e14cbea

Browse files
committed
support --metal-image-size --cloud-image-size
If the custom CoreOS container that was produced is large then the current 3072 MiB limit on the metal disk image might not be enough. Let's make it configurable and support configuring the cloud image size while we are at it.
1 parent 2774d16 commit e14cbea

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

custom-coreos-disk-images.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,26 @@ check_rpms() {
5252
main() {
5353

5454
# Call getopt to validate the provided input.
55-
options=$(getopt --options - --longoptions 'imgref:,ociarchive:,osname:,platforms:' -- "$@")
55+
options=$(getopt --options - --longoptions 'imgref:,ociarchive:,osname:,platforms:,metal-image-size:,cloud-image-size:' -- "$@")
5656
if [ $? -ne 0 ]; then
5757
echo "Incorrect options provided"
5858
exit 1
5959
fi
6060
eval set -- "$options"
6161
while true; do
6262
case "$1" in
63+
--cloud-image-size)
64+
shift # The arg is next in position args
65+
cloud_image_size=$1
66+
;;
6367
--imgref)
6468
shift # The arg is next in position args
6569
imgref=$1
6670
;;
71+
--metal-image-size)
72+
shift # The arg is next in position args
73+
metal_image_size=$1
74+
;;
6775
--ociarchive)
6876
shift # The arg is next in position args
6977
ociarchive=$1
@@ -119,11 +127,16 @@ main() {
119127
# FCOS/RHCOS have different default disk image sizes
120128
# In the future should pull this from the container image
121129
# (/usr/share/coreos-assembler/image.json)
122-
image_size=10240 # FCOS
123-
if [ $osname == 'rhcos' ]; then
124-
image_size=16384 # RHCOS
130+
if [ -z "${cloud_image_size:-}" ]; then
131+
cloud_image_size=10240 # FCOS
132+
if [ $osname == 'rhcos' ]; then
133+
cloud_image_size=16384 # RHCOS
134+
fi
125135
fi
126136

137+
# Default Metal Image Size
138+
metal_image_size="${metal_image_size:-3072}"
139+
127140
# Make a local tmpdir and outidr
128141
tmpdir=$(mktemp -d ./tmp-osbuild-XXX)
129142
outdir="${tmpdir}/out"
@@ -155,8 +168,8 @@ main() {
155168
"deploy-via-container": "true",
156169
"ostree-container": "${ociarchive}",
157170
"container-imgref": "${imgref}",
158-
"metal-image-size": "3072",
159-
"cloud-image-size": "${image_size}",
171+
"metal-image-size": "${metal_image_size}",
172+
"cloud-image-size": "${cloud_image_size}",
160173
"rootfs-size": "0",
161174
"extra-kargs-string": ""
162175
}

0 commit comments

Comments
 (0)