67 lines
3.0 KiB
PowerShell
67 lines
3.0 KiB
PowerShell
|
Param(
|
||
|
[parameter(Mandatory=$false)][string]$registry,
|
||
|
[parameter(Mandatory=$false)][string]$dockerUser,
|
||
|
[parameter(Mandatory=$false)][string]$dockerPassword,
|
||
|
[parameter(Mandatory=$false)][string]$externalDns,
|
||
|
[parameter(Mandatory=$false)][string]$appName="eshop",
|
||
|
[parameter(Mandatory=$false)][bool]$deployInfrastructure=$true,
|
||
|
[parameter(Mandatory=$false)][bool]$clean=$true,
|
||
|
[parameter(Mandatory=$false)][string]$aksName="",
|
||
|
[parameter(Mandatory=$false)][string]$aksRg="",
|
||
|
[parameter(Mandatory=$false)][string]$imageTag="latest"
|
||
|
)
|
||
|
|
||
|
$dns = $externalDns
|
||
|
|
||
|
if ($externalDns -eq "aks") {
|
||
|
if ([string]::IsNullOrEmpty($aksName) -or [string]::IsNullOrEmpty($aksRg)) {
|
||
|
Write-Host "Error: When using -dns aks, MUST set -aksName and -aksRg too." -ForegroundColor Red
|
||
|
exit 1
|
||
|
}
|
||
|
Write-Host "Getting DNS of AKS of AKS $aksName (in resource group $aksRg)..." -ForegroundColor Green
|
||
|
$dns = $(az aks show -n $aksName -g $aksRg --query addonProfiles.httpApplicationRouting.config.HTTPApplicationRoutingZoneName)
|
||
|
if ([string]::IsNullOrEmpty($dns)) {
|
||
|
Write-Host "Error getting DNS of AKS $aksName (in resource group $aksRg). Please ensure AKS has httpRouting enabled AND Azure CLI is logged & in version 2.0.37 or higher" -ForegroundColor Red
|
||
|
exit 1
|
||
|
}
|
||
|
$dns = $dns -replace '[\"]'
|
||
|
Write-Host "DNS base found is $dns. Will use $appName.$dns for the app!" -ForegroundColor Green
|
||
|
$dns = "$appName.$dns"
|
||
|
}
|
||
|
|
||
|
# Initialization & check commands
|
||
|
if ([string]::IsNullOrEmpty($dns)) {
|
||
|
Write-Host "No DNS specified. Ingress resources will be bound to public ip" -ForegroundColor Yellow
|
||
|
}
|
||
|
|
||
|
if ($clean) {
|
||
|
Write-Host "Cleaning previous helm releases..." -ForegroundColor Green
|
||
|
helm delete --purge $(helm ls -q)
|
||
|
Write-Host "Previous releases deleted" -ForegroundColor Green
|
||
|
}
|
||
|
|
||
|
$useDockerHub = [string]::IsNullOrEmpty($registry)
|
||
|
|
||
|
Write-Host "Begin eShopOnContainers installation using Helm" -ForegroundColor Green
|
||
|
|
||
|
$infras = ("sql-data", "nosql-data", "rabbitmq", "keystore-data", "basket-data")
|
||
|
$charts = ("eshop-common", "apigwmm", "apigwms", "apigwwm", "apigwws", "basket-api","catalog-api", "-api", "locations-api", "marketing-api", "mobileshoppingagg","ordering-api","ordering-backgroundtasks","ordering-signalrhub", "payment-api", "webmvc", "webshoppingagg", "webspa", "webstatus")
|
||
|
|
||
|
if ($deployInfrastructure) {
|
||
|
foreach ($infra in $infras) {
|
||
|
Write-Host "Installing infrastructure: $infra" -ForegroundColor Green
|
||
|
helm install --values app.yaml --values inf.yaml --values ingress_values.yaml --set appName=$appName --set inf.k8s.dns=$dns --name="$appName-$infra" $infra
|
||
|
}
|
||
|
}
|
||
|
|
||
|
foreach ($chart in $charts) {
|
||
|
Write-Host "Installing: $chart" -ForegroundColor Green
|
||
|
helm install --values app.yaml --values inf.yaml --values ingress_values.yaml --set appName=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --name="$appName-$chart" $chart
|
||
|
}
|
||
|
|
||
|
Write-Host "helm charts installed." -ForegroundColor Green
|
||
|
|
||
|
|
||
|
|
||
|
|