{
  "$id": "https://firefox-ci-tc.services.mozilla.com/schemas/worker-manager/v1/config-azure.json#",
  "$schema": "https://firefox-ci-tc.services.mozilla.com/schemas/common/metaschema.json#",
  "additionalProperties": false,
  "description": "'The config section of a workertype using the Azure provider must match this schema.\nAzure provider supports two deployment modes: traditional resource-by-resource deployment and ARM template deployment.\nSee azure-deployment-resources.json# for traditional VM deployment or azure-arm-templates.json# for ARM template deployment.'\n",
  "properties": {
    "launchConfigs": {
      "description": "An array of possible variations of workers for this pool. Each launch configuration must use one of two deployment modes:\n\n**Traditional Resource Deployment (azure-deployment-resources.json#):**\nProperties are passed to the [virtual machine creation API](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate).\nworker-manager automatically overrides: `osProfile.adminPassword`, `osProfile.computerName`, `osProfile.customData`, `networkProfile.networkInterfaces`.\nYou must provide required fields like `location`, `subnetId`, `hardwareProfile`, and `storageProfile`.\n\n**ARM Template Deployment (azure-arm-templates.json#):**\nProperties are passed to the [Azure Deployments API](https://docs.microsoft.com/en-us/rest/api/resources/deployments/createorupdate).\nworker-manager automatically generates and passes these parameters:\n  `location`, `adminUsername`, `adminPassword`, `computerName`, `customData`, `vmName`, `tags`.\nYour ARM template must accept and use these parameters. You must specify `location` parameter to determine the worker group.\nDeployments are created in the default resource group from providerConfig, unless overridden with `armDeploymentResourceGroup`.\nIf a custom resource group is specified and doesn't exist, it will be created automatically.\n",
      "items": {
        "allOf": [
          {
            "additionalProperties": true,
            "properties": {
              "capacityPerInstance": {
                "description": "Deprecated - please use `workerManager.capacityPerInstance` instead",
                "minimum": 1,
                "title": "Capacity Per Instance (Deprecated)",
                "type": "integer"
              },
              "tags": {
                "additionalProperties": true,
                "description": "Arbitrary key-value pairs for Azure resource tags",
                "type": "object"
              },
              "workerConfig": {
                "additionalProperties": true,
                "description": "This value is supplied unchanged as the `workerConfig` property of the `taskcluster` instance metadata attribute.\nThe expectation is that the worker will merge this information with configuration from other sources,\nand this is precisely what [worker-runner](https://docs.taskcluster.net/docs/reference/workers/worker-runner) does.\nThis property must not be used for secret configuration, as it is visible both in the worker pool configuration and in the worker instance's metadata.\nInstead, put secret configuration in the [secrets service](https://docs.taskcluster.net/docs/reference/workers/worker-runner).\n",
                "title": "Worker Config",
                "type": "object"
              },
              "workerManager": {
                "additionalProperties": false,
                "description": "Worker Manager's own configuration settings per launch configuration.\nThe other properties of the launch configuration section are passed directly through to\nAzure APIs, whereas this section is interpreted directly by Worker Manager.",
                "properties": {
                  "capacityPerInstance": {
                    "description": "The number of tasks a single worker of this type can run at any given time.",
                    "minimum": 1,
                    "title": "Capacity Per Instance",
                    "type": "integer"
                  },
                  "ignoreFailedProvisioningStates": {
                    "description": "A list of provisioning state codes (see the [Azure documentation](https://docs.microsoft.com/en-us/azure/virtual-machines/states-lifecycle)) that\nshould be ignored and treated as success if the VM is running.  The most common choice is `[\"OSProvisioningTimedOut\"]`, which ignores failure\nto start the Azure VM Agent.  This is appropriate on systems that do not or cannot run the agent.\n",
                    "items": {
                      "type": "string"
                    },
                    "title": "Ignore failed provisioningStates",
                    "type": "array",
                    "uniqueItems": true
                  },
                  "initialWeight": {
                    "description": "The initial weight of the launch configuration at the provisionining time.\nLaunch configurations with higher weight will be more likely to be selected.\nIf not specified, the default weight is `1`.\nSpecifying a weight of `0` will prevent the launch configuration from being selected.\nWhena all launch configurations have same weight, they will be selected in a round-robin fashion.",
                    "maximum": 1,
                    "minimum": 0,
                    "title": "Initial Weight",
                    "type": "number"
                  },
                  "keepDeployment": {
                    "description": "Leave ARM deployment records in place instead of deleting them after success or during teardown.\nUseful only for debugging template issues. Azure keeps a limited deployment history per resource group,\nso enabling this may eventually block new deployments once the limit is reached.\n",
                    "title": "Keep ARM deployments",
                    "type": "boolean"
                  },
                  "launchConfigId": {
                    "description": "The ID of the launch configuration. Must be unique forever within the worker pool.\nAny change to the launch configuration (except `workerManager` fields) must use a new ID\nto ensure proper tracking of configuration metrics.\nIf not provided, worker-manager will generate a unique ID.\nMust be between 1 and 38 characters long and contain only alphanumeric\ncharacters, dashes, and underscores.\n",
                    "maxLength": 38,
                    "minLength": 1,
                    "pattern": "^([a-zA-Z0-9-_]*)$",
                    "title": "Launch Configuration ID",
                    "type": "string"
                  },
                  "maxCapacity": {
                    "description": "The maximum capacity of workers of this type (launch configuration)\nthat can be running at any given time.\nThis value is independent from worker pool's `maxCapacity`, which\ncontrols total number of workers for the whole pool.\nEffective max capacity for the launch config would be\n`min(workerPool.maxCapacity, launchConfigMaxCapacity)`.",
                    "minimum": 0,
                    "title": "Max Capacity",
                    "type": "integer"
                  },
                  "publicIp": {
                    "description": "If `true`, Worker Manager will request a public IPv4 address for the worker.\nThis is set to `false` by default. It is typically only needed for Windows\nworkers that should allow incoming RDP connections from the public internet.\n\nNote: this is only useful for the single resources deployment. For ARM template\ndeployments you can use template parameters to achieve same results.\n",
                    "title": "Public IP",
                    "type": "boolean"
                  }
                },
                "title": "Worker Manager Config",
                "type": "object"
              }
            },
            "required": [
              "workerConfig"
            ],
            "type": "object"
          },
          {
            "oneOf": [
              {
                "$ref": "azure-deployment-resources.json#"
              },
              {
                "$ref": "azure-arm-templates.json#"
              }
            ]
          }
        ]
      },
      "title": "Choices",
      "type": "array",
      "uniqueItems": true
    },
    "lifecycle": {
      "$ref": "worker-lifecycle.json#"
    },
    "maxCapacity": {
      "description": "The maximum amount of capacity that worker-manager should make\navailable at any given time for the entire workerpool.\n",
      "minimum": 0,
      "title": "Maximum Capacity",
      "type": "integer"
    },
    "minCapacity": {
      "description": "The minimum amount of capacity that worker-manager should make\navailable at any given time for the entire workerpool.\n",
      "minimum": 0,
      "title": "Minimum Capacity",
      "type": "integer"
    },
    "scalingRatio": {
      "description": "The scaling ratio is a ratio of worker capacity to pending tasks - a ratio\nof 1.0 means that 1 capacity will be added for each pending task\n",
      "maximum": 1,
      "minimum": 0,
      "title": "Scaling Ratio",
      "type": "number"
    }
  },
  "required": [
    "minCapacity",
    "maxCapacity",
    "launchConfigs"
  ],
  "title": "Azure Provider Config",
  "type": "object"
}