Skip to content

Commit 510c2a3

Browse files
authored
feat: windows node set mcr containerd host config for network isolated cluster (#7902)
1 parent d49d123 commit 510c2a3

File tree

22 files changed

+212
-1
lines changed

22 files changed

+212
-1
lines changed

e2e/scenario_win_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,3 +550,30 @@ func Test_Windows2025Gen2_McrChinaCloud_Windows(t *testing.T) {
550550
},
551551
})
552552
}
553+
554+
func Test_NetworkIsolatedCluster_Windows_WithEgress(t *testing.T) {
555+
RunScenario(t, &Scenario{
556+
Description: "Tests that Windows nodes in network isolated clusters configure containerd to use the bootstrap profile container registry for MCR images",
557+
Tags: Tags{
558+
NetworkIsolated: true,
559+
NonAnonymousACR: true,
560+
},
561+
Config: Config{
562+
Cluster: ClusterAzureBootstrapProfileCache,
563+
VHD: config.VHDWindows2025Gen2,
564+
BootstrapConfigMutator: func(nbc *datamodel.NodeBootstrappingConfiguration) {
565+
nbc.ContainerService.Properties.SecurityProfile = &datamodel.SecurityProfile{
566+
PrivateEgress: &datamodel.PrivateEgress{
567+
Enabled: true,
568+
ContainerRegistryServer: fmt.Sprintf("%s.azurecr.io/aks-managed-repository", config.PrivateACRNameNotAnon(config.Config.DefaultLocation)),
569+
},
570+
}
571+
},
572+
Validator: func(ctx context.Context, s *Scenario) {
573+
// Verify mcr.microsoft.com host config exist
574+
ValidateFileExists(ctx, s, `C:\ProgramData\containerd\certs.d\mcr.microsoft.com\hosts.toml`)
575+
ValidateFileDoesNotExist(ctx, s, `C:\ProgramData\containerd\certs.d\mcr.azk8s.cn\hosts.toml`)
576+
},
577+
},
578+
})
579+
}

parts/windows/kuberneteswindowssetup.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ $global:WindowsCiliumNetworkingConfiguration = "{{GetVariable "nextGenNetworking
220220
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
221221
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
222222

223+
# Network isolated cluster
224+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER="{{GetBootstrapProfileContainerRegistryServer}}"
225+
$global:MCR_REPOSITORY_BASE="{{GetMCRRepositoryBase}}"
226+
223227
# Extract cse helper script from ZIP
224228
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
225229
try {

pkg/agent/testdata/AKSWindows2019+CustomCloud+ootcredentialprovider/CustomData

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ $global:WindowsCiliumNetworkingConfiguration = "";
214214
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
215215
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
216216

217+
# Network isolated cluster
218+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER=""
219+
$global:MCR_REPOSITORY_BASE="mcr.microsoft.com/"
220+
217221
# Extract cse helper script from ZIP
218222
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
219223
try {

pkg/agent/testdata/AKSWindows2019+CustomCloud/CustomData

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ $global:WindowsCiliumNetworkingConfiguration = "";
214214
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
215215
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
216216

217+
# Network isolated cluster
218+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER=""
219+
$global:MCR_REPOSITORY_BASE="mcr.microsoft.com/"
220+
217221
# Extract cse helper script from ZIP
218222
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
219223
try {

pkg/agent/testdata/AKSWindows2019+CustomVnet/CustomData

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ $global:WindowsCiliumNetworkingConfiguration = "";
214214
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
215215
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
216216

217+
# Network isolated cluster
218+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER=""
219+
$global:MCR_REPOSITORY_BASE="mcr.microsoft.com/"
220+
217221
# Extract cse helper script from ZIP
218222
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
219223
try {

pkg/agent/testdata/AKSWindows2019+EnablePrivateClusterHostsConfigAgent/CustomData

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ $global:WindowsCiliumNetworkingConfiguration = "";
214214
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
215215
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
216216

217+
# Network isolated cluster
218+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER=""
219+
$global:MCR_REPOSITORY_BASE="mcr.microsoft.com/"
220+
217221
# Extract cse helper script from ZIP
218222
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
219223
try {

pkg/agent/testdata/AKSWindows2019+K8S116/CustomData

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ $global:WindowsCiliumNetworkingConfiguration = "";
214214
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
215215
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
216216

217+
# Network isolated cluster
218+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER=""
219+
$global:MCR_REPOSITORY_BASE="mcr.microsoft.com/"
220+
217221
# Extract cse helper script from ZIP
218222
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
219223
try {

pkg/agent/testdata/AKSWindows2019+K8S117/CustomData

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ $global:WindowsCiliumNetworkingConfiguration = "";
214214
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
215215
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
216216

217+
# Network isolated cluster
218+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER=""
219+
$global:MCR_REPOSITORY_BASE="mcr.microsoft.com/"
220+
217221
# Extract cse helper script from ZIP
218222
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
219223
try {

pkg/agent/testdata/AKSWindows2019+K8S118/CustomData

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ $global:WindowsCiliumNetworkingConfiguration = "";
214214
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
215215
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
216216

217+
# Network isolated cluster
218+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER=""
219+
$global:MCR_REPOSITORY_BASE="mcr.microsoft.com/"
220+
217221
# Extract cse helper script from ZIP
218222
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
219223
try {

pkg/agent/testdata/AKSWindows2019+K8S119+CSI/CustomData

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ $global:WindowsCiliumNetworkingConfiguration = "";
214214
$global:WindowsCiliumNetworkingPath = Join-Path -Path $global:cacheDir -ChildPath 'wcn'
215215
$global:WindowsCiliumInstallPath = Join-Path -Path $global:WindowsCiliumNetworkingPath -ChildPath 'install'
216216

217+
# Network isolated cluster
218+
$global:BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER=""
219+
$global:MCR_REPOSITORY_BASE="mcr.microsoft.com/"
220+
217221
# Extract cse helper script from ZIP
218222
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
219223
try {

0 commit comments

Comments
 (0)