1818# 2. Set the following environment variables (or replace the values below):
1919# - ACR_RESOURCE_GROUP (resource group of your ACR)
2020# - AZURE_CONTAINER_REGISTRY (name of your container registry / ACR)
21+ # - CLUSTER_NAME (name of the resource to deploy to - fleet name or managed cluster name)
2122# - CLUSTER_RESOURCE_GROUP (where your cluster is deployed)
22- # - CLUSTER_NAME (name of your AKS cluster )
23+ # - CLUSTER_RESOURCE_TYPE (type of resource to deploy to, either 'Microsoft.ContainerService/fleets' or 'Microsoft.ContainerService/managedClusters' )
2324# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
2425# - DEPLOYMENT_MANIFEST_PATH (path to the manifest yaml for your deployment)
2526# - DOCKER_FILE (path to your Dockerfile)
2627# - BUILD_CONTEXT_PATH (path to the context of your Dockerfile)
2728# - NAMESPACE (namespace to deploy your application)
28- #
2929# For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions
3030# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples
3131# For more options with the actions used below please refer to https://github.com/Azure/login
4141 ACR_RESOURCE_GROUP : testAcrRG
4242 AZURE_CONTAINER_REGISTRY : testAcr
4343 CONTAINER_NAME : testContainer
44- CLUSTER_RESOURCE_GROUP : testClusterRG
4544 CLUSTER_NAME : testCluster
45+ CLUSTER_RESOURCE_GROUP : testClusterRG
46+ CLUSTER_RESOURCE_TYPE : Microsoft.ContainerService/managedClusters
4647 DEPLOYMENT_MANIFEST_PATH : ./manifests
4748 DOCKER_FILE : ./Dockerfile
4849 BUILD_CONTEXT_PATH : test
@@ -97,23 +98,25 @@ jobs:
9798
9899 # Retrieves your Azure Kubernetes Service cluster's kubeconfig file
99100 - name : Get K8s context
100- uses : azure/aks-set-context@v3
101+ uses : azure/aks-set-context@v4
101102 with :
102103 resource-group : ${{ env.CLUSTER_RESOURCE_GROUP }}
103104 cluster-name : ${{ env.CLUSTER_NAME }}
104105 admin : ' false'
105106 use-kubelogin : ' true'
107+ resource-type : ${{ env.CLUSTER_RESOURCE_TYPE }}
106108
107109 # Checks if the AKS cluster is private
108110 - name : Is private cluster
111+ if : ${{ env.CLUSTER_RESOURCE_TYPE != 'Microsoft.ContainerService/fleets' }}
109112 id : isPrivate
110113 run : |
111114 result=$(az aks show --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --query "apiServerAccessProfile.enablePrivateCluster")
112115 echo "PRIVATE_CLUSTER=$result" >> "$GITHUB_OUTPUT"
113116
114117 # Deploys application based on given manifest file
115118 - name : Deploys application
116- uses : Azure/k8s-deploy@v4
119+ uses : Azure/k8s-deploy@v5
117120 with :
118121 action : deploy
119122 manifests : ${{ env.DEPLOYMENT_MANIFEST_PATH }}
@@ -123,3 +126,4 @@ jobs:
123126 name : ${{ env.CLUSTER_NAME }}
124127 private-cluster : ${{ steps.isPrivate.outputs.PRIVATE_CLUSTER == 'true' }}
125128 namespace : ${{ env.NAMESPACE }}
129+ resource-type : ${{ env.CLUSTER_RESOURCE_TYPE }}
0 commit comments