Support passing custom metadata to Google instance
What critical bug this MR is fixing?
Adds support for passing custom metadata to created GCP instance. This is required to disable automatic updates of the Google Container Optimized OS.
How does this change help reduce cost of usage? What scale of cost reduction is it?
In what scenarios is this change usable with GitLab Runner's docker+machine executor?
How to test the MR
-
Login on one of our private runner managers
-
Download the Docker Machine binary build for this MR
wget https://gitlab-docker-machine-downloads.s3.amazonaws.com/support-google-custom-metadata/docker-machine-Linux-x86_64 chmod +x ./docker-machine-Linux-x86_64
-
Create Docker VM with Docker Machine
./docker-machine-Linux-x86_64 \ create \ --driver google \ --google-project gitlab-ci-155816 \ --google-disk-size 50 \ --google-machine-type n1-standard-2 \ --google-username cos \ --google-use-internal-ip \ --google-zone us-east1-c \ --google-machine-image gitlab-ci-155816/global/images/runners-cos-stable-swtich-to-google-cos \ --google-metadata=cos-update-strategy=update_disabled \ test-metadata-vm
-
Login to the created VM
./docker-machine-Linux-x86_64 ssh test-metadata-vm
-
Check that
update-engine
service is stoppedsystemctl status update-engine systemctl is-active update-engine
-
Check the
cos-update-strategy
metadata entry:-
by requesting the metadata server:
curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/cos-update-strategy
It should be
update_disabled
. -
by checking the GCP console:
- go to https://console.cloud.google.com/compute/instances?project=gitlab-ci-155816 and filter the list of VMs with
test-metadata-vm
(or try this link) - open the
test-metadata-vm
instance - scroll down to the
Custom metadata
section.
There should be the
cos-update-strategy
entry withupdate_disabled
value. - go to https://console.cloud.google.com/compute/instances?project=gitlab-ci-155816 and filter the list of VMs with
-
-
Logout from the VM and remove it
./docker-machine-Linux-x86_64 rm test-metadata-vm
Part of #14 (closed)
Edited by Tomasz Maczukin