Platforms are an API interface to different environments to run clusters, create images, collect logging information, etc.
Authentication differs based on the platform. Some platforms like aws utilize the
configuration files from their command-line tooling while others define their
own custom configuration format and default locations (like DigitalOcean).
Generally if any extensions / custom configurations are needed a new file is
created inside of the auth package which will define the default location,
the structure of the configuration, and a function to parse the configuration
file (usually named ReadConfig and emits a
map[string]<platform>Config object).
Platform APIs wrap each cloud provider's golang SDK and live inside of
platform/api/<platform>/. There is no direct requirement for what
functionality is present in the API.
Clusters must implement the Cluster interface.
Machines must implement the Machine interface.
To add a new platform to the kola runner the following things must be added:
- A platform specific struct inside of
cmd/kola/kola.gowhich contains the fields that should be logged to give more information about a test run. Generally this will contain things likeversionoramiandregion. This is an example of the struct and this shows the data being added to the output (which can be found in_kola_temp/<platform>-latest/properties.json). - The platform specific options inside of
cmd/kola/options.go(for example DigitalOcean). The flags will generally contain an override for the configuration file location, region, type/size, and the image. - The platform needs to be added to the
kolaPlatformslist inside ofcmd/kola/options.gohere - The platform options & new cluster inside of
kola/harness.go. The platform options variables are defined here and theNewClustermethod is defined here.
It is generally preferred that new platforms add garbage collection methods via
the ore <platform> gc command.
For platforms which support adding custom images ore commands to upload &
create images from the image file.
- The AWS platform wraps aws-sdk-go.
- By default SSH keys will be passed via both the AWS metadata AND the userdata.
- UserData is passed to the instances via the AWS metadata service.
- Instances are tagged with
Name:<generated name>andCreatedBy:mantle. TheCreatedBytag is used byGCwhen searching for instances to terminate. - Serial Console data on AWS is only saved by the cloud during boot sequences (initial boot and all subsequent reboot / shutdowns). This means that sometimes the serial console will not be complete as only the most recent 64KB is stored.
- If a security group matching the name in
aws-sg(default:kola) is not found then one will be created, along with a VPC, internet gateway, route table, and subnets. - Both AMI's as well as the channel names are accepted via the
aws-amiparameter, if a channel is given it will be resolved via the release bucket'scoreos_production_ami_all.jsonfile.
- The Azure platform wraps azure-sdk-for-go.
- By default SSH keys will be passed via both the Azure metadata AND the userdata.
- UserData is passed to the instances via the Azure metadata service.
- For each cluster to be created a Resource Group is created containing the necessary networking resources and a storage account (which will be used to store boot diagnostics for any machines in the cluster).
- There are two types of images in Azure (published images and custom images). For using published images the channel can be passed via the
azure-skuparameter and the version can be passed via theazure-versionparameter. To specify a custom image you can pass theazure-disk-uriparameter. kolaworks entirely on ARM based authentication,orehas methods for both ASM or ARM credentials.GCin Azure searches for Resource Groups with a prefix that matches the--azure-resource-group-basenameflag (defaults tokola-cluster).
- The DO platform wraps godo.
- By default SSH keys will be passed via both the DO metadata AND the userdata.
- UserData is passed to the instances via the DO metadata service.
- DigitalOcean has no method for uploading custom images, as a result the
ore do create-imagecommand does aterrifyingspecial workaround which specifies custom userdata that does the following (after which the machine is snapshotted):- configure networking in the initramfs
- Download a custom image
- replaces
/root/initramfs/shutdownwith a script to:- unmount the root filesystem
- dd the custom image over the disk
- reboot
- Instances are given the tag
mantlewhich is used byGC. - The
do-imageparameter accepts snapshot ID's as well as the channel names, if a channel is given the relevant slugcoreos-<channel>will be passed to DO.
- The ESX platform wraps govmomi.
- ESX is actually a bit of a misnomer, it actually requires that the target is a vSphere instance (as it uses features not present in the free ESXi hypervisor).
- SSH keys will be passed via userdata.
- Userdata is passed to the instances via the
ovfenv. When a machine is created the API updates theconfig.vAppConfig.property.guestinfo.coreos.config.datafield to be a base64 encoded userdata config. - The general workflow for running tests on ESX is to run the
ore esx create-baseto upload an OVF image and then the resulting image name is specified tokolavia theesx-base-vmparameter. This is done to only require kola to perform a clone operation rather than a full re-upload of the image.
- The GCE/gcloud platform wraps this SDK.
- By default SSH keys will be passed via both the GCE metadata AND the userdata.
- UserData is passed to the instances via the GCE metadata service.
- Instances are tagged with
created-by:mantlewhich is used when filtering instances forGC.
- The OpenStack platform wraps gophercloud.
- By default SSH keys will be passed via both the OpenStack metadata AND the userdata.
- UserData is passed to the instances via the OpenStack metadata service.
- Instances are tagged with
CreatedBy: mantlewhich is used when filtering instances forGC.
- The Packet platform wraps packngo.
- SSH keys will be passed via userdata.
- Custom images do not use the Packet Custom Images API but rather the machine creation actually writes a custom iPXE script (which is uploaded to Google Storage) that sets
coreos.config.urlon the kernel command-line to point at a userdata file (which is also uploaded to Google Storage). This userdata file contains multiple systemd units & file definitions -- the actual metadata is written to/userdata. The systemd units will runcoreos-installto install the custom image on the machine (and pass the config file). - Packet provides a URL for accessing the serial console, an SSH client is created to this endpoint and the stdout is fed to the
Consoleobject. - Devices are tagged with
mantlewhich is used byGC.