Skip to content

Commit

Permalink
Merge pull request #262 from huntergregory/rename-cyclonus-to-pola
Browse files Browse the repository at this point in the history
chore: [Policy Assistant] rename Cyclonus to policy-assistant
  • Loading branch information
k8s-ci-robot authored Nov 7, 2024
2 parents d1aa393 + ac44f11 commit 2ce404d
Show file tree
Hide file tree
Showing 97 changed files with 336 additions and 310 deletions.
58 changes: 38 additions & 20 deletions .github/workflows/policy-assistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ env:
permissions: write-all

jobs:
unit-tests:
name: Unit Tests
go-tests:
name: Go Tests
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

Expand All @@ -42,34 +42,52 @@ jobs:
cd cmd/policy-assistant/
go test ./...
- name: Run Go Vet
run: |
cd cmd/policy-assistant/
go vet ./...
- name: Run Go Fmt
shell: bash
run: |
cd cmd/policy-assistant/
exitCode=0
go fmt ./... | grep "\.go" || exitCode=$?
if [[ $exitCode == 0 ]]; then
echo "please run 'make fmt' in the cmd/policy-assistant/ directory"
exit 1
else
echo "go files are properly formatted"
fi
build:
name: Build Cyclonus
name: Build Policy Assistant
runs-on: ubuntu-22.04
needs: unit-tests
needs: go-tests
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Build Cyclonus
- name: Build policy-assistant Binary
run: |
cd cmd/policy-assistant/
make cyclonus
make policy-assistant
- name: Save Cyclonus Binary
- name: Save policy-assistant Binary
run: |
mkdir -p artifacts
cp cmd/policy-assistant/cmd/cyclonus/cyclonus artifacts/
cp cmd/policy-assistant/cmd/policy-assistant/policy-assistant artifacts/
- name: Upload Cyclonus Binary
- name: Upload policy-assistant Binary
uses: actions/upload-artifact@v4
with:
name: cyclonus-binary
path: artifacts/cyclonus
name: policy-assistant-binary
path: artifacts/policy-assistant

integration-tests:
name: Integration Tests
Expand All @@ -79,23 +97,23 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Download Cyclonus Binary
- name: Download policy-assistant Binary
uses: actions/download-artifact@v4
with:
name: cyclonus-binary
name: policy-assistant-binary
path: artifacts

- name: Set Cyclonus Binary Permissions
run: chmod u+x artifacts/cyclonus
- name: Set policy-assistant Binary Permissions
run: chmod u+x artifacts/policy-assistant

- name: Run Integration Test - Explain Mode
run: |
artifacts/cyclonus analyze --mode explain --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
artifacts/policy-assistant analyze --mode explain --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
- name: Run Integration Test - Probe Mode
run: |
artifacts/cyclonus analyze --mode probe --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/ --probe-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/demo-probe.json
artifacts/policy-assistant analyze --mode probe --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/ --probe-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/demo-probe.json
- name: Run Integration Test - Walkthrough Mode
run: |
artifacts/cyclonus analyze --mode walkthrough --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
artifacts/policy-assistant analyze --mode walkthrough --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
6 changes: 6 additions & 0 deletions cmd/policy-assistant/.github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
> [!NOTE]
> The workflows in this folder are not run and were copied/modified from the Cyclonus repository (https://github.com/mattfenwick/cyclonus), from which Policy Assistant is derived.
If you'd like to run one of these workflows, please copy it to the .github/ folder in the root of this repo (network-policy-api), then delete the file in this folder.

The workflows within run the test framework on different CNIs (for more info, see #154).
30 changes: 0 additions & 30 deletions cmd/policy-assistant/.github/workflows/go.yml

This file was deleted.

12 changes: 6 additions & 6 deletions cmd/policy-assistant/.github/workflows/kind_antrea.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Kind Antrea Cyclonus
name: Kind Antrea policy-assistant
on:
workflow_dispatch:
inputs:
cyclonus_args:
description: "args to pass on to Cyclonus"
pola_args:
description: "args to pass on to policy-assistant"
required: false
default: "generate --include conflict --job-timeout-seconds 2 --server-protocol=tcp,udp"
# schedule:
Expand All @@ -13,14 +13,14 @@ on:

jobs:
test-kind-antrea:
name: Run Cyclonus on KinD/Antrea
name: Run policy-assistant on KinD/Antrea
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run Cyclonus
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=antrea RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.cyclonus_args }}" ./run-cyclonus.sh
run: CNI=antrea RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
12 changes: 6 additions & 6 deletions cmd/policy-assistant/.github/workflows/kind_calico.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Kind Calico Cyclonus
name: Kind Calico policy-assistant
on:
workflow_dispatch:
inputs:
cyclonus_args:
description: "args to pass on to Cyclonus"
pola_args:
description: "args to pass on to policy-assistant"
required: false
default: "generate --include conflict --job-timeout-seconds 2"
# schedule:
Expand All @@ -12,14 +12,14 @@ on:

jobs:
test-kind-calico:
name: Run Cyclonus on KinD/Calico
name: Run policy-assistant on KinD/Calico
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run Cyclonus
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=calico RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.cyclonus_args }}" ./run-cyclonus.sh
run: CNI=calico RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
12 changes: 6 additions & 6 deletions cmd/policy-assistant/.github/workflows/kind_cilium.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Kind Cilium Cyclonus
name: Kind Cilium policy-assistant
on:
workflow_dispatch:
inputs:
cyclonus_args:
description: "args to pass on to Cyclonus"
pola_args:
description: "args to pass on to policy-assistant"
required: false
default: "generate --include conflict --job-timeout-seconds 2 --server-protocol=tcp,udp --ignore-loopback=true"
# schedule:
Expand All @@ -12,14 +12,14 @@ on:

jobs:
test-kind-cilium:
name: Run Cyclonus on KinD/Cilium
name: Run policy-assistant on KinD/Cilium
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run Cyclonus
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=cilium RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.cyclonus_args }}" ./run-cyclonus.sh
run: CNI=cilium RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
6 changes: 3 additions & 3 deletions cmd/policy-assistant/.github/workflows/kind_cni_from_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:

jobs:
test-kind-calico:
name: Run Cyclonus on KinD
name: Run policy-assistant on KinD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Run Cyclonus
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=${{ github.event.inputs.cni }} RUN_FROM_SOURCE=false ./run-cyclonus.sh
run: CNI=${{ github.event.inputs.cni }} RUN_FROM_SOURCE=false ./run-policy-assistant.sh
10 changes: 5 additions & 5 deletions cmd/policy-assistant/.github/workflows/kind_cni_from_source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
cni:
description: "name of CNI to use"
required: true
cyclonus_args:
description: "args to pass on to Cyclonus"
pola_args:
description: "args to pass on to policy-assistant"
required: false
default: "generate include --conflict --job-timeout-seconds 2"

jobs:
test-kind-calico:
name: Run Cyclonus on KinD
name: Run policy-assistant on KinD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -22,6 +22,6 @@ jobs:
with:
go-version: 1.18

- name: Run Cyclonus
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=${{ github.event.inputs.cni }} RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.cyclonus_args }}" ./run-cyclonus.sh
run: CNI=${{ github.event.inputs.cni }} RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
12 changes: 6 additions & 6 deletions cmd/policy-assistant/.github/workflows/kind_ovn.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Kind Ovn Cyclonus
name: Kind Ovn policy-assistant
on:
workflow_dispatch:
inputs:
cyclonus_args:
description: "args to pass on to Cyclonus"
pola_args:
description: "args to pass on to policy-assistant"
required: false
default: "generate --include conflict --job-timeout-seconds 2 --exclude=named-port,multi-peer,upstream-e2e,example --ignore-loopback=true"
# schedule:
Expand All @@ -13,7 +13,7 @@ on:

jobs:
test-kind-ovn-kubernetes:
name: Run Cyclonus on KinD/Ovn
name: Run policy-assistant on KinD/Ovn
timeout-minutes: 250
runs-on: ubuntu-latest
steps:
Expand All @@ -22,6 +22,6 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run Cyclonus
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=ovn-kubernetes RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.cyclonus_args }}" ./run-cyclonus.sh
run: CNI=ovn-kubernetes RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
3 changes: 3 additions & 0 deletions cmd/policy-assistant/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ ignore/
.idea/

dist/

# policy-assistant binary
cmd/policy-assistant/policy-assistant
Loading

0 comments on commit 2ce404d

Please sign in to comment.