Skip to content

fabi200123/garm-provider-oci-cbsl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Garm External Provider For OCI

The OCI external provider allows garm to create Linux and Windows runners on top of OCI virtual machines.

Build

Clone the repo:

git clone https://github.com/cloudbase/garm-provider-oci

Build the binary:

cd garm-provider-oci
go build .

Copy the binary on the same system where garm is running, and point to it in the config.

Configure

The config file for this external provider is a simple toml used to configure the OCI credentials it needs to spin up virtual machines.

availability_domain = "mQqX:US-ASHBURN-AD-2"
compartment_id = "ocid1.compartment.oc1...fsbq"
subnet_id = "ocid1.subnet.oc1.iad....feoplaka"
network_security_group_id = "ocid1.networksecuritygroup....pfzya"
tenancy_id = "ocid1.tenancy.oc1..aaaaaaaajds7tbqbvrcaiavm2uk34t7wke7jg75aemsacljymbjxcio227oq"
user_id = "ocid1.user.oc1...ug6l37u6a"
region = "us-ashburn-1"
fingerprint = "38...6f:bb"
private_key_path = "/home/ubuntu/.oci/private_key.pem"
private_key_password = ""

Creating a pool

After you add it to garm as an external provider, you need to create a pool that uses it. Assuming you named your external provider as oci in the garm config, the following command should create a new pool:

garm-cli pool create \
    --os-type windows \
    --os-arch amd64 \
    --enabled=true \
    --flavor VM.Standard.E4.Flex \
    --image ocid1.image.oc1.iad.aaaaaaaamf7b6c6kvz2itjyflse6ibax2dgmqts2jlahl2zl3mbxlakv4h5a \
    --min-idle-runners 1 \
    --repo 26ae13a1-13e9-47ec-92c9-1526084684cf \
    --tags oci,windows \
    --provider-name oci

This will create a new Windows runner pool for the repo with ID 26ae13a1-13e9-47ec-92c9-1526084684cf on OCI, using the image specified by its OCID ocid1.image.oc1.iad.aaaaaaaamf7b6c6kvz2itjyflse6ibax2dgmqts2jlahl2zl3mbxlakv4h5a corresponding to Windows-Server-2022-Standard-Edition-VM-2024.01.09-0 for the region US-ASHBURN-1.

Here is an example for a Linux pool that uses the image specified by its image name:

garm-cli pool create \
    --os-type linux \
    --os-arch amd64 \
    --enabled=true \
    --flavor VM.Standard.E4.Flex \
    --image ocid1.image.oc1.iad.aaaaaaaah4rpzimrmnqfaxcm2xe3hdtegn4ukqje66rgouxakhvkaxer24oa \
    --min-idle-runners 0 \
    --repo 26ae13a1-13e9-47ec-92c9-1526084684cf \
    --tags oci,linux \
    --provider-name oci

Always find a recent image to use. For example, to see available Windows Server 2022 VM Images, you can access windows-server-2022-vm.

Tweaking the provider

Garm supports sending opaque json encoded configs to the IaaS providers it hooks into. This allows the providers to implement some very provider specific functionality that doesn't necessarily translate well to other providers. Features that may exists on OCI, may not exist on Azure or AWS and vice versa.

To this end, this provider supports the following extra specs schema:

{
    "$schema": "http://cloudbase.it/garm-provider-oci/schemas/extra_specs#",
    "type": "object",
    "properties": {
        "ocpus": {
            "type": "number",
            "description": "Number of OCPUs"
        },
        "memory_in_gbs": {
            "type": "number",
            "description": "Memory in GBs"
        },
        "boot_volume_size": {
            "type": "integer",
            "description": "Boot volume size in GB"
        },
        "ssh_public_keys": {
            "type": "array",
            "description": "List of SSH public keys",
            "items": {
                "type": "string",
                "description": "A SSH public key"
            }
        },
        "disable_updates": {
            "type": "boolean",
            "description": "Disable automatic updates on the VM."
        },
        "enable_boot_debug": {
            "type": "boolean",
            "description": "Enable boot debug on the VM."
        },
        "extra_packages": {
            "type": "array",
            "description": "Extra packages to install on the VM.",
            "items": {
                "type": "string"
            }
        },
        "runner_install_template": {
            "type": "string",
            "description": "This option can be used to override the default runner install template. If used, the caller is responsible for the correctness of the template as well as the suitability of the template for the target OS. Use the extra_context extra spec if your template has variables in it that need to be expanded."
        },
        "extra_context": {
            "type": "object",
            "description": "Extra context that will be passed to the runner_install_template.",
            "additionalProperties": {
                "type": "string"
            }
        },
        "pre_install_scripts": {
            "type": "object",
            "description": "A map of pre-install scripts that will be run before the runner install script. These will run as root and can be used to prep a generic image before we attempt to install the runner. The key of the map is the name of the script as it will be written to disk. The value is a byte array with the contents of the script.",
            "additionalProperties": {
                "type": "string"
            }
        }
    },
	"additionalProperties": false
}

An example of extra specs json would look like this:

{
    "ocpus": 1,
    "memory_in_gbs": 4,
    "boot_volume_size": 255,
    "ssh_public_keys": ["your key"],
    "disable_updates": true,
    "enable_boot_debug": true,
    "extra_context": {
        "GolangDownloadURL": "https://go.dev/dl/go1.22.4.linux-amd64.tar.gz"
    },
    "extra_packages": [
        "apg",
        "tmux"
    ],
    "pre_install_scripts": {
        "01-script": "IyEvYmluL2Jhc2gKCgplY2hvICJIZWxsbyBmcm9tICQwIiA+PiAvMDEtc2NyaXB0LnR4dAo=",
        "02-script": "IyEvYmluL2Jhc2gKCgplY2hvICJIZWxsbyBmcm9tICQwIiA+PiAvMDItc2NyaXB0LnR4dAo="
    },
    "runner_install_template": "IyEvYmluL2Jhc2gKCnNldCAtZQpzZXQgLW8gcGlwZWZhaWwKCnt7LSBpZiAuRW5hYmxlQm9vdERlYnVnIH19CnNldCAteAp7ey0gZW5kIH19CgpDQUxMQkFDS19VUkw9Int7IC5DYWxsYmFja1VSTCB9fSIKTUVUQURBVEFfVVJMPSJ7eyAuTWV0YWRhdGFVUkwgfX0iCkJFQVJFUl9UT0tFTj0ie3sgLkNhbGxiYWNrVG9rZW4gfX0iCgppZiBbIC16ICIkTUVUQURBVEFfVVJMIiBdO3RoZW4KCWVjaG8gIm5vIHRva2VuIGlzIGF2YWlsYWJsZSBhbmQgTUVUQURBVEFfVVJMIGlzIG5vdCBzZXQiCglleGl0IDEKZmkKCmZ1bmN0aW9uIGNhbGwoKSB7CglQQVlMT0FEPSIkMSIKCVtbICRDQUxMQkFDS19VUkwgPX4gXiguKikvc3RhdHVzKC8pPyQgXV0gfHwgQ0FMTEJBQ0tfVVJMPSIke0NBTExCQUNLX1VSTH0vc3RhdHVzIgoJY3VybCAtLXJldHJ5IDUgLS1yZXRyeS1kZWxheSA1IC0tcmV0cnktY29ubnJlZnVzZWQgLS1mYWlsIC1zIC1YIFBPU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WwvZ28gJiYgc3VkbyB0YXIgLUMgL3Vzci9sb2NhbCAteHpmIGdvMS4yMi40LmxpbnV4LWFtZDY0LnRhci5negpleHBvcnQgUEFUSD0kUEFUSDovdXNyL2xvY2FsL2dvL2Jpbgp7ey0gZW5kIH19"
    }

NOTE: The extra_context spec adds a map of key/value pairs that may be expected in the runner_install_template. The runner_install_template allows us to completely override the script that installs and starts the runner. In the example above, I have added a copy of the current template from garm-provider-common, with the adition of:

{{- if .ExtraContext.GolangDownloadURL }}
curl -LO {{ .ExtraContext.GolangDownloadURL }}
rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
{{- end }}

NOTE: runner_install_template is a golang template, which is used to install the runner. An example on how you can extend the currently existing template with a function that downloads, extracts and installs Go on the runner is provided above.

To set it on an existing pool, simply run:

garm-cli pool update --extra-specs='{"boot_volume_size" : 100}' <POOL_ID>

You can also set a spec when creating a new pool, using the same flag.

Workers in that pool will be created taking into account the specs you set on the pool.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 93.1%
  • Shell 3.9%
  • Makefile 2.4%
  • Dockerfile 0.6%