@@ -20,15 +20,21 @@ DEFAULT_REGISTRY_IMAGE=registry:2
2020DEFAULT_REGISTRY_NAME=kind-registry
2121DEFAULT_REGISTRY_PORT=5000
2222DEFAULT_CLUSTER_NAME=kind
23+ DEFAULT_CPU=2
24+ DEFAULT_MEMORY=12
25+ DEFAULT_DISK=60
2326
2427show_help () {
2528cat << EOF
2629Usage: $( basename " $0 " ) <options>
2730
2831 -h, --help Display help
29- --registry-image The registry image to use (default: registry:2)
30- --registry-name The registry name to use
31- --registry-port The local port used to bind the registry
32+ --cpu Number of CPUs to be allocated to the virtual machine (default: $DEFAULT_CPU ). For Mac OS only
33+ --disk Size of the disk in GiB to be allocated to the virtual machine (default: $DEFAULT_DISK ). For Mac OS only
34+ --memory Size of the memory in GiB to be allocated to the virtual machine (default: $DEFAULT_MEMORY ). For Mac OS only
35+ --registry-image The registry image to use (default: $DEFAULT_REGISTRY_IMAGE )
36+ --registry-name The registry name to use (default: $DEFAULT_REGISTRY_NAME )
37+ --registry-port The local port used to bind the registry (default: $DEFAULT_REGISTRY_PORT )
3238 -n, --cluster-name The name of the cluster to create (default: $DEFAULT_CLUSTER_NAME )"
3339 --document Document the local registry
3440
@@ -40,6 +46,9 @@ main() {
4046 local registry_name=" $DEFAULT_REGISTRY_NAME "
4147 local registry_port=" $DEFAULT_REGISTRY_PORT "
4248 local cluster_name=" $DEFAULT_CLUSTER_NAME "
49+ local cpu=" $DEFAULT_CPU "
50+ local disk=" $DEFAULT_DISK "
51+ local memory=" $DEFAULT_MEMORY "
4352 local document=false
4453
4554 parse_command_line " $@ "
@@ -63,6 +72,36 @@ parse_command_line() {
6372 show_help
6473 exit
6574 ;;
75+ --cpu)
76+ if [[ -n " ${2:- } " ]]; then
77+ cpu=" $2 "
78+ shift
79+ else
80+ echo " ERROR: '--cpu' cannot be empty." >&2
81+ show_help
82+ exit 1
83+ fi
84+ ;;
85+ --disk)
86+ if [[ -n " ${2:- } " ]]; then
87+ disk=" $2 "
88+ shift
89+ else
90+ echo " ERROR: '--disk' cannot be empty." >&2
91+ show_help
92+ exit 1
93+ fi
94+ ;;
95+ --memory)
96+ if [[ -n " ${2:- } " ]]; then
97+ memory=" $2 "
98+ shift
99+ else
100+ echo " ERROR: '--memory' cannot be empty." >&2
101+ show_help
102+ exit 1
103+ fi
104+ ;;
66105 --registry-image)
67106 if [[ -n " ${2:- } " ]]; then
68107 registry_image=" $2 "
@@ -126,7 +165,7 @@ install_docker() {
126165 if [ " $RUNNER_OS " == " macOS" ] && ! [ -x " $( command -v docker) " ]; then
127166 echo ' Installing docker...'
128167 brew install docker colima
129- colima start
168+ colima start --cpu " $cpu " --memory " $memory " --disk " $disk "
130169 fi
131170}
132171
0 commit comments