Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to AKS Edge Essentials single node deployment #2689

Merged
merged 9 commits into from
Sep 3, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Start-Transcript -Path C:\Temp\LogonScript.log
## Deploy AKS EE

# Parameters
$AksEdgeRemoteDeployVersion = "1.0.230221.1200"
$schemaVersion = "1.1"
$AksEdgeRemoteDeployVersion = "1.7.639.0"
$versionAksEdgeConfig = "1.0"
$aksEdgeDeployModules = "main"
$aksEEReleasesUrl = "https://api.github.com/repos/Azure/AKS-Edge/releases"
Expand All @@ -28,7 +27,7 @@ if ($env:kubernetesDistribution -eq "k8s") {

Write-Host "Fetching the latest AKS Edge Essentials release."
if ($AKSEEPinnedSchemaVersion -ne "useLatest") {
$SchemaVersion = $AKSEEPinnedSchemaVersion
$schemaVersionAksEdgeConfig = $AKSEEPinnedSchemaVersion
}else{
$latestReleaseTag = (Invoke-WebRequest $aksEEReleasesUrl | ConvertFrom-Json)[0].tag_name
$AKSEEReleaseDownloadUrl = "https://github.com/Azure/AKS-Edge/archive/refs/tags/$latestReleaseTag.zip"
Expand All @@ -37,7 +36,7 @@ if ($AKSEEPinnedSchemaVersion -ne "useLatest") {
Expand-Archive $output -DestinationPath "C:\temp" -Force
$AKSEEReleaseConfigFilePath = "C:\temp\AKS-Edge-$latestReleaseTag\tools\aksedge-config.json"
$jsonContent = Get-Content -Raw -Path $AKSEEReleaseConfigFilePath | ConvertFrom-Json
$schemaVersion = $jsonContent.SchemaVersion
$schemaVersionAksEdgeConfig = $jsonContent.SchemaVersion
# Clean up the downloaded release files
Remove-Item -Path $output -Force
Remove-Item -Path "C:\temp\AKS-Edge-$latestReleaseTag" -Force -Recurse
Expand All @@ -47,7 +46,7 @@ if ($AKSEEPinnedSchemaVersion -ne "useLatest") {
$aideuserConfig = @"
{
"SchemaVersion": "$AksEdgeRemoteDeployVersion",
"Version": "$schemaVersion",
"Version": "$schemaVersionAksEdgeConfig",
"AksEdgeProduct": "$productName",
"AksEdgeProductUrl": "",
"Azure": {
Expand Down Expand Up @@ -163,7 +162,7 @@ Set-Content -Path $aksedgejson -Value $aksedgeConfig -Force
$aksedgeShell = (Get-ChildItem -Path "$workDir" -Filter AksEdgeShell.ps1 -Recurse).FullName
. $aksedgeShell

# Download, install and deploy AKS EE
# Download, install and deploy AKS EE
Write-Host "Step 2: Download, install and deploy AKS Edge Essentials"
# invoke the workflow, the json file already stored above.
$retval = Start-AideWorkflow -jsonFile $aidejson
Expand Down Expand Up @@ -204,8 +203,8 @@ az -v
az login --service-principal --username $Env:appId --password=$Env:password --tenant $Env:tenantId

# Set default subscription to run commands against
# "subscriptionId" value comes from clientVM.json ARM template, based on which
# subscription user deployed ARM template to. This is needed in case Service
# "subscriptionId" value comes from clientVM.json ARM template, based on which
# subscription user deployed ARM template to. This is needed in case Service
# Principal has access to multiple subscriptions, which can break the automation logic
az account set --subscription $Env:subscriptionId

Expand Down Expand Up @@ -347,22 +346,22 @@ $clusterName = "$env:computername-$env:kubernetesDistribution"

# Changing to Client VM wallpaper
$imgPath = "C:\Temp\wallpaper.png"
$code = @'
using System.Runtime.InteropServices;
namespace Win32{
public class Wallpaper{
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ;
public static void SetWallpaper(string thePath){
SystemParametersInfo(20,0,thePath,3);
$code = @'
using System.Runtime.InteropServices;
namespace Win32{

public class Wallpaper{
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ;

public static void SetWallpaper(string thePath){
SystemParametersInfo(20,0,thePath,3);
}
}
}
}
'@

add-type $code
add-type $code
[Win32.Wallpaper]::SetWallpaper($imgPath)

# Kill the open PowerShell monitoring kubectl get pods
Expand Down