Skip to content

Commit

Permalink
feat: set ipam environment to mas in Azure CNI config on Azure Stack …
Browse files Browse the repository at this point in the history
…(#1542)

* feat: set ipam environment to mas in Azure CNI config on Azure Stack

* regenerate files

* fix weird generated template change
  • Loading branch information
chappleg authored and acs-bot committed Jul 1, 2019
1 parent b49c725 commit 7fcccb4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
6 changes: 6 additions & 0 deletions parts/k8s/cloud-init/artifacts/cse_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ configureCNI() {
systemctl restart sys-fs-bpf.mount
REBOOTREQUIRED=true
fi

if [[ "${TARGET_ENVIRONMENT,,}" == "${AZURE_STACK_ENV}" ]] && [[ "${NETWORK_PLUGIN}" = "azure" ]]; then
# set environment to mas when using Azure CNI on Azure Stack
# shellcheck disable=SC2002,SC2005
echo $(cat "$CNI_CONFIG_DIR/10-azure.conflist" | jq '.plugins[0].ipam.environment = "mas"') > "$CNI_CONFIG_DIR/10-azure.conflist"
fi
}

configureCNIIPTables() {
Expand Down
3 changes: 2 additions & 1 deletion parts/k8s/kuberneteswindowssetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ try
-KubeClusterCIDR $global:KubeClusterCIDR `
-MasterSubnet $global:MasterSubnet `
-KubeServiceCIDR $global:KubeServiceCIDR `
-VNetCIDR $global:VNetCIDR
-VNetCIDR $global:VNetCIDR `
-TargetEnvironment $TargetEnvironment
} elseif ($global:NetworkPlugin -eq "kubenet") {
Update-WinCNI -CNIPath $global:CNIPath
Get-HnsPsm1 -HNSModule $global:HNSModule
Expand Down
8 changes: 7 additions & 1 deletion parts/k8s/windowsazurecnifunc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ Set-AzureCNIConfig
[Parameter(Mandatory=$true)][string]
$KubeServiceCIDR,
[Parameter(Mandatory=$true)][string]
$VNetCIDR
$VNetCIDR,
[Parameter(Mandatory=$true)][string]
$TargetEnvironment
)
# Fill in DNS information for kubernetes.
$fileName = [Io.path]::Combine("$AzureCNIConfDir", "10-azure.conflist")
Expand All @@ -79,5 +81,9 @@ Set-AzureCNIConfig
$configJson.plugins.AdditionalArgs[1].Value.DestinationPrefix = $KubeServiceCIDR
$configJson.plugins.AdditionalArgs[0].Value.ExceptionList += $VNetCIDR

if ($TargetEnvironment -ieq "AzureStackCloud") {
Add-Member -InputObject $configJson.plugins[0].ipam -MemberType NoteProperty -Name "environment" -Value "mas"
}

$configJson | ConvertTo-Json -depth 20 | Out-File -encoding ASCII -filepath $fileName
}
17 changes: 15 additions & 2 deletions pkg/engine/templates_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7fcccb4

Please sign in to comment.