Skip to content

Commit 7c4e48c

Browse files
authored
ci: Add Cilium to CNI | LSG Integration Pipeline (#2574)
* ci: Kernel upgrade template * ci: lsg cni intergration template * chore: address comments * ci: add IPAM repo/ver control * ci: add cilium * chore: template style * fix: DAG logic * ci: finalize changes * ci: update cilium filepaths * ci: address comments
1 parent b7d38ae commit 7c4e48c

File tree

4 files changed

+179
-82
lines changed

4 files changed

+179
-82
lines changed

.pipelines/cni/lsg/kernel-upgrade-template.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ steps:
4747
privList=`kubectl get pods -n kube-system -l os=linux,app=privileged-daemonset -owide --no-headers | awk '{print $1}'`
4848
for pod in $privList; do
4949
echo "-- Add proposed repository --"
50-
kubectl exec -i -n kube-system $pod -- bash -c "add-apt-repository ppa:canonical-kernel-team/${{ parameters.ProposedRepoVersion }} -y"
50+
kubectl exec -i -n kube-system $pod -- bash -c "add-apt-repository ppa:canonical-kernel-team/$(ProposedRepoVersion) -y"
51+
5152
echo "-- Check apt-cache --"
5253
kubectl exec -i -n kube-system $pod -- bash -c "apt-cache madison $(kernelType)"
5354
@@ -58,12 +59,11 @@ steps:
5859
5960
for pod in $privList; do
6061
flag1=""
61-
flag2=""
6262
echo "-- Confirm Proposed Repository --"
6363
temp=`kubectl exec -i -n kube-system $pod -- bash -c "apt-cache madison $(kernelType)" | grep proposed | awk '{print $3}'`
6464
for t in $temp; do
65-
if [[ $t =~ ${{ parameters.KernelVersion }} ]]; then
66-
echo "$t - looking for ${{ parameters.KernelVersion }}"
65+
if [[ $t =~ $(KernelVersion) ]]; then
66+
echo "$t - looking for $(KernelVersion)"
6767
flag1="true"
6868
fi
6969
done
@@ -126,8 +126,8 @@ steps:
126126
echo "-- Confirm Ubuntu Kernel --"
127127
kernelOut=`kubectl exec -i -n kube-system $pod -- bash -c "uname -r"`
128128
ver=(${kernelOut//-/ }) # Slices $kernelOut with '-'
129-
echo "$pod | kernel version - $kernelOut, expected - ${{ parameters.KernelVersion }}"
130-
if [[ ! ${{ parameters.KernelVersion }} =~ ${ver[1]} ]]; then
129+
echo "$pod | kernel version - $kernelOut, expected - $(KernelVersion)"
130+
if [[ ! $(KernelVersion) =~ ${ver[1]} ]]; then
131131
exit 1
132132
fi
133133
done

.pipelines/cni/lsg/lsg-cni-intergration-template.yaml

Lines changed: 133 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ parameters:
99
arch: ""
1010
osSKU: Ubuntu
1111

12-
# CNIv2
13-
# + Should be able to scale up/down the pods successfully certain number of times.
14-
# + Node reboot scenarios should be covered.
15-
# + The CNS state should be validated with that of CNI state.
16-
# + Pods should have ips assigned and connectivity/datapath test should be present.
17-
# + CNS restart and validates the state
18-
1912
stages:
2013
- stage: create_${{ parameters.name }}
2114
variables:
@@ -35,6 +28,7 @@ stages:
3528
scriptType: "bash"
3629
addSpnToEnvironment: true
3730
inlineScript: |
31+
make -C ./hack/aks azcfg AZCLI=az REGION=$(LOCATION)
3832
make -C ./hack/aks ${{ parameters.clusterType }} \
3933
AZCLI=az REGION=$(LOCATION) SUB=$(SUB_AZURE_NETWORK_AGENT_BUILD_VALIDATIONS) \
4034
CLUSTER=${{ parameters.clusterName }}-$(commitID) \
@@ -49,43 +43,81 @@ stages:
4943
cnsVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.cnsVersion'] ]
5044
cniVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.cniVersion'] ]
5145
kernelType: $[ stagedependencies.setup.env.outputs['SetEnvVars.kernelType'] ]
46+
ipamVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.ipamVersion'] ]
5247
pool:
5348
name: $(BUILD_POOL_NAME_DEFAULT)
5449
dependsOn:
5550
- create_${{ parameters.name }}
5651
- setup
5752
displayName: "CNIv2 Test - ${{ parameters.name }}"
5853
jobs:
59-
- job: integration
60-
displayName: "Integration Test - ${{ parameters.name }}"
61-
steps:
62-
- task: AzureCLI@1
63-
inputs:
64-
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
65-
scriptLocation: "inlineScript"
66-
scriptType: "bash"
67-
addSpnToEnvironment: true
68-
inlineScript: |
69-
echo cns version - $(cnsVersion)
70-
echo cni version - $(cniVersion)
54+
- ${{ if contains(parameters.name, 'linux') }}:
55+
- job: integration
56+
displayName: "Integration Test - ${{ parameters.name }}"
57+
steps:
58+
- task: AzureCLI@1
59+
inputs:
60+
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
61+
scriptLocation: "inlineScript"
62+
scriptType: "bash"
63+
addSpnToEnvironment: true
64+
inlineScript: |
65+
echo cns version - $(cnsVersion)
66+
echo cni version - $(cniVersion)
7167
72-
echo "Start Integration Tests on Overlay Cluster"
73-
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(commitID)
74-
kubectl cluster-info
75-
kubectl get po -owide -A
76-
sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(cnsVersion) CNI_VERSION=$(cniVersion) INSTALL_CNS=true INSTALL_AZURE_CNI_OVERLAY=true CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) CNI_IMAGE_REPO=$(CNI_IMAGE_REPO)
77-
name: "overlaye2e"
78-
displayName: "Overlay Integration"
79-
retryCountOnTaskFailure: 2
68+
echo "Start Integration Tests on Overlay Cluster"
69+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(commitID)
70+
kubectl cluster-info
71+
kubectl get po -owide -A
72+
sudo -E env "PATH=$PATH" make test-load CNS_ONLY=true CNS_VERSION=$(cnsVersion) CNI_VERSION=$(cniVersion) INSTALL_CNS=true INSTALL_AZURE_CNI_OVERLAY=true CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) CNI_IMAGE_REPO=$(CNI_IMAGE_REPO)
73+
name: "overlaye2e"
74+
displayName: "Overlay Integration"
75+
retryCountOnTaskFailure: 2
76+
- ${{ if contains(parameters.name, 'cilium') }}:
77+
- job: integration
78+
displayName: "Deploy Cilium Components"
79+
steps:
80+
- task: AzureCLI@1
81+
displayName: "Install Cilium, CNS, and ip-masq-agent"
82+
retryCountOnTaskFailure: 2
83+
inputs:
84+
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
85+
scriptLocation: "inlineScript"
86+
scriptType: "bash"
87+
addSpnToEnvironment: true
88+
inlineScript: |
89+
set -ex
90+
az extension add --name aks-preview
91+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(commitID)
92+
ls -lah
93+
pwd
94+
kubectl cluster-info
95+
kubectl get po -owide -A
96+
97+
echo "install Cilium ${CILIUM_VERSION_TAG}"
98+
export DIR=${CILIUM_VERSION_TAG%.*}
99+
echo "installing files from ${DIR}"
100+
101+
echo "deploy Cilium ConfigMap"
102+
kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-config/cilium-config.yaml
103+
104+
# Passes Cilium image to daemonset and deployment
105+
kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-agent/files
106+
kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-operator/files
107+
108+
envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-agent/templates/daemonset.yaml | kubectl apply -f -
109+
envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-operator/templates/deployment.yaml | kubectl apply -f -
110+
kubectl get po -owide -A
111+
echo "Deploy Azure-CNS"
112+
sudo -E env "PATH=$PATH" make test-load CNS_ONLY=true AZURE_IPAM_VERSION=$(ipamVersion) CNS_VERSION=$(cnsVersion) INSTALL_CNS=true INSTALL_OVERLAY=true CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) IPAM_IMAGE_REPO=$(IPAM_IMAGE_REPO)
113+
kubectl get po -owide -A
80114
- job: kernel_upgrade
81115
displayName: "Kernel Node Upgrade"
82116
dependsOn: integration
83117
steps:
84118
- template: kernel-upgrade-template.yaml
85119
parameters:
86120
clusterName: ${{ parameters.clusterName }}-$(commitID)
87-
KernelVersion : ${{ parameters.KernelVersion }}
88-
ProposedRepoVersion : ${{ parameters.ProposedRepoVersion }}
89121
- job: deploy_pods
90122
displayName: "Scale Test"
91123
dependsOn: kernel_upgrade
@@ -97,12 +129,12 @@ stages:
97129
os: ${{ parameters.os }}
98130
iterations: ${ITERATIONS_LINUX}
99131
nodeCount: ${{ parameters.nodeCount }}
100-
cni: cniv2
132+
cni: ${{ parameters.cni }}
101133
- template: ../load-test-templates/validate-state-template.yaml
102134
parameters:
103135
clusterName: ${{ parameters.clusterName }}-$(commitID)
104136
os: ${{ parameters.os }}
105-
cni: cniv2
137+
cni: ${{ parameters.cni }}
106138
- job: restart_nodes
107139
displayName: "Restart Test"
108140
dependsOn: deploy_pods
@@ -111,12 +143,12 @@ stages:
111143
parameters:
112144
clusterName: ${{ parameters.clusterName }}-$(commitID)
113145
os: ${{ parameters.os }}
114-
cni: cniv2
146+
cni: ${{ parameters.cni }}
115147
- template: ../load-test-templates/validate-state-template.yaml
116148
parameters:
117149
clusterName: ${{ parameters.clusterName }}-$(commitID)
118150
os: ${{ parameters.os }}
119-
cni: cniv2
151+
cni: ${{ parameters.cni }}
120152
restartCase: "true"
121153
- job: restart_cns
122154
displayName: "Restart and Validate CNS"
@@ -126,7 +158,7 @@ stages:
126158
parameters:
127159
clusterName: ${{ parameters.clusterName }}-$(commitID)
128160
os: ${{ parameters.os }}
129-
cni: cniv2
161+
cni: ${{ parameters.cni }}
130162
scaleup: ${SCALEUP_LINUX}
131163
nodeCount: ${{ parameters.nodeCount }}
132164
- job: recover
@@ -149,17 +181,71 @@ stages:
149181
kubectl get po -owide -A
150182
name: "recover"
151183
displayName: "Delete test Namespaces"
152-
- template: ../k8s-e2e/k8s-e2e-job-template.yaml
153-
parameters:
154-
sub: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
155-
clusterName: ${{ parameters.clusterName }}-$(commitID)
156-
os: ${{ parameters.os }}
157-
dependsOn: recover
158-
datapath: true
159-
dns: true
160-
portforward: true
161-
service: true
162-
hostport: true
184+
- job: cni_tests
185+
displayName: "Cilium Test"
186+
dependsOn: recover
187+
condition: and( succeeded(), ${{ contains(parameters.cni, 'cilium') }} )
188+
steps:
189+
- script: |
190+
echo "install cilium CLI"
191+
if [[ ${CILIUM_VERSION_TAG} =~ ^1.1[1-3].[0-9]{1,2} ]]; then
192+
echo "Cilium Agent Version ${BASH_REMATCH[0]}"
193+
CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable-v0.14.txt)
194+
else
195+
echo "Cilium Agent Version ${CILIUM_VERSION_TAG}"
196+
CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
197+
fi
198+
CLI_ARCH=amd64
199+
curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
200+
sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
201+
sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
202+
rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
203+
cilium status
204+
cilium version
205+
name: "InstallCiliumCli"
206+
displayName: "Install Cilium CLI"
207+
- task: AzureCLI@1
208+
inputs:
209+
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
210+
scriptLocation: "inlineScript"
211+
scriptType: "bash"
212+
addSpnToEnvironment: true
213+
inlineScript: |
214+
set -ex
215+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(commitID)
216+
name: "GetCluster"
217+
displayName: "Get AKS Cluster"
218+
- script: |
219+
kubectl delete ns load-test
220+
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption'
221+
retryCountOnTaskFailure: 6
222+
name: "CiliumConnectivityTests"
223+
displayName: "Run Cilium Connectivity Tests"
224+
- ${{ if contains(parameters.cni, 'cilium') }}:
225+
- template: ../k8s-e2e/k8s-e2e-job-template.yaml
226+
parameters:
227+
sub: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
228+
clusterName: ${{ parameters.clusterName }}-$(commitID)
229+
os: ${{ parameters.os }}
230+
cni: ${{ parameters.cni }}
231+
dependsOn: cni_tests
232+
datapath: true
233+
dns: true
234+
portforward: true
235+
service: true
236+
- ${{ if contains(parameters.cni, 'cniv2') }}:
237+
- template: ../k8s-e2e/k8s-e2e-job-template.yaml
238+
parameters:
239+
sub: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
240+
clusterName: ${{ parameters.clusterName }}-$(commitID)
241+
os: ${{ parameters.os }}
242+
cni: ${{ parameters.cni }}
243+
dependsOn: recover
244+
datapath: true
245+
dns: true
246+
portforward: true
247+
service: true
248+
hostport: true
163249
- job: failedE2ELogs
164250
displayName: "Failure Logs"
165251
dependsOn:
@@ -169,11 +255,12 @@ stages:
169255
- restart_nodes
170256
- restart_cns
171257
- recover
258+
- cni_tests
172259
- cni_${{ parameters.os }}
173260
condition: failed()
174261
steps:
175262
- template: ../../templates/log-template.yaml
176263
parameters:
177264
clusterName: ${{ parameters.clusterName }}-$(commitID)
178265
os: ${{ parameters.os }}
179-
cni: cniv2
266+
cni: ${{ parameters.cni }}

0 commit comments

Comments
 (0)