Skip to content

Commit

Permalink
Merge branch 'microsoft:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
chintalavr authored Feb 24, 2025
2 parents d74cae9 + 5ee4c10 commit eca6d5c
Show file tree
Hide file tree
Showing 16 changed files with 755 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@
@{name="customlocation"; version="latest"},
@{name="kusto"; version="latest"},
@{name="storage-preview"; version="latest"},
@{name="azure-iot-ops"; version="0.5.1b1"}
@{name="azure-iot-ops"; version="latest"}
)

# PowerShell modules
PowerShellModules = @(
@{name='Az.ConnectedKubernetes'; version="0.10.3"},
@{name='Az.ConnectedKubernetes'; version="latest"},
@{name='Az.KubernetesConfiguration'; version="latest"},
@{name='Az.Kusto'; version="latest"},
@{name='Az.EventGrid'; version="latest"},
@{name='Az.Storage'; version="latest"},
@{name='Az.EventHub'; version="latest"}
@{name='Az.EventHub'; version="latest"},
@{name='powershell-yaml'; version="latest"}
)

# Winget packages list
Expand All @@ -92,7 +93,8 @@
'FireDaemon.OpenSSL',
'thomasnordquist.MQTT-Explorer',
'GitHub.cli',
'Python.Python.3.12'
'Python.Python.3.12',
'Derailed.k9s'
)

# Pip packages list
Expand Down Expand Up @@ -143,51 +145,29 @@
natSubnet = "192.168.46.0/24" # This value is the subnet is the NAT router will use to route to AzSMGMT to access the Internet. It can be any /24 subnet and is only used for routing.
natDNS = "%staging-natDNS%" # Do not change - can be configured by passing the optional natDNS parameter to the ARM deployment.

# AKS Edge Essentials variables
# Site Kubernetes cluster configurations
SiteConfig = @{
Detroit = @{
ArcClusterName = "Ag-ArcK8s-Detroit"
NetIPAddress = "172.20.1.2"
DefaultGateway = "172.20.1.1"
PrefixLength = "24"
DNSClientServerAddress = "168.63.129.16"
ServiceIPRangeStart = "172.20.1.31"
ServiceIPRangeSize = "10"
ControlPlaneEndpointIp = "172.20.1.21"
LinuxNodeIp4Address = "172.20.1.11"
Subnet = "172.20.1.0/24"
ArcClusterName = "Ag-K3s-Detroit"
FriendlyName = "Detroit"
IsProduction = $true
Type = "AKSEE"
GrafanaDataSource = "detroit"
Type = "k3s"
Branch = "main"
HelmValuesFile = "prometheus-additional-scrape-config.yaml"
HelmSetValue = "alertmanager.enabled=false,grafana.enabled=false,prometheus.service.type=LoadBalancer"
HelmService = "service/prometheus-kube-prometheus-prometheus"
GrafanaDataSource = "detroit"
HelmValuesFile = "prometheus-additional-scrape-config.yaml"
clusterLogSize = "1024"
AKSEEReleaseUseLatest = $true # If set to true, the latest AKSEE release will be used. If set to false, the n-1 version will be used
IsProduction = $true
}
Monterrey = @{
ArcClusterName = "Ag-ArcK8s-Monterrey"
NetIPAddress = "172.20.1.3"
DefaultGateway = "172.20.1.1"
PrefixLength = "24"
DNSClientServerAddress = "168.63.129.16"
ServiceIPRangeStart = "172.20.1.71"
ServiceIPRangeSize = "10"
ControlPlaneEndpointIp = "172.20.1.61"
LinuxNodeIp4Address = "172.20.1.51"
Subnet = "172.20.1.0/24"
ArcClusterName = "Ag-K3s-Monterrey"
FriendlyName = "Monterrey"
IsProduction = $true
Type = "AKSEE"
GrafanaDataSource = "monterrey"
Type = "k3s"
Branch = "main"
HelmValuesFile = "prometheus-additional-scrape-config.yaml"
HelmSetValue = "alertmanager.enabled=false,grafana.enabled=false,prometheus.service.type=LoadBalancer"
HelmService = "service/prometheus-kube-prometheus-prometheus"
GrafanaDataSource = "monterrey"
HelmValuesFile = "prometheus-additional-scrape-config.yaml"
clusterLogSize = "1024"
AKSEEReleaseUseLatest = $true # If set to true, the latest AKSEE release will be used. If set to false, the n-1 version will be used
IsProduction = $true
}
}

Expand Down Expand Up @@ -221,7 +201,7 @@
inferencing_deployment = @{
GitOpsConfigName = "contoso-motors"
KustomizationName = "contoso-motors"
KustomizationPath="./contoso_manufacturing/operations"
KustomizationPath="./agora/contoso_motors"
Namespace = "contoso-motors"
Order = 1
}
Expand Down
28 changes: 16 additions & 12 deletions azure_jumpstart_ag/artifacts/PowerShell/AgLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ if ($scenario -eq "contoso_supermarket") {
$global:workflowStatus = ""
$global:appClonedRepo = "https://github.com/$githubUser/jumpstart-apps"
}elseif ($scenario -eq "contoso_motors") {
$global:appUpstreamRepo = "https://github.com/microsoft/jumpstart-agora-apps"
$global:appUpstreamRepo = "https://github.com/azure/jumpstart-apps"
$global:aioNamespace = "azure-iot-operations"
$global:mqListenerService = "aio-mq-dmqtt-frontend"
$global:mqListenerService = "aio-broker-insecure"
$global:mqttExplorerReleasesUrl = $websiteUrls["mqttExplorerReleases"]
$global:stagingStorageAccountName = $Env:stagingStorageAccountName
$global:aioStorageAccountName = $Env:aioStorageAccountName
$global:spnObjectId = $Env:spnObjectId
$global:k3sArcDataClusterName = $Env:k3sArcDataClusterName
$global:k3sArcClusterName = $Env:k3sArcClusterName
$global:tenantId = $Env:tenantId
}elseif ($scenario -eq "contoso_hypermarket"){
$global:appUpstreamRepo = "https://github.com/Azure/jumpstart-apps"
$global:tenantId = $Env:tenantId
Expand All @@ -77,7 +80,9 @@ Import-Module "$AgPowerShellDir\contoso_motors.psm1" -Force -DisableNameChecking
Import-Module "$AgPowerShellDir\contoso_hypermarket.psm1" -Force -DisableNameChecking

Start-Transcript -Path ($AgLogsDir + "\AgLogonScript.log")
Write-Host "Executing Jumpstart Agora automation scripts"
Write-Host "Executing Jumpstart Agora automation scripts..."
Write-Host "Selected global scenario:" $global:scenario
Write-Host "Selected scenario:" $scenario
$startTime = Get-Date

# Remove registry keys that are used to automatically logon the user (only used for first-time setup)
Expand Down Expand Up @@ -108,7 +113,7 @@ $global:Credentials = New-Object System.Management.Automation.PSCredential($AgCo
#####################################################################
Write-Host "[$(Get-Date -Format t)] INFO: Configuring Azure CLI (Step 1/17)" -ForegroundColor DarkGreen
Write-Host "[$(Get-Date -Format t)] INFO: Logging into Az CLI" -ForegroundColor Gray
if($scenario -eq "contoso_hypermarket"){
if($scenario -eq "contoso_hypermarket" -or $scenario -eq "contoso_motors"){
az login --identity | Out-File -Append -FilePath ($AgConfig.AgDirectories["AgLogsDir"] + "\AzCLI.log")
}else{
az login --service-principal --username $Env:spnClientID --password=$Env:spnClientSecret --tenant $Env:spnTenantId | Out-File -Append -FilePath ($AgConfig.AgDirectories["AgLogsDir"] + "\AzCLI.log")
Expand Down Expand Up @@ -149,7 +154,7 @@ if ($scenario -eq "contoso_supermarket") {
#####################################################################
# Configure L1 virtualization infrastructure
#####################################################################
if ($scenario -eq "contoso_supermarket" -or $scenario -eq "contoso_motors") {
if ($scenario -eq "contoso_supermarket") {
Write-Host "[$(Get-Date -Format t)] INFO: Configuring L1 virtualization infrastructure (Step 6/17)" -ForegroundColor DarkGreen
Deploy-VirtualizationInfrastructure
}
Expand All @@ -164,9 +169,9 @@ if ($scenario -eq "contoso_supermarket") {
#####################################################################
# Get clusters config files
#####################################################################
if($scenario -eq "contoso_hypermarket"){
Get-K3sConfigFile
Merge-K3sConfigFiles
if($scenario -eq "contoso_hypermarket" -or $scenario -eq "contoso_motors"){
Get-K3sConfigFileContosoMotors
Merge-K3sConfigFilesContosoMotors
Set-K3sClusters
}

Expand Down Expand Up @@ -194,7 +199,7 @@ if ($scenario -eq "contoso_supermarket") {
#####################################################################
# Connect the AKS Edge Essentials clusters and hosts to Azure Arc
#####################################################################
if($scenario -eq "contoso_supermarket" -or $scenario -eq "contoso_motors"){
if($scenario -eq "contoso_supermarket"){
Write-Host "[$(Get-Date -Format t)] INFO: Connecting AKS Edge clusters to Azure with Azure Arc (Step 10/17)" -ForegroundColor DarkGreen
Deploy-AzArcK8sAKSEE
}
Expand Down Expand Up @@ -234,11 +239,10 @@ if ($scenario -eq "contoso_supermarket") {
}

if ($scenario -eq "contoso_motors") {
Update-AzureIoTOpsExtension
Deploy-AIO
Deploy-MotorsConfigs
Deploy-AIO-M3
$mqttIpArray=Set-MQTTIpAddress
Deploy-MQTTExplorer -mqttIpArray $mqttIpArray
Deploy-MotorsConfigs
}elseif($scenario -eq "contoso_hypermarket"){
Deploy-AIO-M3
$mqttIpArray=Set-MQTTIpAddress
Expand Down
11 changes: 8 additions & 3 deletions azure_jumpstart_ag/artifacts/PowerShell/Bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ param (
[string]$speachToTextEndpoint,
[object]$azureOpenAIModel,
[string]$openAIDeploymentName,
[string]$acrName
[string]$acrName,
[string]$AZCOPY_AUTO_LOGIN_TYPE
)

##############################################################
Expand Down Expand Up @@ -78,10 +79,11 @@ param (
[System.Environment]::SetEnvironmentVariable('speachToTextEndpoint', $speachToTextEndpoint, [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable('azureOpenAIModel', $azureOpenAIModel, [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable('openAIDeploymentName', $openAIDeploymentName, [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable('AZCOPY_AUTO_LOGIN_TYPE', 'MSI', [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable('acrName', $acrName, [System.EnvironmentVariableTarget]::Machine)

$ErrorActionPreference = 'Continue'

Write-Host "Scenario from the configuration is $scenario"
##############################################################
# Change RDP Port
##############################################################
Expand Down Expand Up @@ -314,6 +316,9 @@ if($scenario -eq "contoso_supermarket"){
Invoke-WebRequest ($templateBaseUrl + "artifacts/monitoring/grafana-freezer-monitoring.json") -OutFile "$AgMonitoringDir\grafana-freezer-monitoring.json"
}
elseif ($scenario -eq "contoso_motors") {
Invoke-WebRequest ($templateBaseUrl + "artifacts/kubernetes/K3s/longhorn.yaml") -OutFile "$AgToolsDir\longhorn.yaml"
Invoke-WebRequest ($templateBaseUrl + "artifacts/kubernetes/K3s/kubeVipRbac.yml") -OutFile "$AgToolsDir\kubeVipRbac.yml"
Invoke-WebRequest ($templateBaseUrl + "artifacts/kubernetes/K3s/kubeVipDaemon.yml") -OutFile "$AgToolsDir\kubeVipDaemon.yml"
Invoke-WebRequest ($templateBaseUrl + "artifacts/settings/Bookmarks-contoso-motors") -OutFile "$AgToolsDir\Bookmarks"
Invoke-WebRequest ($templateBaseUrl + "artifacts/settings/mq_cloudConnector.yml") -OutFile "$AgToolsDir\mq_cloudConnector.yml"
Invoke-WebRequest ($templateBaseUrl + "artifacts/settings/mqtt_explorer_settings_motors.json") -OutFile "$AgToolsDir\mqtt_explorer_settings.json"
Expand Down Expand Up @@ -412,7 +417,7 @@ Get-ScheduledTask -TaskName ServerManager | Disable-ScheduledTask
##############################################################
# Install Hyper-V, WSL and reboot
##############################################################
if($scenario -eq "contoso_supermarket" -or $scenario -eq "contoso_motors"){
if($scenario -eq "contoso_supermarket"){
Write-Header "Installing Hyper-V"
Enable-WindowsOptionalFeature -Online -FeatureName Containers -All -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart
Expand Down
20 changes: 4 additions & 16 deletions azure_jumpstart_ag/artifacts/PowerShell/Modules/common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,9 @@ function Deploy-Prometheus {
$apiServerPort = ($apiServerAddress -split ":")[1]

do {
Write-Host "apiServerFqdn=$apiServerFqdn"
Write-Host "apiServerPort=$apiServerPort"
Write-Host "apiServer=$apiServer"
$result = Test-NetConnection -ComputerName $apiServerFqdn -Port $apiServerPort -WarningAction SilentlyContinue
if ($result.TcpTestSucceeded) {
Write-Host "[$(Get-Date -Format t)] INFO: Kubernetes API server $apiServer is available" -ForegroundColor Gray
Expand Down Expand Up @@ -1142,20 +1145,6 @@ function Deploy-Prometheus {
Write-Host
}

function Update-AzureIoTOpsExtension {
try {
Write-Host "Starting patching of azure-iot-ops extension..." -ForegroundColor Green
& "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe" -m pip install -U --target "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure-cli-extensions\azure-iot-ops" azure-identity==1.17.1
if ($LASTEXITCODE -eq 0) {
Write-Host "Installation of azure-iot-ops extension completed successfully." -ForegroundColor Green
} else {
Write-Host "Installation of azure-iot-ops extension failed with exit code $LASTEXITCODE." -ForegroundColor Red
}
} catch {
Write-Host "An error occurred during the patching of the azure-iot-ops extension." -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
}
}

# Deploys Azure IoT Operations on all k8s clusters in the config file
function Deploy-AIO {
Expand Down Expand Up @@ -1270,7 +1259,6 @@ function Deploy-AIO {
--features cluster-connect custom-locations `
--custom-locations-oid $customLocationRPOID `
--only-show-errors

Start-Sleep -Seconds 10

do {
Expand All @@ -1285,7 +1273,7 @@ function Deploy-AIO {
}
else {
$aioStatus = "deployed"
}
}
} until ($aioStatus -eq "deployed" -or $retryCount -eq $maxRetries)
$kvIndex++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,14 @@ function Deploy-AIO-M3 {
Write-Host "`n"
$schemaName = "${clusterName}-$($Env:namingGuid)-schema"
$schemaId = $(az iot ops schema registry create --name $schemaName `
--resource-group $resourceGroup `
--resource-group $Env:resourceGroup `
--registry-namespace "$clusterName-$($Env:namingGuid)-namespace" `
--sa-resource-id $(az storage account show --name $aioStorageAccountName --resource-group $resourceGroup -o tsv --query id) `
--sa-resource-id $(az storage account show --name $Env:aioStorageAccountName --resource-group $Env:resourceGroup -o tsv --query id) `
--query id -o tsv)

Write-Host "[$(Get-Date -Format t)] INFO: The aio storage account name is: $aioStorageAccountName" -ForegroundColor DarkGray
Write-Host "[$(Get-Date -Format t)] INFO: the schemaId is '$schemaId' - verify this" -ForegroundColor DarkGray

$customLocationName = $arcClusterName.toLower() + "-cl"

# Initialize the Azure IoT Operations instance on the Arc-enabled cluster
Expand All @@ -220,8 +223,8 @@ function Deploy-AIO-M3 {
Write-Host "[$(Get-Date -Format t)] Error: An error occured while deploying AIO on the cluster...Retrying" -ForegroundColor DarkRed
Write-Host "`n"
az iot ops init --cluster $arcClusterName.toLower() `
--resource-group $resourceGroup `
--subscription $subscriptionId `
--resource-group $Env:resourceGroup `
--subscription $Env:subscriptionId `
--only-show-errors
$retryCount++
}
Expand All @@ -238,8 +241,8 @@ function Deploy-AIO-M3 {
do {
az iot ops create --name $arcClusterName.toLower() `
--cluster $arcClusterName.toLower() `
--resource-group $resourceGroup `
--subscription $subscriptionId `
--resource-group $Env:resourceGroup `
--subscription $Env:subscriptionId `
--custom-location $customLocationName `
--sr-resource-id $schemaId `
--enable-rsync true `
Expand Down
Loading

0 comments on commit eca6d5c

Please sign in to comment.