Skip to content

Commit

Permalink
e2e-test: Add script to update server image
Browse files Browse the repository at this point in the history
Add a script to redeploy the server in the kind cluster. It is
useful to quickly test new changes without tearing down the
cluster and bringing it up again.

Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
  • Loading branch information
zeeke committed Oct 17, 2022
1 parent b9106c8 commit 67a0dae
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
10 changes: 9 additions & 1 deletion e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

### How to test e2e

This requires [Bats](https://github.com/bats-core/bats-core) for test runner. Please instal bats (e.g. dnf, apt and so on).
This requires [Bats](https://github.com/bats-core/bats-core) for test runner. Please install bats (e.g. dnf, apt and so on).

```
$ git clone https://github.com/k8snetworkplumbingwg/multi-networkpolicy-iptables
Expand All @@ -20,3 +20,11 @@ $ kind delete cluster
$ docker kill kind-registry
$ docker rm kind-registry
```

### How to deploy server image with new changes

After making changes to the code, it is possible to update the server Daemonset image with the script:

```
./update_image_on_cluster.sh
```
13 changes: 13 additions & 0 deletions e2e/update_image_on_cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -o errexit

E2E="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
export PATH=${PATH}:${E2E}/bin
OCI_BIN="${OCI_BIN:-docker}"
IMAGE="localhost:5000/multus-networkpolicy-iptables:e2e"

$OCI_BIN build -t ${IMAGE} ${E2E}/..
$OCI_BIN push ${IMAGE}
new_image_with_digest=`${OCI_BIN} inspect --format='{{index .RepoDigests 0}}' ${IMAGE}`

kubectl set image -n kube-system ds/multi-networkpolicy-ds-amd64 multi-networkpolicy=${new_image_with_digest}

0 comments on commit 67a0dae

Please sign in to comment.