Skip to content

Cyclonus Network Policy Test #4738

Cyclonus Network Policy Test

Cyclonus Network Policy Test #4738

name: Cyclonus Network Policy Test
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
paths:
- 'npm/**'
- '.github/**'
schedule:
# run once a day at midnight
- cron: '0 0 * * *'
jobs:
cyclonus-test:
runs-on: ubuntu-latest
strategy:
matrix:
# run cyclonus tests in parallel for NPM with the given ConfigMaps
profile:
[
v2-apply-on-need.yaml,
v2-background.yaml,
v2-foreground.yaml,
v2-place-first.yaml,
]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.21'
- name: Setup Kind
uses: helm/kind-action@v1
with:
version: "v0.22.0"
kubectl_version: "v1.27.7"
config: ./test/kind/kind.yaml
cluster_name: npm-kind
- name: Check Kind
run: |
kubectl get po -owide -A
- name: Make NPM image
run: |
make npm-image NPM_PLATFORM_TAG=cyclonus PLATFORM=linux/amd64 CONTAINER_BUILDER=docker BUILDX_ACTION='--load'
- name: Install Azure NPM
# set the ConfigMap based on the build matrix
# currently have to restart the daemonset because changing the ConfigMap doesn't restart NPM
run: |
sed -i 's/mcr.microsoft.com\/containernetworking\/azure-npm:.*/acnpublic.azurecr.io\/azure-npm:cyclonus/' ./npm/azure-npm.yaml
kind load docker-image acnpublic.azurecr.io/azure-npm:cyclonus --name npm-kind
kubectl apply -f ./npm/azure-npm.yaml
echo "Applying profile: ${{ matrix.profile }}"
kubectl apply -f ./npm/profiles/${{ matrix.profile }}
kubectl rollout restart ds azure-npm -n kube-system
- name: Check Cluster Components
run: |
sleep 10
kubectl get po -owide -A
kubectl describe ds azure-npm -n kube-system
- name: Run Cyclonus network policy test
run: make test-cyclonus
- name: Fetch logs
if: always()
run: |
kubectl logs -n kube-system -l k8s-app=azure-npm --tail -1 --prefix > npm-logs_${{ matrix.profile }}.txt
mv ./test/cyclonus/cyclonus-test.txt ./cyclonus-test_${{ matrix.profile }}.txt
- name: 'Upload Logs'
uses: actions/upload-artifact@v4
if: always()
with:
name: logs-${{ matrix.profile }}
path: |
./npm-logs_${{ matrix.profile }}.txt
./cyclonus-test_${{ matrix.profile }}.txt