From ab1a1a7ae29c687bbb1fd46f86a29d5d651fe6ba Mon Sep 17 00:00:00 2001 From: Suneha Bose <123775811+bosesuneha@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:58:52 -0700 Subject: [PATCH] Simplify namespace creation for helm deployment (#365) --- .../helm/charts/templates/namespace.yaml | 13 ------------- .../workflows/azure-kubernetes-service-helm.yml | 4 ++-- test/check_windows_helm.ps1 | 2 -- 3 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 template/deployments/helm/charts/templates/namespace.yaml diff --git a/template/deployments/helm/charts/templates/namespace.yaml b/template/deployments/helm/charts/templates/namespace.yaml deleted file mode 100644 index 8c23da07..00000000 --- a/template/deployments/helm/charts/templates/namespace.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{- if ne .Values.namespace "default" }} -kind: Namespace -apiVersion: v1 -metadata: - name: {{ .Values.namespace }} - labels: - {{- include "{{APPNAME}}.labels" . | nindent 4 }} - openservicemesh.io/monitored-by: osm - kubernetes.azure.com/generator: {{GENERATORLABEL}} - annotations: - openservicemesh.io/sidecar-injection: enabled -{{- end }} - diff --git a/template/workflows/helm/.github/workflows/azure-kubernetes-service-helm.yml b/template/workflows/helm/.github/workflows/azure-kubernetes-service-helm.yml index 23cf13e1..9695ac8a 100644 --- a/template/workflows/helm/.github/workflows/azure-kubernetes-service-helm.yml +++ b/template/workflows/helm/.github/workflows/azure-kubernetes-service-helm.yml @@ -120,7 +120,7 @@ jobs: - name: Deploy application on private cluster if : steps.isPrivate.outputs.PRIVATE_CLUSTER == 'true' run: | - command_id=$(az aks command invoke --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --command "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}} --timeout 240s" --file . --query id -o tsv) + command_id=$(az aks command invoke --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --command "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 --timeout 240s" --file . --query id -o tsv) result=$(az aks command result --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --command-id $command_id) echo "Helm upgrade result: $result" exitCode=$(az aks command result --resource-group ${{ env.CLUSTER_RESOURCE_GROUP }} --name ${{ env.CLUSTER_NAME }} --command-id $command_id --query exitCode -o tsv) @@ -131,5 +131,5 @@ jobs: - name: Deploy application on public cluster if : steps.isPrivate.outputs.PRIVATE_CLUSTER == '' - 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 }} + 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 `}} diff --git a/test/check_windows_helm.ps1 b/test/check_windows_helm.ps1 index c1ff133c..6002365f 100644 --- a/test/check_windows_helm.ps1 +++ b/test/check_windows_helm.ps1 @@ -9,8 +9,6 @@ $filesExist=$filesExist -and (Test-Path -Path ./charts/templates/deployment.yaml echo "$file exists: $filesExist" $filesExist=$filesExist -and (Test-Path -Path ./charts/templates/service.yaml -PathType Leaf) echo "$file exists: $filesExist" -$filesExist=$filesExist -and (Test-Path -Path ./charts/templates/namespace.yaml -PathType Leaf) -echo "$file exists: $filesExist" $filesExist=$filesExist -and (Test-Path -Path ./charts/templates/_helpers.tpl -PathType Leaf) echo "$file exists: $filesExist" $filesExist=$filesExist -and (Test-Path -Path ./charts/values.yaml -PathType Leaf)