Skip to content

Instantly share code, notes, and snippets.

@gabriel-samfira
Last active June 3, 2022 12:23
Show Gist options
  • Save gabriel-samfira/7b3b519a6a55303329f9278933f7e014 to your computer and use it in GitHub Desktop.
Save gabriel-samfira/7b3b519a6a55303329f9278933f7e014 to your computer and use it in GitHub Desktop.
$ErrorActionPreference="Stop"
# Considerable performance boost withour realtime monitoring.
# This is usually okay on temporary test systems. Don't do this
# on your own machine.
Set-MpPreference -DisableRealtimeMonitoring:$true
wget -UseBasicParsing -OutFile "$HOME\prepare_env_windows.ps1" -Uri https://gist.githubusercontent.com/gabriel-samfira/c80ccb1d79be737e5e61214181e48ad8/raw/4aa3d3efe643f70c9b8bcd139b3afca798900262/prepare_env_windows.ps1
& "$HOME\prepare_env_windows.ps1"
git clone https://github.com/containerd/containerd C:\containerd
if ($LASTEXITCODE) {
Write-Error "Failed to clone containerd repo"
exit 1
}
cd C:\containerd
make binaries
if ($LASTEXITCODE) {
Write-Error "Failed to build containerd binaries"
exit 1
}
# Pull junit conversion tool
go install github.com/jstemmer/go-junit-report@v0.9.1
# Get critctl tool. Used for cri-integration tests
$CRICTL_DOWNLOAD_URL="https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.21.0/crictl-v1.21.0-windows-amd64.tar.gz"
curl.exe -L $CRICTL_DOWNLOAD_URL -o c:\crictl.tar.gz
if ($LASTEXITCODE) {
Write-Error "Failed to download crictl"
exit 1
}
tar xvf c:\crictl.tar.gz -C "C:\containerd\bin"
if ($LASTEXITCODE) {
Write-Error "Failed to extract crictl"
exit 1
}
wget -UseBasicParsing -OutFile "$HOME/hns.psm1" https://raw.githubusercontent.com/microsoft/SDN/master/Kubernetes/windows/hns.psm1
Import-Module "$HOME\hns.psm1"
New-HnsNetwork -Type NAT -Name nat -AddressPrefix 172.19.208.0/20 -Gateway 172.19.208.1
$env:GOPATH = (go env GOPATH)
bash C:\containerd\script\setup\install-cni-windows
if ($LASTEXITCODE) {
Write-Error "Failed to install Windows CNI"
exit 1
}
git clone https://github.com/kubernetes-sigs/cri-tools $HOME\cri-tools
if ($LASTEXITCODE) {
Write-Error "Failed to clone cri-tools"
exit 1
}
cd $HOME\cri-tools
go build -o C:\containerd\bin\crictl.exe .\cmd\crictl\
if ($LASTEXITCODE) {
Write-Error "Failed to build crictl"
exit 1
}
Write-Warning "Creating C:\containerd\repolist.toml"
Set-Content C:\containerd\repolist.toml @"
busybox = "k8s.gcr.io/e2e-test-images/busybox:1.29-2"
ResourceConsumer = "k8s.gcr.io/e2e-test-images/resource-consumer:1.10"
"@
mkdir C:\tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment