Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename fucntion
  • Loading branch information
fseldow committed Mar 8, 2026
commit 5f93fb3f048b510dfc6902a75b3a387a5f3714b4
6 changes: 3 additions & 3 deletions parts/windows/kuberneteswindowssetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ function BasePrep {
if ((Test-Path variable:global:BootstrapProfileContainerRegistryServer) -and
-not [string]::IsNullOrWhiteSpace($global:BootstrapProfileContainerRegistryServer)) {
# variable exists and is not empty/whitespace
if (Get-Command -Name Ensure-Oras -ErrorAction SilentlyContinue) {
if (Get-Command -Name Install-Oras -ErrorAction SilentlyContinue) {
Logs-To-Event -TaskName "AKS.WindowsCSE.EnsureOras" -TaskMessage "Ensure oras is installed for network isolated cluster"
Ensure-Oras
Install-Oras
} else {
Write-Log "Ensure-Oras is not a recognized function, will skip oras installation for network isolated cluster"
Write-Log "Install-Oras is not a recognized function, will skip oras installation for network isolated cluster"
}
}

Expand Down
8 changes: 1 addition & 7 deletions staging/cse/windows/networkisolatedclusterfunc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@

# unpackage and install oras from cache
# Oras is used for pulling windows binaries, e.g. windowszip, from private container registry when it is network isolated cluster.
function Ensure-Oras {
function Install-Oras {
# Check if OrasPath variable exists to avoid latest cached cse in vhd with possible old ab svc
$orasPathVarExists = Test-Path variable:global:OrasPath
if (-not $orasPathVarExists) {
Write-Log "OrasPath variable does not exist. Setting OrasPath to default value C:\aks-tools\oras\oras.exe"
$global:OrasPath = "C:\aks-tools\oras\oras.exe"
}

$orasFileExists = $false

if ($orasPathVarExists -and -not [string]::IsNullOrWhiteSpace($global:OrasPath)) {
$orasFileExists = Test-Path -Path $global:OrasPath -PathType Leaf
}

if (Test-Path -Path $global:OrasPath) {
# oras already installed, skip
Write-Log "Oras already installed at $($global:OrasPath)"
Expand Down
10 changes: 5 additions & 5 deletions staging/cse/windows/networkisolatedclusterfunc.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BeforeAll {

}

Describe "Ensure-Oras" {
Describe "Install-Oras" {
BeforeEach {
$global:OrasPath = "C:\aks-tools\oras\oras.exe"
$global:OrasCacheDir = "C:\akse-cache\oras"
Expand Down Expand Up @@ -33,7 +33,7 @@ Describe "Ensure-Oras" {
return $Path -eq $global:OrasPath
}

{ Ensure-Oras } | Should -Not -Throw
{ Install-Oras } | Should -Not -Throw
Assert-MockCalled -CommandName 'New-Item' -Times 0
Assert-MockCalled -CommandName 'Expand-Archive' -Times 0
Assert-MockCalled -CommandName 'AKS-Expand-Archive' -Times 0
Expand Down Expand Up @@ -66,7 +66,7 @@ Describe "Ensure-Oras" {
$script:orasInstalled = $true
}

{ Ensure-Oras } | Should -Not -Throw
{ Install-Oras } | Should -Not -Throw
$script:archiveExtractCalls | Should -Be 1
}

Expand All @@ -79,7 +79,7 @@ Describe "Ensure-Oras" {
Mock Get-ChildItem -MockWith { @() }

{
Ensure-Oras
Install-Oras
} | Should -Throw "*Set-ExitCode:$($global:WINDOWS_CSE_ERROR_ORAS_NOT_FOUND):No oras archive*"
}

Expand All @@ -101,7 +101,7 @@ Describe "Ensure-Oras" {
Mock tar -MockWith { $global:LASTEXITCODE = 1 }

{
Ensure-Oras
Install-Oras
} | Should -Throw "*Set-ExitCode:$($global:WINDOWS_CSE_ERROR_ORAS_NOT_FOUND):Failed to extract oras archive*"
}
}