Skip to content

Commit e2659e7

Browse files
charlieegan3eshepelyuk
authored andcommitted
Add OPA CLI setup and update local registry port
These are some edits I needed to make to get the e2e tests running. There is a macOS service running on 5000 and others woll likely have that same issue with 5000. Signed-off-by: Charlie Egan <charlie_egan@apple.com>
1 parent 563c00c commit e2659e7

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ jobs:
4141
rename-to: skaffold
4242
chmod: 0755
4343
- run: just k3d
44+
- uses: open-policy-agent/setup-opa@v2
45+
with:
46+
version: latest
4447
- run: pip install httpie
4548
- run: |
4649
just test-e2e-all

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,14 @@ allow {
206206
* [Go language toolchain](https://go.dev/doc/install).
207207
* [just](https://github.com/casey/just#just) - generic command runner.
208208
* [skaffold](https://skaffold.dev/) - build and publish docker images and more, `v2.x` and above is required.
209-
* [helm](https://helm.sh/docs/intro/install/)- package manager for k8s.
209+
* [helm](https://helm.sh/docs/intro/install/) - package manager for k8s.
210210
* [k3d](https://k3d.io/#installation) - local k8s cluster with docker registry.
211+
* [kubectl](https://kubernetes.io/docs/tasks/tools/) - Kubernetes CLI.
212+
* [opa](https://www.openpolicyagent.org/docs#running-opa) - Open Policy Agent CLI (for e2e tests).
213+
* [staticcheck](https://staticcheck.io/docs/getting-started/) - Go static analysis tool (for linting).
214+
* [httpie](https://httpie.io/docs/cli/installation) - HTTP client (for e2e tests).
215+
* [jq](https://jqlang.github.io/jq/download/) - JSON processor (for e2e tests).
216+
* [crane](https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane.md) - Container image tool (optional, for inspecting images).
211217

212218
This project uses `just` for building, testing and running `kube-mgmt` locally.
213219
It is configured from [justfile](./justfile) in root directory.

justfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defaul:
88
@just --list
99

1010
@_skaffold-ctx:
11-
skaffold config set default-repo localhost:5000
11+
skaffold config set default-repo localhost:5001 --kube-context k3d-kube-mgmt
1212

1313
# build and publish image to release regisry, create chart archive
1414
build-release:
@@ -62,7 +62,7 @@ rebuild: && build
6262

6363
# build and publish docker to local registry
6464
build: _skaffold-ctx
65-
skaffold build --file-output={{skaffoldTags}} --platform=linux/amd64
65+
skaffold build --file-output={{skaffoldTags}} --platform=linux/amd64 --kube-context=k3d-kube-mgmt
6666

6767
# install into local k8s
6868
up: _skaffold-ctx down
@@ -75,11 +75,11 @@ up: _skaffold-ctx down
7575
fi
7676

7777
kubectl delete cm -l kube-mgmt/e2e=true || true
78-
skaffold deploy --build-artifacts={{skaffoldTags}}
78+
skaffold deploy --build-artifacts={{skaffoldTags}} --kube-context=k3d-kube-mgmt
7979

8080
# remove from local k8s
8181
down:
82-
skaffold delete || true
82+
skaffold delete --kube-context=k3d-kube-mgmt || true
8383

8484
# run only e2e test script
8585
test-e2e-sh:

test/e2e/k3d.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ registries:
88
create:
99
name: kube-mgmt-registry
1010
host: "0.0.0.0"
11-
hostPort: "5000"
11+
hostPort: "5001"
1212
config: |
1313
mirrors:
14-
"localhost:5000":
14+
"localhost:5001":
1515
endpoint:
1616
- http://kube-mgmt-registry:5000
1717
ports:

test/e2e/replicate_auto/before.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22
set -ex
33

4-
go run github.com/open-policy-agent/opa build -b $(dirname $0)/bundle -o $(dirname $0)/bundle.tar.gz
4+
opa build -b $(dirname $0)/bundle -o $(dirname $0)/bundle.tar.gz
55
kubectl delete configmap bundle || true
66
kubectl create configmap bundle --from-file $(dirname $0)/bundle.tar.gz

0 commit comments

Comments
 (0)