From 76654077992b5e95658f5069dae9791326b53f6d Mon Sep 17 00:00:00 2001 From: Albin Vass Date: Tue, 10 Nov 2020 21:51:31 +0100 Subject: [PATCH] Reorganize drivers into separate documents Change-Id: I4274d8d87058a2a5c91da3e994a32d61b2f2aafe --- doc/source/aws.rst | 334 ++++++ doc/source/azure.rst | 220 ++++ doc/source/configuration.rst | 2135 +-------------------------------- doc/source/gce.rst | 259 ++++ doc/source/kubernetes.rst | 174 +++ doc/source/openshift-pods.rst | 140 +++ doc/source/openshift.rst | 181 +++ doc/source/openstack.rst | 635 ++++++++++ doc/source/static.rst | 150 +++ 9 files changed, 2133 insertions(+), 2095 deletions(-) create mode 100644 doc/source/aws.rst create mode 100644 doc/source/azure.rst create mode 100644 doc/source/gce.rst create mode 100644 doc/source/kubernetes.rst create mode 100644 doc/source/openshift-pods.rst create mode 100644 doc/source/openshift.rst create mode 100644 doc/source/openstack.rst create mode 100644 doc/source/static.rst diff --git a/doc/source/aws.rst b/doc/source/aws.rst new file mode 100644 index 000000000..432459c6e --- /dev/null +++ b/doc/source/aws.rst @@ -0,0 +1,334 @@ +.. _aws-driver: + +.. default-domain:: zuul + +AWS EC2 Driver +-------------- + +Selecting the aws driver adds the following options to the :attr:`providers` +section of the configuration. + +.. attr-overview:: + :prefix: providers.[aws] + :maxdepth: 3 + +.. attr:: providers.[aws] + :type: list + + An AWS provider's resources are partitioned into groups called `pool` + (see :attr:`providers.[aws].pools` for details), and within a pool, + the node types which are to be made available are listed + (see :attr:`providers.[aws].pools.labels` for details). + + See `Boto Configuration`_ for information on how to configure credentials + and other settings for AWS access in Nodepool's runtime environment. + + .. note:: For documentation purposes the option names are prefixed + ``providers.[aws]`` to disambiguate from other + drivers, but ``[aws]`` is not required in the + configuration (e.g. below + ``providers.[aws].pools`` refers to the ``pools`` + key in the ``providers`` section when the ``aws`` + driver is selected). + + Example: + + .. code-block:: yaml + + providers: + - name: ec2-us-west-2 + driver: aws + region-name: us-west-2 + cloud-images: + - name: debian9 + image-id: ami-09c308526d9534717 + username: admin + pools: + - name: main + max-servers: 5 + subnet-id: subnet-0123456789abcdef0 + security-group-id: sg-01234567890abcdef + labels: + - name: debian9 + cloud-image: debian9 + instance-type: t3.medium + iam-instance-profile: + arn: arn:aws:iam::123456789012:instance-profile/s3-read-only + key-name: zuul + tags: + key1: value1 + - name: debian9-large + cloud-image: debian9 + instance-type: t3.large + key-name: zuul + tags: + key1: value1 + key2: value2 + + .. attr:: name + :required: + + A unique name for this provider configuration. + + .. attr:: region-name + :required: + + Name of the `AWS region`_ to interact with. + + .. attr:: profile-name + + The AWS credentials profile to load for this provider. If unspecified the + `boto3` library will select a profile. + + See `Boto Configuration`_ for more information. + + .. attr:: boot-timeout + :type: int seconds + :default: 60 + + 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. + + .. attr:: launch-retries + :default: 3 + + The number of times to retry launching a node before considering + the job failed. + + .. attr:: cloud-images + :type: list + + Each entry in this section must refer to an entry in the + :attr:`labels` section. + + .. code-block:: yaml + + cloud-images: + - name: ubuntu1804 + image-id: ami-082fd9a18128c9e8c + username: ubuntu + - name: ubuntu1804-by-filters + image-filters: + - name: name + values: + - named-ami + username: ubuntu + - name: my-custom-win2k3 + connection-type: winrm + username: admin + + Each entry is a dictionary with the following keys + + .. attr:: name + :type: string + :required: + + Identifier to refer this cloud-image from :attr:`providers.[aws].pools.labels` section. + Since this name appears elsewhere in the nodepool configuration file, + you may want to use your own descriptive name here and use + ``image-id`` to specify the cloud image so that if + the image id changes on the cloud, the impact to your Nodepool + configuration will be minimal. However, if ``image-id`` is not + provided, this is assumed to be the image id in the cloud. + + .. attr:: image-id + :type: str + + If this is provided, it is used to select the image from the cloud + provider by ID. + + .. attr:: image-filters + :type: list + + If provided, this is used to select an AMI by filters. If the filters + provided match more than one image, the most recent will be returned. + `image-filters` are not valid if `image-id` is also specified. + + Each entry is a dictionary with the following keys + + .. attr:: name + :type: str + :required: + + The filter name. See `Boto describe images`_ for a list of valid filters. + + .. attr:: values + :type: list + :required: + + A list of str values to filter on + + .. attr:: username + :type: str + + The username that a consumer should use when connecting to the node. + + .. attr:: python-path + :type: str + :default: auto + + 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. + + .. attr:: connection-type + :type: str + + The connection type that a consumer should use when connecting to the + node. For most images this is not necessary. However when creating + Windows images this could be 'winrm' to enable access via ansible. + + .. attr:: connection-port + :type: int + :default: 22/ 5986 + + 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. + + .. attr:: pools + :type: list + + A pool defines a group of resources from an AWS 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. + + .. attr:: name + :required: + + A unique name within the provider for this pool of resources. + + .. attr:: node-attributes + :type: dict + + A dictionary of key-value pairs that will be stored with the node data + in ZooKeeper. The keys and values can be any arbitrary string. + + .. attr:: subnet-id + + If provided, specifies the subnet to assign to the primary network + interface of nodes. + + .. attr:: security-group-id + + If provided, specifies the security group ID to assign to the primary + network interface of nodes. + + .. attr:: public-ip-address + :type: bool + :default: True + + Specify if a public ip address shall be attached to nodes. + + .. attr:: host-key-checking + :type: bool + :default: True + + 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. + + .. attr:: 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. + + .. code-block:: yaml + + labels: + - name: bionic + instance-type: m5a.large + + Each entry is a dictionary with the following keys + + .. attr:: name + :type: str + :required: + + Identifier to refer this label. + Nodepool will use this to set the name of the instance unless + the name is specified as a tag. + + .. attr:: cloud-image + :type: str + :required: + + 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. See :attr:`providers.[aws].cloud-images`. + + .. attr:: ebs-optimized + :type: bool + :default: False + + Indicates whether EBS optimization + (additional, dedicated throughput between Amazon EC2 and Amazon EBS,) + has been enabled for the instance. + + .. attr:: instance-type + :type: str + :required: + + Name of the flavor to use. + + .. attr:: iam-instance-profile + :type: dict + + Used to attach an iam instance profile. + Useful for giving access to services without needing any secrets. + + .. attr:: name + + Name of the instance profile. + Mutually exclusive with :attr:`providers.[aws].pools.labels.iam-instance-profile.arn` + + .. attr:: arn + + ARN identifier of the profile. + Mutually exclusive with :attr:`providers.[aws].pools.labels.iam-instance-profile.name` + + .. attr:: key-name + :type: string + :required: + + The name of a keypair that will be used when + booting each server. + + .. attr:: volume-type + :type: string + + If given, the root `EBS volume type`_ + + .. attr:: volume-size + :type: int + + If given, the size of the root EBS volume, in GiB. + + .. attr:: userdata + :type: str + :default: None + + A string of userdata for a node. Example usage is to install + cloud-init package on image which will apply the userdata. + Additional info about options in cloud-config: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html + + .. attr:: tags + :type: dict + :default: None + + A dictionary of tags to add to the EC2 instances + +.. _`EBS volume type`: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html +.. _`AWS region`: https://docs.aws.amazon.com/general/latest/gr/rande.html +.. _`Boto configuration`: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html +.. _`Boto describe images`: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_images diff --git a/doc/source/azure.rst b/doc/source/azure.rst new file mode 100644 index 000000000..a25fb67e7 --- /dev/null +++ b/doc/source/azure.rst @@ -0,0 +1,220 @@ +.. _azure-driver: + +.. default-domain:: zuul + +Azure Compute Driver +-------------------- + +Selecting the azure driver adds the following options to the :attr:`providers` +section of the configuration. + +.. attr-overview:: + :prefix: providers.[azure] + :maxdepth: 3 + +.. attr:: 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: + + .. code-block:: yaml + + providers: + - name: azure-central-us + driver: azure + zuul-public-key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAA... + resource-group-location: centralus + location: centralus + resource-group: ZuulCIDev + auth-path: /Users/grhayes/.azure/nodepoolCreds.json + subnet-id: /subscriptions//resourceGroups/ZuulCI/providers/Microsoft.Network/virtualNetworks/NodePool/subnets/default + cloud-images: + - name: bionic + username: zuul + 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 + tags: + department: R&D + purpose: CI/CD + + .. attr:: name + :required: + + A unique name for this provider configuration. + + .. attr:: location + :required: + + Name of the Azure region to interact with. + + .. attr:: resource-group-location + :required: + + Name of the Azure region to where the home Resource Group is or should be created. + + .. attr:: auth-path + :required: + + Path to the JSON file containing the service principal credentials. + Create with the `Azure CLI`_ and the ``--sdk-auth`` flag + + .. attr:: subnet-id + :required: + + Subnet to create VMs on + + .. attr:: cloud-images + :type: list + + Each entry in this section must refer to an entry in the + :attr:`labels` section. + + .. code-block:: yaml + + 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 + + .. attr:: name + :type: string + :required: + + Identifier to refer this cloud-image from :attr:`labels` + section. Since this name appears elsewhere in the nodepool + configuration file, you may want to use your own descriptive + name here. + + .. attr:: username + :type: str + + The username that a consumer should use when connecting to the + node. + + .. attr:: image-reference + :type: dict + :required: + + .. attr:: sku + :type: str + :required: + + Image SKU + + .. attr:: publisher + :type: str + :required: + + Image Publisher + + .. attr:: offer + :type: str + :required: + + Image offers + + .. attr:: version + :type: str + :required: + + Image version + + + .. attr:: 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. + + .. attr:: name + :required: + + A unique name within the provider for this pool of resources. + + .. attr:: 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. + + .. code-block:: yaml + + labels: + - name: bionic + cloud-image: bionic + hardware-profile: + vm-size: Standard_D1_v2 + + Each entry is a dictionary with the following keys + + .. attr:: name + :type: str + :required: + + Identifier to refer this label. + + .. attr:: cloud-image + :type: str + :required: + + 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. + + .. attr:: hardware-profile + :required: + + .. attr:: 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. + + +.. _`Azure CLI`: https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest + +.. _azure.microsoft.com: https://azure.microsoft.com/en-us/global-infrastructure/services/?products=virtual-machines + diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst index a1141352c..3e13ceecd 100644 --- a/doc/source/configuration.rst +++ b/doc/source/configuration.rst @@ -18,6 +18,20 @@ and ``providers`` sections:: providers: ... +The following drivers are available. + +.. toctree:: + :maxdepth: 1 + + aws + azure + gce + kubernetes + openshift + openshift-pods + openstack + static + The following sections are available. All are required unless otherwise indicated. @@ -437,2115 +451,46 @@ Options For details on the extra options required and provided by the AWS driver, see the separate section - :attr:`providers.[aws]` - - .. value:: gce - - For details on the extra options required and provided by the - GCE driver, see the separate section - :attr:`providers.[gce]` - - .. value:: kubernetes - - For details on the extra options required and provided by the - kubernetes driver, see the separate section - :attr:`providers.[kubernetes]` - - .. value:: openshift - - For details on the extra options required and provided by the - openshift driver, see the separate section - :attr:`providers.[openshift]` - - .. value:: openshiftpods - - For details on the extra options required and provided by the - openshiftpods driver, see the separate section - :attr:`providers.[openshiftpods]` - - .. value:: openstack - - For details on the extra options required and provided by the - OpenStack driver, see the separate section - :attr:`providers.[openstack]` - - .. value:: static - - For details on the extra options required and provided by the - static driver, see the separate section - :attr:`providers.[static]` + :ref:`aws-driver` .. value:: azure For details on the extra options required and provided by the Azure driver, see the separate section - :attr:`providers.[azure]` + :ref:`azure-driver` + .. value:: gce -OpenStack Driver ----------------- + For details on the extra options required and provided by the + GCE driver, see the separate section + :ref:`gce-driver` -Selecting the OpenStack driver adds the following options to the -:attr:`providers` section of the configuration. + .. value:: kubernetes -.. attr-overview:: - :prefix: providers.[openstack] - :maxdepth: 3 + For details on the extra options required and provided by the + kubernetes driver, see the separate section + :ref:`kubernetes-driver` -.. attr:: providers.[openstack] + .. value:: openshift - Specifying the ``openstack`` driver for a provider adds the - following keys to the :attr:`providers` configuration. + For details on the extra options required and provided by the + openshift driver, see the separate section + :ref:`openshift-driver` - .. note:: For documentation purposes the option names are prefixed - ``providers.[openstack]`` to disambiguate from other - drivers, but ``[openstack]`` is not required in the - configuration (e.g. below ``providers.[openstack].cloud`` - refers to the ``cloud`` key in the ``providers`` section - when the ``openstack`` driver is selected). + .. value:: openshiftpods - An OpenStack provider's resources are partitioned into groups - called "pools" (see :attr:`providers.[openstack].pools` for details), - and within a pool, the node types which are to be made available - are listed (see :attr:`providers.[openstack].pools.labels` for - details). + For details on the extra options required and provided by the + openshiftpods driver, see the separate section + :ref:`openshift-pods-driver` - Within each OpenStack provider the available Nodepool image types - are defined (see :attr:`providers.[openstack].diskimages`). + .. value:: openstack - .. code-block:: yaml + For details on the extra options required and provided by the + OpenStack driver, see the separate section + :ref:`openstack-driver` - providers: - - name: provider1 - driver: openstack - cloud: example - region-name: 'region1' - rate: 1.0 - boot-timeout: 120 - launch-timeout: 900 - launch-retries: 3 - image-name-format: '{image_name}-{timestamp}' - hostname-format: '{label.name}-{provider.name}-{node.id}' - post-upload-hook: /usr/bin/custom-hook - diskimages: - - name: trusty - meta: - key: value - key2: value - - name: precise - - name: devstack-trusty - pools: - - name: main - max-servers: 96 - availability-zones: - - az1 - networks: - - some-network-name - security-groups: - - zuul-security-group - labels: - - name: trusty - min-ram: 8192 - diskimage: trusty - console-log: True - - name: precise - min-ram: 8192 - diskimage: precise - - name: devstack-trusty - min-ram: 8192 - diskimage: devstack-trusty - - name: provider2 - driver: openstack - cloud: example2 - region-name: 'region1' - rate: 1.0 - image-name-format: '{image_name}-{timestamp}' - hostname-format: '{label.name}-{provider.name}-{node.id}' - diskimages: - - name: precise - meta: - key: value - key2: value - pools: - - name: main - max-servers: 96 - labels: - - name: trusty - min-ram: 8192 - diskimage: trusty - - name: precise - min-ram: 8192 - diskimage: precise - - name: devstack-trusty - min-ram: 8192 - diskimage: devstack-trusty + .. value:: static - .. attr:: cloud - :type: string - :required: - - Name of a cloud configured in ``clouds.yaml``. - - The instances spawned by nodepool will inherit the default - security group of the project specified in the cloud definition - in `clouds.yaml` (if other values not specified). This means - that when working with Zuul, for example, SSH traffic (TCP/22) - must be allowed in the project's default security group for Zuul - to be able to reach instances. - - More information about the contents of `clouds.yaml` can be - found in `the openstacksdk documentation - `_. - - .. attr:: boot-timeout - :type: int seconds - :default: 60 - - 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. - - .. attr:: launch-timeout - :type: int seconds - :default: 3600 - - 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. - - .. attr:: nodepool-id - :type: string - :default: None - - *Deprecated* - - A unique string to identify which nodepool instances is using a - provider. This is useful if you want to configure production - and development instances of nodepool but share the same - provider. - - .. attr:: launch-retries - :type: int - :default: 3 - - The number of times to retry launching a server before - considering the job failed. - - .. attr:: region-name - :type: string - - The region name if the provider cloud has multiple regions. - - .. attr:: hostname-format - :type: string - :default: {label.name}-{provider.name}-{node.id} - - Hostname template to use for the spawned instance. - - .. attr:: image-name-format - :type: string - :default: {image_name}-{timestamp} - - Format for image names that are uploaded to providers. - - .. attr:: post-upload-hook - :type: string - :default: None - - 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: - - ``