Skip to content

Commit 9b4e169

Browse files
authored
Merge branch 'master' into estebanca/implement-zap-for-cni
2 parents b0f51c3 + e45ad21 commit 9b4e169

24 files changed

+647
-34
lines changed

.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml

+7-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ stages:
3737
inlineScript: |
3838
set -ex
3939
az extension add --name aks-preview
40-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
40+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
4141
ls -lah
4242
pwd
4343
kubectl cluster-info
@@ -70,6 +70,8 @@ stages:
7070
- template: ../load-test-templates/pod-deployment-template.yaml
7171
parameters:
7272
clusterName: ${{ parameters.clusterName }}
73+
scaleup: 2400
74+
os: linux
7375
- stage: validate_state
7476
dependsOn: pod_deployment
7577
displayName: "Validate State"
@@ -122,7 +124,7 @@ stages:
122124
addSpnToEnvironment: true
123125
inlineScript: |
124126
set -ex
125-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
127+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
126128
name: "GetCluster"
127129
displayName: "Get AKS Cluster"
128130
- script: |
@@ -149,9 +151,9 @@ stages:
149151
if [ "$(DELETE_RESOURCES)" ]
150152
then
151153
echo "Deleting Cluster and resource group"
152-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
153-
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
154-
make -C ./hack/swift down AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${{ parameters.clusterName }}-$(make revision)
154+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
155+
make -C ./hack/aks azcfg AZCLI=az REGION=$(LOCATION)
156+
make -C ./hack/aks down AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${{ parameters.clusterName }}-$(make revision)
155157
echo "Cluster and resources down"
156158
else
157159
echo "Deletion of resources is False"

.pipelines/cni/load-test-templates/create-cluster-template.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ parameters:
33
clusterName: ""
44
nodeCount: ""
55
vmSize: ""
6+
windowsVMSize: ""
67

78
steps:
89
- task: AzureCLI@1
@@ -13,7 +14,7 @@ steps:
1314
addSpnToEnvironment: true
1415
inlineScript: |
1516
set -ex
16-
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
17-
make -C ./hack/swift ${{ parameters.clusterType }} AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${{ parameters.clusterName }}-$(make revision) NODE_COUNT=${{ parameters.nodeCount }} VM_SIZE=${{ parameters.vmSize }}
17+
make -C ./hack/aks azcfg AZCLI=az REGION=$(LOCATION)
18+
make -C ./hack/aks ${{ parameters.clusterType }} AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${{ parameters.clusterName }}-$(make revision) NODE_COUNT=${{ parameters.nodeCount }} VM_SIZE=${{ parameters.vmSize }} WINDOWS_VM_SKU=${{ parameters.windowsVMSize }} WINDOWS_USERNAME=${WINDOWS_USERNAME} WINDOWS_PASSWORD=${WINDOWS_PASSWORD}
1819
name: "CreateAksCluster"
1920
displayName: "Create AKS Cluster"

.pipelines/cni/load-test-templates/pod-deployment-template.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
parameters:
22
clusterName: ""
3-
3+
scaleup: 1000
4+
os: ""
5+
iterations: 4
6+
47
steps:
58
- task: AzureCLI@1
69
displayName: "Pod Deployment"
@@ -12,6 +15,6 @@ steps:
1215
inlineScript: |
1316
set -ex
1417
az extension add --name aks-preview
15-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
18+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
1619
cd test/integration/load
17-
go test -timeout 30m -tags load -run ^TestLoad$ -tags=load -iterations=4 -scaleup=2400
20+
go test -timeout 30m -tags load -run ^TestLoad$ -tags=load -iterations=${{ parameters.iterations }} -scaleup=${{ parameters.scaleup }} -os=${{ parameters.os }}

.pipelines/cni/load-test-templates/restart-node-template.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ steps:
1111
inlineScript: |
1212
echo "Scale up the pods and immediated restart the nodes"
1313
clusterName=${{ parameters.clusterName }}-$(make revision)
14-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${clusterName}
15-
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
14+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${clusterName}
15+
make -C ./hack/aks azcfg AZCLI=az REGION=$(LOCATION)
1616
cd test/integration/load
1717
echo "Scaling the pods down to 100 per node"
1818
go test -count 1 -timeout 30m -tags load -run ^TestScaleDeployment$ -tags=load -scaleup=1000 -skip-wait=true
1919
cd ../../../
2020
echo "Restarting the nodes"
2121
vmss_name=$(az vmss list -g MC_${clusterName}_${clusterName}_$(LOCATION) --query "[].name" -o tsv)
22-
make -C ./hack/swift restart-vmss AZCLI=az CLUSTER=${clusterName} REGION=$(LOCATION) VMSS_NAME=$vmss_name
22+
make -C ./hack/aks restart-vmss AZCLI=az CLUSTER=${clusterName} REGION=$(LOCATION) VMSS_NAME=$vmss_name
2323
cd test/integration/load
2424
go test -count 1 -timeout 30m -tags load -run ^TestScaleDeployment$ -tags=load -replicas=1000
2525
name: "RestartNodes"
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
parameters:
22
clusterName: ""
3+
os: "linux"
34
restartCase: "false"
45

56
steps:
@@ -10,10 +11,9 @@ steps:
1011
scriptType: "bash"
1112
addSpnToEnvironment: true
1213
inlineScript: |
13-
export RESTART_CASE=${{ parameters.restartCase }}
14-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
14+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
1515
kubectl get pods -A
16-
make test-validate-state
16+
make test-validate-state OS=${{ parameters.os }} RESTART_CASE=${{ parameters.restartCase }}
1717
name: "ValidateState"
1818
displayName: "Validate State"
1919
retryCountOnTaskFailure: 3

.pipelines/cni/pipeline.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,14 @@ stages:
2424
nodeCount: 10
2525
vmSize: "Standard_DS4_v2"
2626
dependsOn: setup
27+
- template: singletenancy/windows-cni-load-test-template.yaml
28+
parameters:
29+
name: win_cniv1
30+
clusterType: "windows-cniv1-up"
31+
clusterName: "win-cniv1"
32+
nodeCount: 2
33+
vmSize: "Standard_B2s"
34+
dependsOn: setup
35+
windowsVMSize: ${WINDOWS_VM_SKU}
36+
os: windows
37+
cni: cniv1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
parameters:
2+
dependsOn: ""
3+
name: ""
4+
clusterType: ""
5+
clusterName: ""
6+
nodeCount: ""
7+
vmSize: ""
8+
windowsVMSize: ""
9+
os: ""
10+
cni: ""
11+
12+
stages:
13+
- stage: createAKSclusterWindows
14+
dependsOn: ${{ parameters.dependsOn }}
15+
displayName: "Windows AKS Cluster ${{ parameters.cni }}"
16+
jobs:
17+
- job: create_aks_cluster_with_${{ parameters.name }}
18+
steps:
19+
- template: ../load-test-templates/create-cluster-template.yaml
20+
parameters:
21+
clusterType: ${{ parameters.clusterType }}
22+
clusterName: ${{ parameters.clusterName }}
23+
nodeCount: ${{ parameters.nodeCount }}
24+
vmSize: ${{ parameters.vmSize }}
25+
windowsVMSize: ${{ parameters.windowsVMSize }}
26+
- stage: build_images
27+
dependsOn: ${{ parameters.dependsOn }}
28+
displayName: "Build CNI Images"
29+
jobs:
30+
- job: build_cni_images
31+
pool:
32+
name: "$(BUILD_POOL_NAME_LINUX_AMD64)"
33+
strategy:
34+
matrix:
35+
windows_cniv1_amd64:
36+
os: windows
37+
name: cni-plugin
38+
arch: amd64
39+
os_version: ltsc2022
40+
steps:
41+
- template: ../../containers/container-template.yaml
42+
parameters:
43+
arch: $(arch)
44+
name: $(name)
45+
os: $(os)
46+
os_version: $(os_version)
47+
- stage: update_cni
48+
dependsOn:
49+
- createAKSclusterWindows
50+
- build_images
51+
displayName: "Update CNI on Cluster"
52+
jobs:
53+
- job: deploy_pods
54+
strategy:
55+
matrix:
56+
windows_cniv1_amd64:
57+
os: windows
58+
arch: amd64
59+
os_version: ltsc2022
60+
steps:
61+
- task: AzureCLI@1
62+
inputs:
63+
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
64+
scriptLocation: "inlineScript"
65+
scriptType: "bash"
66+
addSpnToEnvironment: true
67+
inlineScript: |
68+
set -ex
69+
export CNI_IMAGE=$(make acncli-image-name-and-tag OS=$(os) ARCH=$(arch) OS_VERSION=$(os_version))
70+
az extension add --name aks-preview
71+
clusterName=${{ parameters.clusterName }}-$(make revision)
72+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${clusterName}
73+
make -C ./hack/aks azcfg AZCLI=az REGION=$(LOCATION)
74+
envsubst < ./hack/manifests/windows-update.yaml | kubectl apply -f -
75+
name: "UploadCNI"
76+
displayName: "Upload CNI"
77+
- script: |
78+
set -ex
79+
kubectl rollout status daemonset/azure-cni-windows -n kube-system
80+
kubectl get pods -A
81+
name: "WaitForCNI"
82+
displayName: "Wait For CNI"
83+
- stage: pod_deployment_windows
84+
dependsOn: update_cni
85+
displayName: "Pod Deployment"
86+
jobs:
87+
- job: deploy_pods
88+
steps:
89+
- template: ../load-test-templates/pod-deployment-template.yaml
90+
parameters:
91+
clusterName: ${{ parameters.clusterName }}
92+
scaleup: ${WINDOWS_SCALEUP}
93+
os: ${{ parameters.os }}
94+
cni: ${{ parameters.cni }}
95+
iterations: ${WINDOWS_ITERATIONS}
96+
- stage: validate_state_windows
97+
dependsOn: pod_deployment_windows
98+
displayName: "Validate State"
99+
jobs:
100+
- job: validate_state
101+
steps:
102+
- template: ../load-test-templates/validate-state-template.yaml
103+
parameters:
104+
clusterName: ${{ parameters.clusterName }}
105+
os: ${{ parameters.os }}
106+
cni: ${{ parameters.cni }}
107+
- stage: delete_resources
108+
displayName: "Delete Resources"
109+
dependsOn:
110+
- validate_state_windows
111+
jobs:
112+
- job: delete_resources
113+
steps:
114+
- task: AzureCLI@1
115+
inputs:
116+
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
117+
scriptLocation: "inlineScript"
118+
scriptType: "bash"
119+
addSpnToEnvironment: true
120+
inlineScript: |
121+
set -ex
122+
if [ "$(DELETE_RESOURCES)" ]
123+
then
124+
echo "Deleting Cluster and resource group"
125+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
126+
make -C ./hack/aks azcfg AZCLI=az REGION=$(LOCATION)
127+
make -C ./hack/aks down AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${{ parameters.clusterName }}-$(make revision)
128+
echo "Cluster and resources down"
129+
else
130+
echo "Deletion of resources is False"
131+
fi
132+
name: "CleanUpCluster"
133+
displayName: "Cleanup cluster"
134+
condition: always()

.pipelines/singletenancy/aks-swift/e2e-step-template.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ steps:
3232
inlineScript: |
3333
mkdir -p ~/.kube/
3434
echo "Create AKS cluster"
35-
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
36-
make -C ./hack/swift byocni-up AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-${{ parameters.osSku }}-$(make revision) OSSKU=${{ parameters.osSku }}
35+
make -C ./hack/aks azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
36+
make -C ./hack/aks byocni-up AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-${{ parameters.osSku }}-$(make revision) OSSKU=${{ parameters.osSku }}
3737
echo "Cluster successfully created"
3838
displayName: Create test cluster
3939
condition: succeeded()
@@ -124,8 +124,8 @@ steps:
124124
addSpnToEnvironment: true
125125
inlineScript: |
126126
echo "Deleting cluster"
127-
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
128-
make -C ./hack/swift down AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-${{ parameters.osSku }}-$(make revision)
127+
make -C ./hack/aks azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
128+
make -C ./hack/aks down AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-${{ parameters.osSku }}-$(make revision)
129129
echo "Cluster and resources down"
130130
name: "Cleanupcluster"
131131
displayName: "Cleanup cluster"

.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ steps:
3131
inlineScript: |
3232
mkdir -p ~/.kube/
3333
echo "Create AKS Overlay cluster"
34-
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_OVERLAY_CLUSTER_TEST)
35-
make -C ./hack/swift overlay-no-kube-proxy-up AZCLI=az REGION=$(REGION_OVERLAY_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-$(make revision) VM_SIZE=Standard_B2ms
34+
make -C ./hack/aks azcfg AZCLI=az REGION=$(REGION_OVERLAY_CLUSTER_TEST)
35+
make -C ./hack/aks overlay-no-kube-proxy-up AZCLI=az REGION=$(REGION_OVERLAY_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-$(make revision) VM_SIZE=Standard_B2ms
3636
echo "Cluster successfully created"
3737
displayName: Create Overlay cluster
3838
condition: succeeded()
@@ -189,8 +189,8 @@ steps:
189189
addSpnToEnvironment: true
190190
inlineScript: |
191191
echo "Deleting cluster"
192-
make -C ./hack/swift azcfg AZCLI=az
193-
make -C ./hack/swift down SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
192+
make -C ./hack/aks azcfg AZCLI=az
193+
make -C ./hack/aks down SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
194194
echo "Cluster and resources down"
195195
name: "Cleanupcluster"
196196
displayName: "Cleanup cluster"

.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ steps:
3131
inlineScript: |
3232
mkdir -p ~/.kube/
3333
echo "Create AKS cluster"
34-
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
35-
make -C ./hack/swift swift-no-kube-proxy-up AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-$(make revision) VM_SIZE=Standard_B2ms
34+
make -C ./hack/aks azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
35+
make -C ./hack/aks swift-no-kube-proxy-up AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-$(make revision) VM_SIZE=Standard_B2ms
3636
echo "Cluster successfully created"
3737
displayName: Create test cluster
3838
condition: succeeded()
@@ -173,8 +173,8 @@ steps:
173173
addSpnToEnvironment: true
174174
inlineScript: |
175175
echo "Deleting cluster"
176-
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
177-
make -C ./hack/swift down AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-$(make revision)
176+
make -C ./hack/aks azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
177+
make -C ./hack/aks down AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-$(make revision)
178178
echo "Cluster and resources down"
179179
name: "Cleanupcluster"
180180
displayName: "Cleanup cluster"

Makefile

+14-1
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,19 @@ npm-image-pull: ## pull cns container image.
438438
IMAGE=$(NPM_IMAGE) \
439439
TAG=$(NPM_PLATFORM_TAG)
440440

441+
# cni-plugin
442+
443+
cni-plugin-image: ## build cni plugin container image.
444+
$(MAKE) container \
445+
DOCKERFILE=cni/build/$(OS).Dockerfile \
446+
IMAGE=$(ACNCLI_IMAGE) \
447+
EXTRA_BUILD_ARGS='--build-arg CNI_AI_PATH=$(CNI_AI_PATH) --build-arg CNI_AI_ID=$(CNI_AI_ID) --build-arg OS_VERSION=$(OS_VERSION)' \
448+
PLATFORM=$(PLATFORM) \
449+
TAG=$(ACNCLI_PLATFORM_TAG) \
450+
OS=$(OS) \
451+
ARCH=$(ARCH) \
452+
OS_VERSION=$(OS_VERSION)
453+
441454

442455
## Legacy
443456

@@ -724,7 +737,7 @@ test-integration: ## run all integration tests.
724737
go test -mod=readonly -buildvcs=false -timeout 1h -coverpkg=./... -race -covermode atomic -coverprofile=coverage.out -tags=integration ./test/integration...
725738

726739
test-validate-state:
727-
cd test/integration/load && go test -count 1 -timeout 30m -tags load -run ^TestValidateState -tags=load -restart-case=$(RESTART_CASE)
740+
cd test/integration/load && go test -count 1 -timeout 30m -tags load -run ^TestValidateState -tags=load -restart-case=$(RESTART_CASE) -os=$(OS)
728741
cd ../../..
729742

730743
test-cyclonus: ## run the cyclonus test for npm.

cni/build/windows.Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ARG OS_VERSION
2+
FROM --platform=linux/amd64 mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS builder
3+
ARG VERSION
4+
ARG CNI_AI_PATH
5+
ARG CNI_AI_ID
6+
WORKDIR /azure-container-networking
7+
COPY . .
8+
RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet.exe -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go
9+
RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet-telemetry.exe -trimpath -ldflags "-X main.version="$VERSION" -X "$CNI_AI_PATH"="$CNI_AI_ID"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/telemetrymain.go
10+
RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet-ipam.exe -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/ipam/plugin/main.go
11+
12+
FROM mcr.microsoft.com/windows/servercore:${OS_VERSION}
13+
SHELL ["powershell", "-command"]
14+
COPY --from=builder /azure-container-networking/azure-vnet.exe azure-vnet.exe
15+
COPY --from=builder /azure-container-networking/azure-vnet-telemetry.exe azure-vnet-telemetry.exe
16+
COPY --from=builder /azure-container-networking/azure-vnet-ipam.exe azure-vnet-ipam.exe
17+
18+
# This would be replaced with dropgz version of windows.
19+
COPY --from=builder /azure-container-networking/hack/scripts/updatecni.ps1 updatecni.ps1
20+
ENTRYPOINT ["powershell.exe", ".\\updatecni.ps1"]

0 commit comments

Comments
 (0)