2020# - ACR_RESOURCE_GROUP (resource group of your ACR)
2121# - AZURE_CONTAINER_REGISTRY (name of your container registry / ACR)
2222# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
23+ # - CLUSTER_NAME (name of the resource to deploy to - fleet name or managed cluster name)
2324# - CLUSTER_RESOURCE_GROUP (where your cluster is deployed)
24- # - CLUSTER_NAME (name of your AKS cluster )
25+ # - CLUSTER_RESOURCE_TYPE (type of resource to deploy to, either 'Microsoft.ContainerService/fleets' or 'Microsoft.ContainerService/managedCluster' )
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)
4546 ACR_RESOURCE_GROUP : testAcrRG
4647 AZURE_CONTAINER_REGISTRY : testAcr
4748 CONTAINER_NAME : testContainer
48- CLUSTER_RESOURCE_GROUP : testClusterRG
4949 CLUSTER_NAME : testCluster
50+ CLUSTER_RESOURCE_GROUP : testClusterRG
51+ CLUSTER_RESOURCE_TYPE : Microsoft.ContainerService/managedClusters
5052 KUSTOMIZE_PATH : ./overlays/production
5153 DOCKER_FILE : ./Dockerfile
5254 BUILD_CONTEXT_PATH : test
@@ -101,12 +103,13 @@ jobs:
101103
102104 # Retrieves your Azure Kubernetes Service cluster's kubeconfig file
103105 - name : Get K8s context
104- uses : azure/aks-set-context@v3
106+ uses : azure/aks-set-context@v4.0.2
105107 with :
106108 resource-group : ${{ env.CLUSTER_RESOURCE_GROUP }}
107109 cluster-name : ${{ env.CLUSTER_NAME }}
108110 admin : ' false'
109111 use-kubelogin : ' true'
112+ resource-type : ${{ env.CLUSTER_RESOURCE_TYPE }}
110113
111114 # Runs Kustomize to create manifest files
112115 - name : Bake deployment
@@ -116,17 +119,17 @@ jobs:
116119 kustomizationPath : ${{ env.KUSTOMIZE_PATH }}
117120 kubectl-version : latest
118121 id : bake
119-
120122 # Checks if the AKS cluster is private
121123 - name : Is private cluster
124+ if : ${{ env.CLUSTER_RESOURCE_TYPE != 'Microsoft.ContainerService/fleets' }}
122125 id : isPrivate
123126 run : |
124127 result=$(az aks show --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --query "apiServerAccessProfile.enablePrivateCluster")
125128 echo "PRIVATE_CLUSTER=$result" >> "$GITHUB_OUTPUT"
126129
127130 # Deploys application based on manifest files from previous step
128131 - name : Deploy application
129- uses : Azure/k8s-deploy@v4
132+ uses : Azure/k8s-deploy@v5.0.1
130133 with :
131134 action : deploy
132135 manifests : ${{ steps.bake.outputs.manifestsBundle }}
@@ -136,4 +139,5 @@ jobs:
136139 name : ${{ env.CLUSTER_NAME }}
137140 private-cluster : ${{ steps.isPrivate.outputs.PRIVATE_CLUSTER == 'true' }}
138141 namespace : ${{ env.NAMESPACE }}
142+ resource-type : ${{ env.CLUSTER_RESOURCE_TYPE }}
139143
0 commit comments