Skip to content

Commit

Permalink
chore: rename pola to policy-assistant
Browse files Browse the repository at this point in the history
Signed-off-by: Hunter Gregory <[email protected]>
  • Loading branch information
huntergregory committed Nov 7, 2024
1 parent 667e831 commit ac44f11
Show file tree
Hide file tree
Showing 35 changed files with 138 additions and 138 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/policy-assistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

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

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

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

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

- name: Run Integration Test - Explain Mode
run: |
artifacts/pola 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/pola 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/pola 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/
10 changes: 5 additions & 5 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 pola
name: Kind Antrea policy-assistant
on:
workflow_dispatch:
inputs:
pola_args:
description: "args to pass on to pola"
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 pola 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 pola
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=antrea RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-pola.sh
run: CNI=antrea RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
10 changes: 5 additions & 5 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 pola
name: Kind Calico policy-assistant
on:
workflow_dispatch:
inputs:
pola_args:
description: "args to pass on to pola"
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 pola 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 pola
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=calico RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-pola.sh
run: CNI=calico RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
10 changes: 5 additions & 5 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 pola
name: Kind Cilium policy-assistant
on:
workflow_dispatch:
inputs:
pola_args:
description: "args to pass on to pola"
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 pola 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 pola
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=cilium RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-pola.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 pola on KinD
name: Run policy-assistant on KinD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Run pola
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=${{ github.event.inputs.cni }} RUN_FROM_SOURCE=false ./run-pola.sh
run: CNI=${{ github.event.inputs.cni }} RUN_FROM_SOURCE=false ./run-policy-assistant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
description: "name of CNI to use"
required: true
pola_args:
description: "args to pass on to pola"
description: "args to pass on to policy-assistant"
required: false
default: "generate include --conflict --job-timeout-seconds 2"

jobs:
test-kind-calico:
name: Run pola 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 pola
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=${{ github.event.inputs.cni }} RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-pola.sh
run: CNI=${{ github.event.inputs.cni }} RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
10 changes: 5 additions & 5 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 pola
name: Kind Ovn policy-assistant
on:
workflow_dispatch:
inputs:
pola_args:
description: "args to pass on to pola"
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 pola 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 pola
- name: Run policy-assistant
working-directory: hack/kind
run: CNI=ovn-kubernetes RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-pola.sh
run: CNI=ovn-kubernetes RUN_FROM_SOURCE=true FROM_SOURCE_ARGS="${{ github.event.inputs.pola_args }}" ./run-policy-assistant.sh
4 changes: 2 additions & 2 deletions cmd/policy-assistant/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ ignore/

dist/

# pola binary
cmd/pola/pola
# policy-assistant binary
cmd/policy-assistant/policy-assistant
20 changes: 10 additions & 10 deletions cmd/policy-assistant/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ project_name: policy-assistant
release:
github:
owner: huntergregory
name: pola
name: policy-assistant
builds:
- id: pola
- id: policy-assistant
goos:
- linux
- windows
Expand All @@ -13,14 +13,14 @@ builds:
- amd64
env:
- CGO_ENABLED=0
main: cmd/pola/main.go
main: cmd/policy-assistant/main.go
ldflags: -s -w
-X sigs.k8s.io/network-policy-api/policy-assistant/pkg/cli.version={{.Version}}
-X sigs.k8s.io/network-policy-api/policy-assistant/pkg/cli.gitSHA={{.Commit}}
-X sigs.k8s.io/network-policy-api/policy-assistant/pkg/cli.buildTime={{.Date}}
-extldflags "-static"
flags: -tags netgo -installsuffix netgo
binary: "pola"
binary: "policy-assistant"
hooks: {}
# commenting out since we don't have GHCR Images yet (see #263)
# dockers:
Expand All @@ -29,12 +29,12 @@ builds:
# goarch: amd64
# goarm: ''
# ids:
# - pola
# - policy-assistant
# image_templates:
# - "docker.io/pola:latest" # FIXME use a real image repository
# - "docker.io/pola:{{ .Tag }}" # FIXME use a real image repository
# - "docker.io/policy-assistant:latest" # FIXME use a real image repository
# - "docker.io/policy-assistant:{{ .Tag }}" # FIXME use a real image repository
# skip_push: false
# dockerfile: cmd/pola/Dockerfile
# dockerfile: cmd/policy-assistant/Dockerfile
# # build_flag_templates:
# # - "--label=org.opencontainers.image.created={{.Date}}"
# # - "--label=org.opencontainers.image.title={{.ProjectName}}"
Expand All @@ -43,9 +43,9 @@ builds:
# # - "--pull"
# # - "--platform=linux/arm64"
archives:
- id: pola
- id: policy-assistant
builds:
- pola
- policy-assistant
format: tar.gz
format_overrides:
- goos: windows
Expand Down
14 changes: 7 additions & 7 deletions cmd/policy-assistant/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# constants
# FIXME: update POLA_IMAGE to the actual image name
POLA_IMAGE = pola
POLA_IMAGE = policy-assistant

# variables
# FIXME: update IMAGE_REGISTRY to the actual image registry
Expand All @@ -18,11 +18,11 @@ fmt:
vet:
go vet ./cmd/... ./pkg/...

.PHONY: pola
pola: pola-binary
.PHONY: policy-assistant
policy-assistant: policy-assistant-binary

pola-binary:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./cmd/pola/pola ./cmd/pola
policy-assistant-binary:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./cmd/policy-assistant/policy-assistant ./cmd/policy-assistant

pola-image: pola-binary
docker build -t $(IMAGE_REGISTRY)/$(POLA_IMAGE):$(POLA_TAG) ./cmd/pola
policy-assistant-image: policy-assistant-binary
docker build -t $(IMAGE_REGISTRY)/$(POLA_IMAGE):$(POLA_TAG) ./cmd/policy-assistant
18 changes: 9 additions & 9 deletions cmd/policy-assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Policy Assistant is a static analysis tool which ***simulates the action of netw
For instance, Policy Assistant can simulate and walk through which policies impact cluster traffic:

```shell
$ pola analyze --namespace demo --mode walkthrough
$ policy-assistant analyze --namespace demo --mode walkthrough
verdict walkthrough:
+---------------------------------------+---------+-------------------------------------------------------------+------------------------------+
| TRAFFIC | VERDICT | INGRESS WALKTHROUGH | EGRESS WALKTHROUGH |
Expand All @@ -35,13 +35,13 @@ verdict walkthrough:

### Quick Install

Download the latest `pola` release either from GitHub ([web page](https://github.com/kubernetes-sigs/network-policy-api/releases/v0.0.1-pola)) or via these bash commands:
Download the latest `policy-assistant` release either from GitHub ([web page](https://github.com/kubernetes-sigs/network-policy-api/releases/v0.0.1-policy-assistant)) or via these bash commands:

```bash
curl -O https://github.com/kubernetes-sigs/network-policy-api/releases/download/v0.0.1-pola/pola_linux_amd64.tar.gz
curl -O https://github.com/kubernetes-sigs/network-policy-api/releases/download/v0.0.1-policy-assistant/pola_linux_amd64.tar.gz
# optionally verify check sum
tar -xvf pola_linux_amd64.tar.gz
./pola --help
./policy-assistant --help
```

Alternatively, [install from source](#make-from-source).
Expand Down Expand Up @@ -73,7 +73,7 @@ For a presentation and discussion on Policy Assistant and the admin policy APIs,
Visualize all your policies in a table.

```shell
$ pola analyze --mode explain --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
$ policy-assistant analyze --mode explain --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
explained policies:
+---------+---------------------------------------+---------------------------+------------+----------------------------+--------------------------+
| TYPE | SUBJECT | SOURCE RULES | PEER | ACTION | PORT/PROTOCOL |
Expand Down Expand Up @@ -108,7 +108,7 @@ explained policies:
Visualize how traffic would be allowed/denied.

```shell
$ pola analyze --mode probe --probe-path examples/demos/kubecon-eu-2024/demo-probe.json --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
$ policy-assistant analyze --mode probe --probe-path examples/demos/kubecon-eu-2024/demo-probe.json --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
probe (simulated connectivity):
INFO[2024-08-07T17:26:28-07:00] probe on port 80, protocol TCP
Ingress:
Expand Down Expand Up @@ -168,7 +168,7 @@ Combined:
Visualize how traffic would be allowed/denied and which policies are causing the verdict.

```shell
$ pola analyze --mode walkthrough --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
$ policy-assistant analyze --mode walkthrough --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
verdict walkthrough:
+---------------------------------------+---------+-------------------------------------------------------------+------------------------------+
| TRAFFIC | VERDICT | INGRESS WALKTHROUGH | EGRESS WALKTHROUGH |
Expand All @@ -189,8 +189,8 @@ verdict walkthrough:

1. Clone the repo.
2. `cd cmd/policy-assistant`
3. `make pola`
4. The `pola` binary will be produced at *cmd/pola/pola*.
3. `make policy-assistant`
4. The `policy-assistant` binary will be produced at *cmd/policy-assistant/policy-assistant*.

### Testing

Expand Down
5 changes: 0 additions & 5 deletions cmd/policy-assistant/cmd/pola/Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions cmd/policy-assistant/cmd/pola/Dockerfile.windows

This file was deleted.

5 changes: 5 additions & 0 deletions cmd/policy-assistant/cmd/policy-assistant/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine:3.13

ENTRYPOINT ["/policy-assistant"]

COPY policy-assistant /
Loading

0 comments on commit ac44f11

Please sign in to comment.