Azure Compute Driver

Before using the Azure driver, make sure you have created a service principal and saved the credential information in a JSON file. Follow the instructions at Azure CLI and use the --sdk-auth flag:

az ad sp create-for-rbac --name nodepool --sdk-auth

You must also have created a network for Nodepool to use. Be sure to enable IPv6 on the network if you plan to use it.

Selecting the azure driver adds the following options to the providers section of the configuration.

providers.[azure]
Type: list

An Azure provider’s resources are partitioned into groups called pool, and within a pool, the node types which are to be made available are listed

Note

For documentation purposes the option names are prefixed providers.[azure] to disambiguate from other drivers, but [azure] is not required in the configuration (e.g. below providers.[azure].pools refers to the pools key in the providers section when the azure driver is selected).

Example:

providers:
  - name: azure-central-us
    driver: azure
    location: centralus
    resource-group: nodepool
    resource-group-location: centralus
    auth-path: /path/to/nodepoolCreds.json
    network: nodepool
    cloud-images:
      - name: bionic
        username: zuul
        key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAA...
        image-reference:
          sku: 18.04-LTS
          publisher: Canonical
          version: latest
          offer: UbuntuServer
    pools:
      - name: main
        max-servers: 10
        labels:
          - name: bionic
            cloud-image: bionic
            hardware-profile:
              vm-size: Standard_D1_v2
providers.[azure].name (required)

A unique name for this provider configuration.

providers.[azure].location (required)

Name of the Azure region to interact with.

providers.[azure].resource-group (required)

Name of the Resource Group in which to place the Nodepool nodes.

providers.[azure].resource-group-location (required)

Name of the Azure region where the home Resource Group is or should be created.

providers.[azure].auth-path (required)

Path to the JSON file containing the service principal credentials. Create with the Azure CLI and the --sdk-auth flag

providers.[azure].network (required)

Network upon which to create VMs. This can either be a string, in which case it must be the name of a network in the provider’s resource group and Nodepool will use the subnet named default, or it can be a dictionary with these keys:

providers.[azure].network.resource-group
Default: The provider's resource group

The resource group containing the network.

providers.[azure].network.network (required)

The name of the network.

providers.[azure].network.subnet
Default: default

The name of the subnet within the network.

providers.[azure].ipv4
Type: bool

Whether to enable IPv4 networking. Defaults to true unless ipv6 is enabled. Enabling this will attach a private IP address.

providers.[azure].ipv6
Default: false
Type: bool

Whether to enable IPv6 networking. Enabling this will attach a private IP address.

providers.[azure].public-ipv4
Type: bool

Whether to attach a public IPv4 address to instances. Defaults to true, but will change to false in a future release. Implies ipv4.

providers.[azure].public-ipv6
Default: false
Type: bool

Whether to attach a public IPv4 address to instances. Defaults to true, but will change to false in a future release. Implies ipv6.

providers.[azure].use-internal-ip
Default: false
Type: bool

If a public IP is attached but Nodepool should prefer the private IP, set this to true.

providers.[azure].host-key-checking
Default: true
Type: bool

Specify custom behavior of validation of SSH host keys. When set to False, nodepool-launcher will not ssh-keyscan nodes after they are booted. This might be needed if nodepool-launcher and the nodes it launches are on different networks. The default value is true.

providers.[azure].rate
Default: 1.0
Type: float seconds

In seconds, amount to wait between operations on the provider.

providers.[azure].boot-timeout
Default: 120
Type: int seconds

Once an instance is active, how long to try connecting to the image via SSH. If the timeout is exceeded, the node launch is aborted and the instance deleted.

providers.[azure].launch-timeout
Default: 3600
Type: int seconds

The time to wait from issuing the command to create a new instance until that instance is reported as “active”. If the timeout is exceeded, the node launch is aborted and the instance deleted.

providers.[azure].launch-retries
Default: 3
Type: int

The number of times to retry launching a server before considering the request failed.

providers.[azure].post-upload-hook
Default: None
Type: string

Filename of an optional script that can be called after an image has been uploaded to a provider but before it is taken into use. This is useful to perform last minute validation tests before an image is really used for build nodes. The script will be called as follows:

<SCRIPT> <PROVIDER> <EXTERNAL_IMAGE_ID> <LOCAL_IMAGE_FILENAME>

If the script returns with result code 0 it is treated as successful otherwise it is treated as failed and the image gets deleted.

providers.[azure].cloud-images
Type: list

Each entry in this section must refer to an entry in the labels section.

cloud-images:
  - name: bionic
    username: zuul
    image-reference:
      sku: 18.04-LTS
      publisher: Canonical
      version: latest
      offer: UbuntuServer
  - name: windows-server-2016
    username: zuul
    image-reference:
       sku: 2016-Datacenter
       publisher: MicrosoftWindowsServer
       version: latest
       offer: WindowsServer

Each entry is a dictionary with the following keys

providers.[azure].cloud-images.name (required)
Type: string

Identifier to refer this cloud-image from labels section. Since this name appears elsewhere in the nodepool configuration file, you may want to use your own descriptive name here.

providers.[azure].cloud-images.username (required)
Type: str

The username that should be used when connecting to the node.

providers.[azure].cloud-images.key
Type: str

The SSH public key that should be installed on the node.

providers.[azure].cloud-images.connection-type
Type: string

The connection type that a consumer should use when connecting to the node. For most diskimages this is not necessary. However when creating Windows images this could be winrm to enable access via ansible.

providers.[azure].cloud-images.connection-port
Default: 22 / 5986
Type: int

The port that a consumer should use when connecting to the node. For most diskimages this is not necessary. This defaults to 22 for ssh and 5986 for winrm.

providers.[azure].cloud-images.python-path
Default: auto
Type: str

The path of the default python interpreter. Used by Zuul to set ansible_python_interpreter. The special value auto will direct Zuul to use inbuilt Ansible logic to select the interpreter on Ansible >=2.8, and default to /usr/bin/python2 for earlier versions.

providers.[azure].cloud-images.image-reference (required)
Type: dict
providers.[azure].cloud-images.image-reference.sku (required)
Type: str

Image SKU

providers.[azure].cloud-images.image-reference.publisher (required)
Type: str

Image Publisher

providers.[azure].cloud-images.image-reference.offer (required)
Type: str

Image offers

providers.[azure].cloud-images.image-reference.version (required)
Type: str

Image version

providers.[azure].diskimages
Type: list

Each entry in a provider’s diskimages section must correspond to an entry in diskimages. Such an entry indicates that the corresponding diskimage should be uploaded for use in this provider. Additionally, any nodes that are created using the uploaded image will have the associated attributes (such as flavor or metadata).

If an image is removed from this section, any previously uploaded images will be deleted from the provider.

diskimages:
  - name: bionic
    pause: False
  - name: windows
    connection-type: winrm
    connection-port: 5986

Each entry is a dictionary with the following keys

providers.[azure].diskimages.name (required)
Type: string

Identifier to refer this image from providers.[azure].pools.labels and diskimages sections.

providers.[azure].diskimages.pause
Default: False
Type: bool

When set to True, nodepool-builder will not upload the image to the provider.

providers.[azure].diskimages.username
Type: str

The username that should be used when connecting to the node.

providers.[azure].diskimages.key
Type: str

The SSH public key that should be installed on the node.

providers.[azure].diskimages.connection-type
Type: string

The connection type that a consumer should use when connecting to the node. For most diskimages this is not necessary. However when creating Windows images this could be winrm to enable access via ansible.

providers.[azure].diskimages.connection-port
Default: 22 / 5986
Type: int

The port that a consumer should use when connecting to the node. For most diskimages this is not necessary. This defaults to 22 for ssh and 5986 for winrm.

providers.[azure].diskimages.python-path
Default: auto
Type: str

The path of the default python interpreter. Used by Zuul to set ansible_python_interpreter. The special value auto will direct Zuul to use inbuilt Ansible logic to select the interpreter on Ansible >=2.8, and default to /usr/bin/python2 for earlier versions.

providers.[azure].pools
Type: list

A pool defines a group of resources from an Azure provider. Each pool has a maximum number of nodes which can be launched from it, along with a number of cloud-related attributes used when launching nodes.

providers.[azure].pools.name (required)

A unique name within the provider for this pool of resources.

providers.[azure].pools.ipv4
Type: bool

Whether to enable IPv4 networking. Defaults to true unless ipv6 is enabled. Enabling this will attach a private IP address.

providers.[azure].pools.ipv6
Default: false
Type: bool

Whether to enable IPv6 networking. Enabling this will attach a private IP address.

providers.[azure].pools.public-ipv4
Type: bool

Whether to attach a public IPv4 address to instances. Defaults to true, but will change to false in a future release. Implies ipv4.

providers.[azure].pools.public-ipv6
Default: false
Type: bool

Whether to attach a public IPv4 address to instances. Defaults to true, but will change to false in a future release. Implies ipv6.

providers.[azure].pools.use-internal-ip
Default: false
Type: bool

If a public IP is attached but Nodepool should prefer the private IP, set this to true.

providers.[azure].pools.host-key-checking
Default: true
Type: bool

Specify custom behavior of validation of SSH host keys. When set to False, nodepool-launcher will not ssh-keyscan nodes after they are booted. This might be needed if nodepool-launcher and the nodes it launches are on different networks. The default value is true.

providers.[azure].pools.labels
Type: list

Each entry in a pool’s labels section indicates that the corresponding label is available for use in this pool. When creating nodes for a label, the flavor-related attributes in that label’s section will be used.

labels:
  - name: bionic
    cloud-image: bionic
    hardware-profile:
      vm-size: Standard_D1_v2

Each entry is a dictionary with the following keys:

providers.[azure].pools.labels.name (required)
Type: str

Identifier for this label.

providers.[azure].pools.labels.cloud-image (required)
Type: str

Refers to the name of an externally managed image in the cloud that already exists on the provider. The value of cloud-image should match the name of a previously configured entry from the cloud-images section of the provider.

providers.[azure].pools.labels.diskimage (required)
Type: str

Refers to provider’s diskimages, see providers.[azure].diskimages. Mutually exclusive with providers.[azure].pools.labels.cloud-image

providers.[azure].pools.labels.hardware-profile (required)
providers.[azure].pools.labels.hardware-profile.vm-size (required)
Type: str

VM Size of the VMs to use in Azure. See the VM size list on azure.microsoft.com for the list of sizes availabile in each region.