-
Notifications
You must be signed in to change notification settings - Fork 266
feat(windows): add credential provider mirror config for network isolated cluster #8708
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,6 +153,61 @@ Describe 'Config-CredentialProvider' { | |
| $normalizedActual | Should -Be $normalizedExpected | ||
| } | ||
| } | ||
| Context 'BootstrapProfileContainerRegistryServer is set with default MCR' { | ||
| BeforeEach { | ||
| $global:BootstrapProfileContainerRegistryServer = "myregistry.azurecr.io" | ||
| # Ensure MCRRepositoryBase is not set so it falls back to mcr.microsoft.com | ||
| Remove-Variable -Name MCRRepositoryBase -Scope Global -ErrorAction SilentlyContinue | ||
| } | ||
| AfterEach { | ||
| $global:BootstrapProfileContainerRegistryServer = $null | ||
| } | ||
| It "should include mcr.microsoft.com in matchImages and registry-mirror arg" { | ||
| $expectedCredentialProviderConfig = Read-Format-Yaml ([Io.path]::Combine($credentialProviderConfigDir, "BootstrapProfileContainerRegistryServerDefault.config.yaml")) | ||
| Config-CredentialProvider -KubeDir $credentialProviderConfigDir -CredentialProviderConfPath $CredentialProviderConfPATH -CustomCloudContainerRegistryDNSSuffix "" | ||
| $acutalCredentialProviderConfig = Read-Format-Yaml $CredentialProviderConfPATH | ||
|
|
||
| $normalizedExpected = $expectedCredentialProviderConfig.Trim().Replace("`r`n", "`n") | ||
| $normalizedActual = $acutalCredentialProviderConfig.Trim().Replace("`r`n", "`n") | ||
| $normalizedActual | Should -Be $normalizedExpected | ||
| } | ||
| } | ||
|
Comment on lines
+156
to
+174
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. If we add CSE-side normalization for this path, I’ll include an |
||
| Context 'BootstrapProfileContainerRegistryServer is set with custom MCRRepositoryBase' { | ||
| BeforeEach { | ||
| $global:BootstrapProfileContainerRegistryServer = "myregistry.azurecr.io" | ||
| $global:MCRRepositoryBase = "custom.mcr.contoso.com" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Low / Test Coverage — This value has no trailing slash, so the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. I’ll update the custom MCR test input to include a trailing slash while keeping the expected fixture trimmed, so the test proves the trim behavior. |
||
| } | ||
| AfterEach { | ||
| $global:BootstrapProfileContainerRegistryServer = $null | ||
| $global:MCRRepositoryBase = $null | ||
| } | ||
| It "should use custom MCRRepositoryBase in matchImages and registry-mirror arg" { | ||
| $expectedCredentialProviderConfig = Read-Format-Yaml ([Io.path]::Combine($credentialProviderConfigDir, "BootstrapProfileContainerRegistryServerCustomMCR.config.yaml")) | ||
| Config-CredentialProvider -KubeDir $credentialProviderConfigDir -CredentialProviderConfPath $CredentialProviderConfPATH -CustomCloudContainerRegistryDNSSuffix "" | ||
| $acutalCredentialProviderConfig = Read-Format-Yaml $CredentialProviderConfPATH | ||
|
|
||
| $normalizedExpected = $expectedCredentialProviderConfig.Trim().Replace("`r`n", "`n") | ||
| $normalizedActual = $acutalCredentialProviderConfig.Trim().Replace("`r`n", "`n") | ||
| $normalizedActual | Should -Be $normalizedExpected | ||
| } | ||
| } | ||
| Context 'CustomCloudContainerRegistryDNSSuffix takes precedence over BootstrapProfileContainerRegistryServer' { | ||
| BeforeEach { | ||
| $global:BootstrapProfileContainerRegistryServer = "myregistry.azurecr.io" | ||
| } | ||
| AfterEach { | ||
| $global:BootstrapProfileContainerRegistryServer = $null | ||
| } | ||
| It "should use CustomCloud config and not include registry-mirror when both are set" { | ||
| $expectedCredentialProviderConfig = Read-Format-Yaml ([Io.path]::Combine($credentialProviderConfigDir, "CustomCloudContainerRegistryDNSSuffixNotEmpty.config.yaml")) | ||
| Config-CredentialProvider -KubeDir $credentialProviderConfigDir -CredentialProviderConfPath $CredentialProviderConfPATH -CustomCloudContainerRegistryDNSSuffix ".azurecr.microsoft.fakecloud" | ||
| $acutalCredentialProviderConfig = Read-Format-Yaml $CredentialProviderConfPATH | ||
|
|
||
| $normalizedExpected = $expectedCredentialProviderConfig.Trim().Replace("`r`n", "`n") | ||
| $normalizedActual = $acutalCredentialProviderConfig.Trim().Replace("`r`n", "`n") | ||
| $normalizedActual | Should -Be $normalizedExpected | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Describe 'Validate-CredentialProviderConfigFlags' { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| apiVersion: kubelet.config.k8s.io/v1 | ||
| kind: CredentialProviderConfig | ||
| providers: | ||
| - name: acr-credential-provider | ||
| matchImages: | ||
| - "*.azurecr.io" | ||
| - "*.azurecr.cn" | ||
| - "*.azurecr.de" | ||
| - "*.azurecr.us" | ||
| - "custom.mcr.contoso.com" | ||
| defaultCacheDuration: "10m" | ||
| apiVersion: credentialprovider.kubelet.k8s.io/v1 | ||
| args: | ||
| - staging\cse\windows\credentialProvider.tests.suites\azure.json | ||
| - --registry-mirror=custom.mcr.contoso.com:myregistry.azurecr.io |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| apiVersion: kubelet.config.k8s.io/v1 | ||
| kind: CredentialProviderConfig | ||
| providers: | ||
| - name: acr-credential-provider | ||
| matchImages: | ||
| - "*.azurecr.io" | ||
| - "*.azurecr.cn" | ||
| - "*.azurecr.de" | ||
| - "*.azurecr.us" | ||
| - "mcr.microsoft.com" | ||
| defaultCacheDuration: "10m" | ||
| apiVersion: credentialprovider.kubelet.k8s.io/v1 | ||
| args: | ||
| - staging\cse\windows\credentialProvider.tests.suites\azure.json | ||
| - --registry-mirror=mcr.microsoft.com:myregistry.azurecr.io |
Uh oh!
There was an error while loading. Please reload this page.