-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Troy <troydenorme@hotmail.com>
- Loading branch information
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
+++ | ||
title = "Azure Pipelines" | ||
layout = "scaler" | ||
availability = "v2.3+" | ||
maintainer = "Community" | ||
description = "Scale applications based on Azure Pipelines Queues." | ||
go_file = "azure_pipelines_scaler" | ||
+++ | ||
|
||
### Trigger Specification | ||
|
||
This specification describes the `azure-pipelines` trigger for Azure Pipelines Queue. It scales based on the queue length of Azure DevOps jobs in a given Agent Pool. | ||
|
||
```yaml | ||
triggers: | ||
- type: azure-pipelines | ||
metadata: | ||
# Required: PoolId - Can be retreived by the REST API call https://dev.azure.com/{organizationName}/_apis/distributedtask/pools?poolname={agentPoolName} | ||
poolId: "1" | ||
# Optional: Azure DevOps organization URL, can use TriggerAuthentication as well | ||
organizationUrlFromEnv: "AZP_URL" | ||
# Optional: Azure DevOps Personal Access Token, can use TriggerAuthentication as well | ||
personalAccessTokenFromEnv: "AZP_TOKEN" | ||
# Optional: Target queue length | ||
targetPipelinesQueueLength: "1" # Default 1 | ||
authenticationRef: | ||
name: pipeline-trigger-auth | ||
``` | ||
**Parameter list:** | ||
- `poolId` - Id of the queue. | ||
- `organizationUrlFromEnv` - Name of the environment variable your deployment uses to get the organizationUrl string. | ||
- `personalAccessTokenFromEnv` - Name of the environment variable your deployment uses to get the personalAccessToken string. | ||
- `targetPipelinesQueueLength` - Target value for queue length passed to the scaler. Example: if one pod can handle 10 jobs, set the queue length target to 10. If the actual number of jobs in the queue is 30, the scaler scales to 3 pods. (default: 1) | ||
|
||
### Authentication Parameters | ||
|
||
As an alternative to using environment variables, you can authenticate with Azure Devops using a Personal Access Token via `TriggerAuthentication` configuration. | ||
|
||
**Personal Access Token Authentication:** | ||
|
||
- `organizationUrl` - The Azure DevOps organization | ||
- `personalAccessToken` - The Azure DevOps Personal Access Token | ||
|
||
### Example | ||
|
||
```yaml | ||
apiVersion: v1 | ||
kind: Secret | ||
type: Opaque | ||
metadata: | ||
name: pipeline-auth | ||
data: | ||
personalAccessToken: <encoded personalAccessToken> | ||
--- | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: TriggerAuthentication | ||
metadata: | ||
name: pipeline-trigger-auth | ||
namespace: default | ||
spec: | ||
secretTargetRef: | ||
- parameter: personalAccessToken | ||
name: pipeline-auth | ||
key: personalAccessToken | ||
--- | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledObject | ||
metadata: | ||
name: azure-pipelines-scaledobject | ||
namespace: default | ||
spec: | ||
scaleTargetRef: | ||
name: azdevops-deployment | ||
minReplicaCount: 1 | ||
maxReplicaCount: 5 | ||
triggers: | ||
- type: azure-pipelines | ||
metadata: | ||
poolId: "1" | ||
organizationUrlFromEnv: "AZP_URL" | ||
authenticationRef: | ||
name: pipeline-trigger-auth | ||
``` |