Skip to content

Commit

Permalink
Release AKS cluster back to free pool
Browse files Browse the repository at this point in the history
  • Loading branch information
jananivMS committed May 24, 2020
1 parent eeea901 commit 3108a40
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,12 @@ steps:
echo AKS clusters unavailable
exit 1
fi
echo 'az aks get-credentials -g $(AKS_CLUSTER_RG) -n $clustername)'
echo $clustername
echo "##vso[task.setvariable variable=clustername]$clustername"
echo 'az aks get-credentials -g $(AKS_CLUSTER_RG) -n $clustername'
az aks get-credentials -g $(AKS_CLUSTER_RG) -n $clustername
# Set tags to not available for the selected cluster
# Set tags to not available for the selected cluster so it doesn't get used
az resource tag --tags 'freeforpipeline=false' -g $(AKS_CLUSTER_RG) -n $clustername --resource-type Microsoft.ContainerService/managedClusters
workingDirectory: '$(System.DefaultWorkingDirectory)'
failOnStandardError: true
displayName: Deploy to AKS - Find available AKS cluster and connect to it
Expand Down Expand Up @@ -247,6 +250,18 @@ steps:
kubectl logs -n $(OPERATOR_NAMESPACE) deployment/azureoperator-controller-manager -c manager
## TODO: Add a Health check task to ensure operator deployed to AKS works

- task: AzureCLI@2
inputs:
azureSubscription: 'ASO Subscription'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
# Set tags to available for the selected cluster to put it back into the free pool
az resource tag --tags 'freeforpipeline=true' -g $(AKS_CLUSTER_RG) -n $clustername --resource-type Microsoft.ContainerService/managedClusters
workingDirectory: '$(System.DefaultWorkingDirectory)'
failOnStandardError: true
displayName: Deploy to AKS - Clean up deploument and release cluster back to free pool

- task: Docker@2
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
Expand Down

0 comments on commit 3108a40

Please sign in to comment.