Skip to content

Commit 461d5f3

Browse files
committed
added fixture changes
1 parent a45dd74 commit 461d5f3

2 files changed

Lines changed: 23 additions & 10 deletions

File tree

pkg/fixtures/workflows/github/helm/.github/workflows/azure-kubernetes-service-helm.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
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
# - CHART_PATH (path to your helm chart)
@@ -44,8 +45,9 @@ env:
4445
ACR_RESOURCE_GROUP: testAcrRG
4546
AZURE_CONTAINER_REGISTRY: testAcr
4647
CONTAINER_NAME: testContainer
47-
CLUSTER_RESOURCE_GROUP: testClusterRG
4848
CLUSTER_NAME: testCluster
49+
CLUSTER_RESOURCE_GROUP: testClusterRG
50+
CLUSTER_RESOURCE_TYPE: Microsoft.ContainerService/managedClusters
4951
DOCKER_FILE: ./Dockerfile
5052
BUILD_CONTEXT_PATH: test
5153
CHART_PATH: testPath
@@ -102,16 +104,18 @@ jobs:
102104

103105
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
104106
- name: Get K8s context
105-
uses: azure/aks-set-context@v3
107+
uses: azure/aks-set-context@v4.0.2
106108
with:
107109
resource-group: ${{ env.CLUSTER_RESOURCE_GROUP }}
108110
cluster-name: ${{ env.CLUSTER_NAME }}
111+
resource-type: ${{ env.CLUSTER_RESOURCE_TYPE }}
109112
admin: "false"
110113
use-kubelogin: "true"
111114

112115
# Checks if the AKS cluster is private
113116
- name: Is private cluster
114117
id: isPrivate
118+
if: ${{ env.CLUSTER_RESOURCE_TYPE != 'Microsoft.ContainerService/fleets' }}
115119
run: |
116120
result=$(az aks show --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --query "apiServerAccessProfile.enablePrivateCluster")
117121
echo "PRIVATE_CLUSTER=$result" >> "$GITHUB_OUTPUT"
@@ -124,11 +128,16 @@ jobs:
124128
result=$(az aks command result --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --command-id $command_id)
125129
echo "Helm upgrade result: $result"
126130
exitCode=$(az aks command result --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --command-id $command_id --query exitCode -o tsv)
127-
131+
128132
if [ $exitCode -ne 0 ]; then
129133
exit $exitCode
130134
fi
131135
132136
- name: Deploy application on public cluster
133137
if: steps.isPrivate.outputs.PRIVATE_CLUSTER != 'true'
134-
run: helm upgrade --wait -i -f ${{ env.CHART_OVERRIDE_PATH }} --set ${{ env.CHART_OVERRIDES }} --set image.tag=${{ github.sha }} automated-deployment ${{ env.CHART_PATH }} --namespace ${{ env.NAMESPACE }} --create-namespace
138+
run: |
139+
if [ "${{ env.CLUSTER_RESOURCE_TYPE }}" == "Microsoft.ContainerService/fleets" ]; then
140+
helm upgrade -i -f ${{ env.CHART_OVERRIDE_PATH }} --set ${{ env.CHART_OVERRIDES }} --set image.tag=${{ github.sha }} automated-deployment ${{ env.CHART_PATH }} --namespace ${{ env.NAMESPACE }}
141+
else
142+
helm upgrade --wait -i -f ${{ env.CHART_OVERRIDE_PATH }} --set ${{ env.CHART_OVERRIDES }} --set image.tag=${{ github.sha }} automated-deployment ${{ env.CHART_PATH }} --namespace ${{ env.NAMESPACE }} --create-namespace
143+
fi

pkg/fixtures/workflows/github/kustomize/.github/workflows/azure-kubernetes-service-kustomize.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
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)
@@ -45,8 +46,9 @@ env:
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

Comments
 (0)