@@ -85,37 +85,17 @@ function create_vm {
85
85
local machine_type=" GCP_MACHINE_TYPE_${name} "
86
86
machine_type=${! machine_type}
87
87
local servername=" ${CLUSTER_NAME} -${name} "
88
- local diskname=" ${CLUSTER_NAME} -disk"
89
- local imagename=" ${servername} -image"
90
88
91
89
# Loop over all zones in the GCP region to ignore a full zone.
92
90
# We are not able to use 'gcloud compute zones list' as the gcloud.compute.zones.list permission is missing.
93
91
for GCP_ZONE in " ${GCP_REGION} -a" " ${GCP_REGION} -b" " ${GCP_REGION} -c" ; do
94
- # Check if image was already created.
95
- # Images are not zone specific, but the disk is.
96
- if ! gcloud compute images describe " $imagename " --project " $GCP_PROJECT " > /dev/null; then
97
- # Create the base disk image based on the public Ubuntu 22.04 LTS cloud image
98
- # Note that this has also been verified to work with CentOS 8 as of
99
- # 2021-01-12, but this is not tested regularly.
100
- # To use CentOS 8:
101
- # --image-project centos-cloud --image-family centos-stream-8
102
- if ! gcloud compute disks describe " $diskname " --project " $GCP_PROJECT " --zone " $GCP_ZONE " > /dev/null; then
103
- gcloud compute disks create " $diskname " \
104
- --project " $GCP_PROJECT " \
105
- --image-project ubuntu-os-cloud --image-family ubuntu-2204-lts \
106
- --zone " $GCP_ZONE "
107
- fi
108
- gcloud compute images create " $imagename " \
109
- --project " $GCP_PROJECT " \
110
- --source-disk " $diskname " --source-disk-zone " $GCP_ZONE " \
111
- --licenses " https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"
112
- fi
113
-
114
92
if ! gcloud compute instances describe " $servername " --project " $GCP_PROJECT " --zone " $GCP_ZONE " > /dev/null; then
115
93
if gcloud compute instances create " $servername " \
116
94
--project " $GCP_PROJECT " \
117
95
--zone " $GCP_ZONE " \
118
- --image " $imagename " \
96
+ --enable-nested-virtualization \
97
+ --image-project ubuntu-os-cloud \
98
+ --image-family ubuntu-2004-lts \
119
99
--boot-disk-size 200G \
120
100
--boot-disk-type pd-ssd \
121
101
--can-ip-forward \
0 commit comments