From cac36abf035421f8aee5ca13751aaf1f28c1970a Mon Sep 17 00:00:00 2001 From: Troy Date: Tue, 30 Mar 2021 20:47:25 +0200 Subject: [PATCH 1/5] add Azure Pipelines Scaler doc Signed-off-by: Troy --- content/docs/2.3/scalers/azure-pipelines.md | 85 +++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 content/docs/2.3/scalers/azure-pipelines.md diff --git a/content/docs/2.3/scalers/azure-pipelines.md b/content/docs/2.3/scalers/azure-pipelines.md new file mode 100644 index 000000000..5ffc84e4a --- /dev/null +++ b/content/docs/2.3/scalers/azure-pipelines.md @@ -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: +--- +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 +``` From c3a29b0c1e865854368a7a8b122221f9608df394 Mon Sep 17 00:00:00 2001 From: Troy Date: Tue, 30 Mar 2021 22:32:21 +0200 Subject: [PATCH 2/5] fix pre-commit errors Signed-off-by: Troy --- content/docs/2.3/scalers/azure-pipelines.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/content/docs/2.3/scalers/azure-pipelines.md b/content/docs/2.3/scalers/azure-pipelines.md index 5ffc84e4a..86dc9ea6e 100644 --- a/content/docs/2.3/scalers/azure-pipelines.md +++ b/content/docs/2.3/scalers/azure-pipelines.md @@ -15,10 +15,10 @@ This specification describes the `azure-pipelines` trigger for Azure Pipelines Q 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" + # 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" + organizationURLFromEnv: "AZP_URL" # Optional: Azure DevOps Personal Access Token, can use TriggerAuthentication as well personalAccessTokenFromEnv: "AZP_TOKEN" # Optional: Target queue length @@ -29,8 +29,8 @@ triggers: **Parameter list:** -- `poolId` - Id of the queue. -- `organizationUrlFromEnv` - Name of the environment variable your deployment uses to get the organizationUrl string. +- `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) @@ -40,7 +40,7 @@ As an alternative to using environment variables, you can authenticate with Azur **Personal Access Token Authentication:** -- `organizationUrl` - The Azure DevOps organization +- `organizationURL` - The Azure DevOps organization - `personalAccessToken` - The Azure DevOps Personal Access Token ### Example @@ -78,8 +78,8 @@ spec: triggers: - type: azure-pipelines metadata: - poolId: "1" - organizationUrlFromEnv: "AZP_URL" + poolID: "1" + organizationURLFromEnv: "AZP_URL" authenticationRef: name: pipeline-trigger-auth ``` From b8adc486779d7993ce8c755df422e758ad2200d9 Mon Sep 17 00:00:00 2001 From: troydn Date: Wed, 31 Mar 2021 20:43:25 +0200 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: Tom Kerkhove Signed-off-by: Troy --- content/docs/2.3/scalers/azure-pipelines.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/content/docs/2.3/scalers/azure-pipelines.md b/content/docs/2.3/scalers/azure-pipelines.md index 86dc9ea6e..7800ac720 100644 --- a/content/docs/2.3/scalers/azure-pipelines.md +++ b/content/docs/2.3/scalers/azure-pipelines.md @@ -3,13 +3,13 @@ title = "Azure Pipelines" layout = "scaler" availability = "v2.3+" maintainer = "Community" -description = "Scale applications based on Azure Pipelines Queues." +description = "Scale applications based on agent pool queues for Azure Pipelines." 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. +This specification describes the `azure-pipelines` trigger for Azure Pipelines. It scales based on the amount of pipeline runs pending in a given agent pool. ```yaml triggers: @@ -30,9 +30,10 @@ triggers: **Parameter list:** - `poolID` - Id of the queue. -- `organizationURLFromEnv` - Name of the environment variable your deployment uses to get the organizationURL string. +- `organizationURLFromEnv` - Name of the environment variable your deployment uses to get the URL for your Azure DevOps organization. - `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) +- `targetPipelinesQueueLength` - Target value for the amount of pending jobs in the queue to scale on. (default: 1) + - 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. ### Authentication Parameters @@ -40,8 +41,8 @@ As an alternative to using environment variables, you can authenticate with Azur **Personal Access Token Authentication:** -- `organizationURL` - The Azure DevOps organization -- `personalAccessToken` - The Azure DevOps Personal Access Token +- `organizationURL` - The URL of the Azure DevOps organization +- `personalAccessToken` - The Personal Access Token (PAT) for Azure DevOps ### Example From 3adba8dab194e8ed78910b4488d5894889b89720 Mon Sep 17 00:00:00 2001 From: troydn Date: Wed, 31 Mar 2021 20:43:25 +0200 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Tom Kerkhove Signed-off-by: Troy --- content/docs/2.3/scalers/azure-pipelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/2.3/scalers/azure-pipelines.md b/content/docs/2.3/scalers/azure-pipelines.md index 7800ac720..757af1190 100644 --- a/content/docs/2.3/scalers/azure-pipelines.md +++ b/content/docs/2.3/scalers/azure-pipelines.md @@ -31,7 +31,7 @@ triggers: - `poolID` - Id of the queue. - `organizationURLFromEnv` - Name of the environment variable your deployment uses to get the URL for your Azure DevOps organization. -- `personalAccessTokenFromEnv` - Name of the environment variable your deployment uses to get the personalAccessToken string. +- `personalAccessTokenFromEnv` - Name of the environment variable that provides the personal access token (PAT) for Azure DevOps. Learn more how to create on [in the official docs](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page). - `targetPipelinesQueueLength` - Target value for the amount of pending jobs in the queue to scale on. (default: 1) - 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. From 999d72d7eb73498096210577d895ee55faef2317 Mon Sep 17 00:00:00 2001 From: Troy Date: Thu, 1 Apr 2021 08:53:03 +0200 Subject: [PATCH 5/5] fix typo Signed-off-by: Troy --- content/docs/2.3/scalers/azure-pipelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/2.3/scalers/azure-pipelines.md b/content/docs/2.3/scalers/azure-pipelines.md index 757af1190..eee08631b 100644 --- a/content/docs/2.3/scalers/azure-pipelines.md +++ b/content/docs/2.3/scalers/azure-pipelines.md @@ -31,7 +31,7 @@ triggers: - `poolID` - Id of the queue. - `organizationURLFromEnv` - Name of the environment variable your deployment uses to get the URL for your Azure DevOps organization. -- `personalAccessTokenFromEnv` - Name of the environment variable that provides the personal access token (PAT) for Azure DevOps. Learn more how to create on [in the official docs](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page). +- `personalAccessTokenFromEnv` - Name of the environment variable that provides the personal access token (PAT) for Azure DevOps. Learn more about how to create one [in the official docs](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page). - `targetPipelinesQueueLength` - Target value for the amount of pending jobs in the queue to scale on. (default: 1) - 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.