Skip to content

Support passing custom metadata to Google instance

Tomasz Maczukin requested to merge support-google-custom-metadata into master

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

  1. Login on one of our private runner managers

  2. 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
  3. 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
  4. Login to the created VM

    ./docker-machine-Linux-x86_64 ssh test-metadata-vm
  5. Check that update-engine service is stopped

    systemctl status update-engine
    systemctl is-active update-engine
  6. 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:

      There should be the cos-update-strategy entry with update_disabled value.

  7. Logout from the VM and remove it

    ./docker-machine-Linux-x86_64 rm test-metadata-vm

Part of #14 (closed)

Edited by Tomasz Maczukin

Merge request reports