From ac1b088413915f8b31359bdad259ec04ba008f5c Mon Sep 17 00:00:00 2001 From: Paul Yu Date: Mon, 29 Jul 2024 19:44:17 -0700 Subject: [PATCH] chore: adding check for kubelogin to resolve #164 --- azd-hooks/predeploy.ps1 | 7 ++++++- azd-hooks/predeploy.sh | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/azd-hooks/predeploy.ps1 b/azd-hooks/predeploy.ps1 index 1a590e31..368f9d9c 100644 --- a/azd-hooks/predeploy.ps1 +++ b/azd-hooks/predeploy.ps1 @@ -1,6 +1,11 @@ #!/usr/bin/env pwsh -az aks get-credentials --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_AKS_CLUSTER_NAME} --overwrite-existing +########################################################## +# Check kubelogin and install if not exists +########################################################## +if (-not (Get-Command kubelogin -ErrorAction SilentlyContinue)) { + az aks install-cli +} ########################################################### # Create the custom-values.yaml file diff --git a/azd-hooks/predeploy.sh b/azd-hooks/predeploy.sh index 01384c5c..8ac5b2a4 100755 --- a/azd-hooks/predeploy.sh +++ b/azd-hooks/predeploy.sh @@ -1,6 +1,12 @@ #!/bin/bash -az aks get-credentials --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_AKS_CLUSTER_NAME} --overwrite-existing +########################################################## +# Check kubelogin and install if not exists +########################################################## +if ! command -v kubelogin &> /dev/null; then + echo "kubelogin could not be found. Installing kubelogin..." + az aks install-cli +fi ########################################################## # Create the custom-values.yaml file