Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 0 additions & 10 deletions parts/k8s/kuberneteswindowsfunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,12 @@ function DownloadFileOverHttp {
$oldProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'

$downloadTimer = [System.Diagnostics.Stopwatch]::StartNew()
try {
$args = @{Uri=$Url; Method="Get"; OutFile=$DestinationPath}
Retry-Command -Command "Invoke-RestMethod" -Args $args -Retries 5 -RetryDelaySeconds 10
} catch {
throw "Fail in downloading $Url. Error: $_"
}
$downloadTimer.Stop()

if ($global:AppInsightsClient -ne $null) {
$event = New-Object "Microsoft.ApplicationInsights.DataContracts.EventTelemetry"
$event.Name = "FileDownload"
$event.Properties["FileName"] = $fileName
$event.Metrics["DurationMs"] = $downloadTimer.ElapsedMilliseconds
$global:AppInsightsClient.TrackEvent($event)
}

$ProgressPreference = $oldProgressPreference
Write-Log "Downloaded file to $DestinationPath"
Expand Down
67 changes: 0 additions & 67 deletions parts/k8s/kuberneteswindowssetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ $global:NetworkPlugin = "{{WrapAsParameter "networkPlugin"}}"
$global:VNetCNIPluginsURL = "{{WrapAsParameter "vnetCniWindowsPluginsURL"}}"
$global:IsDualStackEnabled = {{if IsIPv6DualStackFeatureEnabled}}$true{{else}}$false{{end}}

# Telemetry settings
$global:EnableTelemetry = "{{WrapAsVariable "enableTelemetry" }}";
$global:TelemetryKey = "{{WrapAsVariable "applicationInsightsKey" }}";

# CSI Proxy settings
$global:EnableCsiProxy = [System.Convert]::ToBoolean("{{WrapAsVariable "windowsEnableCSIProxy" }}");
$global:CsiProxyUrl = "{{WrapAsVariable "windowsCSIProxyURL" }}";
Expand Down Expand Up @@ -185,67 +181,19 @@ try
Write-Log ".\CustomDataSetupScript.ps1 -MasterIP $MasterIP -KubeDnsServiceIp $KubeDnsServiceIp -MasterFQDNPrefix $MasterFQDNPrefix -Location $Location -AgentKey $AgentKey -AADClientId $AADClientId -AADClientSecret $AADClientSecret -NetworkAPIVersion $NetworkAPIVersion -TargetEnvironment $TargetEnvironment"
Write-Log "Provisioning $global:DockerServiceName... with IP $MasterIP"

$global:globalTimer = [System.Diagnostics.Stopwatch]::StartNew()

$configAppInsightsClientTimer = [System.Diagnostics.Stopwatch]::StartNew()
# Get app insights binaries and set up app insights client
mkdir c:\k\appinsights
DownloadFileOverHttp -Url "https://globalcdn.nuget.org/packages/microsoft.applicationinsights.2.11.0.nupkg" -DestinationPath "c:\k\appinsights\microsoft.applicationinsights.2.11.0.zip"
Expand-Archive -Path "c:\k\appinsights\microsoft.applicationinsights.2.11.0.zip" -DestinationPath "c:\k\appinsights"
$appInsightsDll = "c:\k\appinsights\lib\net46\Microsoft.ApplicationInsights.dll"
[Reflection.Assembly]::LoadFile($appInsightsDll)
$conf = New-Object "Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration"
$conf.DisableTelemetry = -not $global:enableTelemetry
$conf.InstrumentationKey = $global:TelemetryKey
$global:AppInsightsClient = New-Object "Microsoft.ApplicationInsights.TelemetryClient"($conf)

$global:AppInsightsClient.Context.Properties["correlation_id"] = New-Guid
$global:AppInsightsClient.Context.Properties["cri"] = $global:ContainerRuntime
# TODO: Update once containerd versioning story is decided
$global:AppInsightsClient.Context.Properties["cri_version"] = if ($global:ContainerRuntime -eq "docker") { $global:DockerVersion } else { "" }
$global:AppInsightsClient.Context.Properties["k8s_version"] = $global:KubeBinariesVersion
$global:AppInsightsClient.Context.Properties["lb_sku"] = $global:LoadBalancerSku
$global:AppInsightsClient.Context.Properties["location"] = $Location
$global:AppInsightsClient.Context.Properties["os_type"] = "windows"
$global:AppInsightsClient.Context.Properties["os_version"] = Get-WindowsVersion
$global:AppInsightsClient.Context.Properties["network_plugin"] = $global:NetworkPlugin
$global:AppInsightsClient.Context.Properties["network_plugin_version"] = Get-CniVersion
$global:AppInsightsClient.Context.Properties["network_mode"] = $global:NetworkMode
$global:AppInsightsClient.Context.Properties["subscription_id"] = $global:SubscriptionId

$vhdId = ""
if (Test-Path "c:\vhd-id.txt") {
$vhdId = Get-Content "c:\vhd-id.txt"
}
$global:AppInsightsClient.Context.Properties["vhd_id"] = $vhdId

$imdsProperties = Get-InstanceMetadataServiceTelemetry
foreach ($key in $imdsProperties.keys) {
$global:AppInsightsClient.Context.Properties[$key] = $imdsProperties[$key]
}

$configAppInsightsClientTimer.Stop()
$global:AppInsightsClient.TrackMetric("Config-AppInsightsClient", $configAppInsightsClientTimer.Elapsed.TotalSeconds)

# Install OpenSSH if SSH enabled
$sshEnabled = [System.Convert]::ToBoolean("{{ WindowsSSHEnabled }}")

if ( $sshEnabled ) {
Write-Log "Install OpenSSH"
$installOpenSSHTimer = [System.Diagnostics.Stopwatch]::StartNew()
Install-OpenSSH -SSHKeys $SSHKeys
$installOpenSSHTimer.Stop()
$global:AppInsightsClient.TrackMetric("Install-OpenSSH", $installOpenSSHTimer.Elapsed.TotalSeconds)
}

Write-Log "Apply telemetry data setting"
Set-TelemetrySetting -WindowsTelemetryGUID $global:WindowsTelemetryGUID

Write-Log "Resize os drive if possible"
$resizeTimer = [System.Diagnostics.Stopwatch]::StartNew()
Resize-OSDrive
$resizeTimer.Stop()
$global:AppInsightsClient.TrackMetric("Resize-OSDrive", $resizeTimer.Elapsed.TotalSeconds)

Write-Log "Initialize data disks"
Initialize-DataDisks
Expand Down Expand Up @@ -277,16 +225,13 @@ try
}

Write-Log "Installing ContainerD"
$containerdTimer = [System.Diagnostics.Stopwatch]::StartNew()
$cniBinPath = $global:AzureCNIBinDir
$cniConfigPath = $global:AzureCNIConfDir
if ($global:NetworkPlugin -eq "kubenet") {
$cniBinPath = $global:CNIPath
$cniConfigPath = $global:CNIConfigPath
}
Install-Containerd -ContainerdUrl $global:ContainerdUrl -CNIBinDir $cniBinPath -CNIConfDir $cniConfigPath -KubeDir $global:KubeDir
$containerdTimer.Stop()
$global:AppInsightsClient.TrackMetric("Install-ContainerD", $containerdTimer.Elapsed.TotalSeconds)

Write-Log "Write Azure cloud provider config"
Write-AzureConfig `
Expand Down Expand Up @@ -339,10 +284,7 @@ try
}

Write-Log "Create the Pause Container kubletwin/pause"
$infraContainerTimer = [System.Diagnostics.Stopwatch]::StartNew()
New-InfraContainer -KubeDir $global:KubeDir
$infraContainerTimer.Stop()
$global:AppInsightsClient.TrackMetric("New-InfraContainer", $infraContainerTimer.Elapsed.TotalSeconds)

if (-not (Test-ContainerImageExists -Image "kubletwin/pause")) {
Write-Log "Could not find container with name kubletwin/pause"
Expand Down Expand Up @@ -481,10 +423,6 @@ try
Remove-Item $CacheDir -Recurse -Force
}

$global:globalTimer.Stop()
$global:AppInsightsClient.TrackMetric("TotalDuration", $global:globalTimer.Elapsed.TotalSeconds)
$global:AppInsightsClient.Flush()

Write-Log "Setup Complete, reboot computer"
Restart-Computer
}
Expand All @@ -496,11 +434,6 @@ try
}
catch
{
$exceptionTelemtry = New-Object "Microsoft.ApplicationInsights.DataContracts.ExceptionTelemetry"
$exceptionTelemtry.Exception = $_.Exception
$global:AppInsightsClient.TrackException($exceptionTelemtry)
$global:AppInsightsClient.Flush()

Write-Error $_
throw $_
}
77 changes: 0 additions & 77 deletions pkg/engine/templates_generated.go

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

1 change: 0 additions & 1 deletion vhd/packer/configure-windows-vhd-phase2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ function Get-FilesToCacheOnVHD {
"https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/debug/VFP.psm1",
"https://github.com/microsoft/SDN/raw/master/Kubernetes/windows/helper.psm1",
"https://github.com/microsoft/SDN/raw/master/Kubernetes/windows/hns.v2.psm1"
"https://globalcdn.nuget.org/packages/microsoft.applicationinsights.2.11.0.nupkg"
);
"c:\akse-cache\containerd\" = @(
$global:containerdPackageUrl
Expand Down
1 change: 0 additions & 1 deletion vhd/packer/configure-windows-vhd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ function Get-FilesToCacheOnVHD {
"https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/debug/VFP.psm1",
"https://github.com/microsoft/SDN/raw/master/Kubernetes/windows/helper.psm1",
"https://github.com/microsoft/SDN/raw/master/Kubernetes/windows/hns.v2.psm1"
"https://globalcdn.nuget.org/packages/microsoft.applicationinsights.2.11.0.nupkg"
);
"c:\akse-cache\containerd\" = @(
$global:containerdPackageUrl
Expand Down