Skip to content

Commit 64c6c11

Browse files
sheylatrudoSheyla Trudojpayne3506
authored
ci: ACN PR Pipeline Security Feature Branch (#2985)
* ci: Add Main Pipeline Template * chore: azure-cni-overlay work * chore: cilium overlay work * test: cilium overlay E2E * chore: cni overlay ds work * chore: cilium ds work * fixes * ci: Add ACN Trigger * ci: Use Git Ref Under Review for Testing * Use Duplicate Files for Feature Test * Disable Pipeline Trigger --------- Co-authored-by: Sheyla Trudo <[email protected]> Co-authored-by: jpayne3506 <[email protected]>
1 parent cc1ba09 commit 64c6c11

34 files changed

+4154
-0
lines changed

.config/.gdnsuppress

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "latest",
3+
"suppressionSets": {
4+
"default": {
5+
"name": "default",
6+
"createdDate": "2022-11-28 20:04:38Z",
7+
"lastUpdatedDate": "2022-11-28 20:04:38Z"
8+
}
9+
},
10+
"results": {
11+
"d7e55b5f3e54f9253a2fec595f97520ab0ffece607981d2db0fcfe4dae4cd490": {
12+
"signature": "d7e55b5f3e54f9253a2fec595f97520ab0ffece607981d2db0fcfe4dae4cd490",
13+
"alternativeSignatures": [],
14+
"target": "**/testdata/dummy.pem",
15+
"memberOf": [
16+
"default"
17+
],
18+
"tool": "credscan",
19+
"ruleId": "CSCAN-GENERAL0020",
20+
"justification": null,
21+
"createdDate": "2022-11-28 20:04:38Z",
22+
"expirationDate": null,
23+
"type": null
24+
}
25+
}
26+
}

.config/credScanSuppressions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"tool": "Credential Scanner",
3+
"suppressions": []
4+
}
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
parameters:
2+
clusterName: ""
3+
os: ""
4+
dependsOn: ""
5+
sub: ""
6+
cni: cni
7+
8+
9+
jobs:
10+
- job: CNI_${{ parameters.os }}
11+
condition: and( not(canceled()), not(failed()) )
12+
displayName: CNI k8s E2E ${{ parameters.os }}
13+
dependsOn: ${{ parameters.dependsOn }}
14+
pool:
15+
isCustom: true
16+
type: linux
17+
name: $(BUILD_POOL_NAME_DEFAULT)
18+
variables:
19+
ob_outputDirectory: $(Build.ArtifactStagingDirectory)/output
20+
ob_git_checkout: true
21+
steps:
22+
- checkout: ACNReviewChanges
23+
clean: true
24+
25+
- task: AzureCLI@2
26+
inputs:
27+
azureSubscription: ${{ parameters.sub }}
28+
scriptLocation: "inlineScript"
29+
scriptType: "bash"
30+
workingDirectory: $(ACN_DIR)
31+
addSpnToEnvironment: true
32+
inlineScript: |
33+
set -e
34+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}
35+
36+
# sig-release provides test suite tarball(s) per k8s release. Just need to provide k8s version "v1.xx.xx"
37+
# pulling k8s version from AKS.
38+
eval k8sVersion="v"$( az aks show -g ${{ parameters.clusterName }} -n ${{ parameters.clusterName }} --query "currentKubernetesVersion")
39+
echo $k8sVersion
40+
curl -L https://dl.k8s.io/$k8sVersion/kubernetes-test-linux-amd64.tar.gz -o ./kubernetes-test-linux-amd64.tar.gz
41+
42+
# https://github.com/kubernetes/sig-release/blob/master/release-engineering/artifacts.md#content-of-kubernetes-test-system-archtargz-on-example-of-kubernetes-test-linux-amd64targz-directories-removed-from-list
43+
# explictly unzip and strip directories from ginkgo and e2e.test
44+
tar -xvzf kubernetes-test-linux-amd64.tar.gz --strip-components=3 kubernetes/test/bin/ginkgo kubernetes/test/bin/e2e.test
45+
displayName: "Setup Environment"
46+
retryCountOnTaskFailure: 5
47+
48+
- ${{ if contains(parameters.os, 'windows') }}:
49+
- script: |
50+
set -e
51+
kubectl apply -f test/integration/manifests/load/privileged-daemonset-windows.yaml
52+
kubectl rollout status -n kube-system ds privileged-daemonset
53+
54+
kubectl get pod -n kube-system -l app=privileged-daemonset,os=windows -owide
55+
pods=`kubectl get pod -n kube-system -l app=privileged-daemonset,os=windows --no-headers | awk '{print $1}'`
56+
for pod in $pods; do
57+
kubectl exec -i -n kube-system $pod -- powershell "Restart-Service kubeproxy"
58+
kubectl exec -i -n kube-system $pod -- powershell "Get-Service kubeproxy"
59+
done
60+
workingDirectory: $(ACN_DIR)
61+
name: kubeproxy
62+
displayName: Restart Kubeproxy on Windows nodes
63+
retryCountOnTaskFailure: 3
64+
65+
- ${{ if eq(parameters.datapath, true) }}:
66+
- template: k8s-e2e.steps.yaml@ACNTools
67+
parameters:
68+
testName: Datapath
69+
name: datapath
70+
ginkgoFocus: '(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api'
71+
ginkgoSkip: 'SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6'
72+
os: ${{ parameters.os }}
73+
processes: 8
74+
attempts: 10
75+
76+
- ${{ if eq(parameters.dns, true) }}:
77+
- template: k8s-e2e.steps.yaml@ACNTools
78+
parameters:
79+
testName: DNS
80+
name: dns
81+
ginkgoFocus: '\[sig-network\].DNS.should'
82+
ginkgoSkip: 'resolv|256 search'
83+
os: ${{ parameters.os }}
84+
processes: 8
85+
attempts: 3
86+
87+
- ${{ if eq(parameters.portforward, true) }}:
88+
- template: k8s-e2e.steps.yaml@ACNTools
89+
parameters:
90+
testName: Kubectl Portforward
91+
name: portforward
92+
ginkgoFocus: '\[sig-cli\].Kubectl.Port'
93+
ginkgoSkip: ''
94+
os: ${{ parameters.os }}
95+
processes: 8
96+
attempts: 3
97+
98+
- ${{ if and( eq(parameters.service, true), contains(parameters.cni, 'cni') ) }}:
99+
- template: k8s-e2e.steps.yaml@ACNTools
100+
parameters:
101+
testName: Service Conformance
102+
name: service
103+
ginkgoFocus: 'Services.*\[Conformance\].*'
104+
ginkgoSkip: ''
105+
os: ${{ parameters.os }}
106+
processes: 8
107+
attempts: 3
108+
109+
- ${{ if and( eq(parameters.service, true), contains(parameters.cni, 'cilium') ) }}:
110+
- template: k8s-e2e.steps.yaml@ACNTools
111+
parameters:
112+
testName: Service Conformance|Cilium
113+
name: service
114+
ginkgoFocus: 'Services.*\[Conformance\].*'
115+
ginkgoSkip: 'should serve endpoints on same port and different protocols' # Cilium does not support this feature. For more info on test: https://github.com/kubernetes/kubernetes/blame/e602e9e03cd744c23dde9fee09396812dd7bdd93/test/conformance/testdata/conformance.yaml#L1780-L1788
116+
os: ${{ parameters.os }}
117+
processes: 8
118+
attempts: 3
119+
120+
- ${{ if eq(parameters.hostport, true) }}:
121+
- template: k8s-e2e.steps.yaml@ACNTools
122+
parameters:
123+
testName: Host Port
124+
name: hostport
125+
ginkgoFocus: '\[sig-network\](.*)HostPort|\[sig-scheduling\](.*)hostPort'
126+
ginkgoSkip: 'SCTP|exists conflict' # Skip slow 5 minute test
127+
os: ${{ parameters.os }}
128+
processes: 1 # Has a short serial test
129+
attempts: 3
130+
131+
- ${{ if and(eq(parameters.hybridWin, true), eq(parameters.os, 'windows')) }}:
132+
- template: k8s-e2e.steps.yaml@ACNTools
133+
parameters:
134+
testName: Hybrid Network
135+
name: hybrid
136+
ginkgoFocus: '\[sig-windows\].Hybrid'
137+
ginkgoSkip: ''
138+
os: ${{ parameters.os }}
139+
processes: 8
140+
attempts: 3
141+
142+
- ${{ if and( eq(parameters.dualstack, true), eq(contains(parameters.cni, 'cilium'), false) ) }}:
143+
- template: k8s-e2e.steps.yaml@ACNTools
144+
parameters:
145+
testName: DualStack Test
146+
name: DualStack
147+
clusterName: ${{ parameters.clusterName }}
148+
ginkgoFocus: '\[Feature:IPv6DualStack\]'
149+
ginkgoSkip: 'SCTP|session affinity'
150+
os: ${{ parameters.os }}
151+
processes: 8
152+
attempts: 3
153+
154+
- ${{ if and( eq(parameters.dualstack, true), contains(parameters.cni, 'cilium') ) }}:
155+
- template: k8s-e2e.steps.yaml@ACNTools
156+
parameters:
157+
testName: DualStack Test|Cilium
158+
name: DualStack
159+
clusterName: ${{ parameters.clusterName }}
160+
ginkgoFocus: '\[Feature:IPv6DualStack\]'
161+
ginkgoSkip: 'SCTP|session affinity|should function for service endpoints using hostNetwork' # Cilium dualstack has a known issue with this test https://github.com/cilium/cilium/issues/25135
162+
os: ${{ parameters.os }}
163+
processes: 8
164+
attempts: 3
165+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
parameters:
2+
testName: ""
3+
name: ""
4+
ginkgoFocus: ""
5+
ginkgoSkip: ""
6+
os: ""
7+
processes: "" # Number of parallel processes
8+
attempts: ""
9+
10+
11+
steps:
12+
- script: |
13+
set -ex
14+
15+
# ginkgoSkip cant handle only |LinuxOnly. Need to have check
16+
if ${{ lower(and(ge(length(parameters.ginkgoSkip), 1), eq(parameters.os, 'windows'))) }}
17+
then
18+
SKIP="|LinuxOnly"
19+
elif ${{ lower(eq(parameters.os, 'windows')) }}
20+
then
21+
SKIP="LinuxOnly"
22+
fi
23+
24+
# Taint Linux nodes so that windows tests do not run on them
25+
if ${{ lower(eq(parameters.os, 'windows')) }}
26+
then
27+
kubectl rollout status -n kube-system deployment/konnectivity-agent --timeout=3m
28+
kubectl taint nodes -l kubernetes.azure.com/mode=system node-role.kubernetes.io/control-plane:NoSchedule
29+
fi
30+
31+
# Taint Windows nodes so that Linux tests do not run on them
32+
if ${{ lower(eq(parameters.os, 'linux')) }}
33+
then
34+
kubectl taint nodes -l kubernetes.azure.com/mode=user node-role.kubernetes.io/control-plane:NoSchedule
35+
fi
36+
37+
# Depreciating flags. Change once k8s minimum version supported is > 1.24
38+
# nodes -> procs
39+
# flakeAttempts -> flake-attempts
40+
# dryRun -> dry-run
41+
42+
./ginkgo --nodes=${{ parameters.processes }} \
43+
./e2e.test -- \
44+
--num-nodes=2 \
45+
--provider=skeleton \
46+
--ginkgo.focus='${{ parameters.ginkgoFocus }}' \
47+
--ginkgo.skip="${{ parameters.ginkgoSkip }}$SKIP" \
48+
--ginkgo.flakeAttempts=${{ parameters.attempts }} \
49+
--ginkgo.v \
50+
--node-os-distro=${{ parameters.os }} \
51+
--kubeconfig=$HOME/.kube/config
52+
53+
# Untaint Linux nodes once testing is complete
54+
if ${{ lower(eq(parameters.os, 'windows')) }}
55+
then
56+
kubectl taint nodes -l kubernetes.azure.com/mode=system node-role.kubernetes.io/control-plane:NoSchedule-
57+
fi
58+
59+
# Untaint Windows nodes once testing is complete
60+
if ${{ lower(eq(parameters.os, 'linux')) }}
61+
then
62+
kubectl taint nodes -l kubernetes.azure.com/mode=user node-role.kubernetes.io/control-plane:NoSchedule-
63+
fi
64+
name: ${{ parameters.name }}
65+
displayName: k8s E2E - ${{ parameters.testName }}
66+
workingDirectory: $(ACN_DIR)
67+
retryCountOnTaskFailure: 5
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
parameters:
2+
arch: ""
3+
name: ""
4+
os: ""
5+
os_version: ""
6+
7+
steps:
8+
- task: AzureCLI@2
9+
displayName: "Login"
10+
inputs:
11+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
12+
scriptLocation: "inlineScript"
13+
scriptType: "bash"
14+
inlineScript: |
15+
az acr login -n $(ACR)
16+
17+
- script: |
18+
set -e
19+
if [ "$IN_OS" = 'windows' ]; then export BUILDX_ACTION='--push'; fi
20+
make "$IMGNAME" OS="$IN_OS" ARCH="$IN_ARCH" OS_VERSION="$IN_OS_VERSION"
21+
name: image_build
22+
displayName: Image Build
23+
workingDirectory: $(ACN_DIR)
24+
retryCountOnTaskFailure: 3
25+
env:
26+
IMGNAME: '${{ parameters.name }}-image'
27+
IN_OS: '${{ parameters.os }}'
28+
IN_ARCH: '${{ parameters.arch }}'
29+
IN_OS_VERSION: '${{ parameters.os_version }}'
30+
31+
- task: AzureCLI@2
32+
displayName: "Logout"
33+
inputs:
34+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
35+
scriptLocation: "inlineScript"
36+
scriptType: "bash"
37+
inlineScript: |
38+
docker logout
39+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
parameters:
2+
name: ""
3+
platforms: ""
4+
os_versions: ""
5+
6+
steps:
7+
8+
- task: AzureCLI@2
9+
displayName: "Login"
10+
inputs:
11+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
12+
scriptLocation: "inlineScript"
13+
scriptType: "bash"
14+
inlineScript: |
15+
az acr login -n $(ACR)
16+
17+
- script: |
18+
set -e
19+
make ${{ parameters.name }}-manifest-build PLATFORMS="${{ parameters.platforms }}" OS_VERSIONS="${{ parameters.os_versions }}"
20+
workingDirectory: $(ACN_DIR)
21+
name: manifest_build
22+
displayName: Manifest Build
23+
retryCountOnTaskFailure: 3
24+
25+
- script: |
26+
set -ex
27+
echo "checking XDG_RUNTIME_DIR"
28+
echo $XDG_RUNTIME_DIR
29+
make ${{ parameters.name }}-manifest-push
30+
mkdir -p $(Build.ArtifactStagingDirectory)/images
31+
32+
echo "setting XDG_RUNTIME_DIR"
33+
export XDG_RUNTIME_DIR=/run/user/$(id -u)
34+
echo $XDG_RUNTIME_DIR
35+
36+
make ${{ parameters.name }}-skopeo-archive IMAGE_ARCHIVE_DIR=$(Build.ArtifactStagingDirectory)/images
37+
name: manifest_push
38+
displayName: Manifest Push
39+
workingDirectory: $(ACN_DIR)
40+
retryCountOnTaskFailure: 3
41+
42+
- task: AzureCLI@2
43+
displayName: "Logout"
44+
inputs:
45+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
46+
scriptLocation: "inlineScript"
47+
scriptType: "bash"
48+
inlineScript: |
49+
docker logout
50+
51+
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
52+
displayName: "Add SBOM Generator tool"
53+
inputs:
54+
BuildDropPath: "$(Build.ArtifactStagingDirectory)"

0 commit comments

Comments
 (0)