Skip to content

Commit

Permalink
style: file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmetzner committed Dec 13, 2024
1 parent c181740 commit d01edf6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
23 changes: 15 additions & 8 deletions nomad/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,54 @@
There is no official support from our side for Nomad. Nonetheless, we would still like to offer a satisfying developer experience and have automated e2e tests to avoid breaking Nomad accidentally.

## Nomad Development Environment

As a prerequisite for developing Nomad, a setup of the [`nomad-dev-env`](https://github.com/hetznercloud/nomad-dev-env) is necessary, which is located in `nomad/dev`.

1. Setup the `HCLOUD_TOKEN` environment variable
2. Deploy the development cluster:
``` bash

```bash
make -C nomad/dev up
```

3. Load the generated configuration to access the development cluster:
``` bash

```bash
source nomad/dev/files/env.sh
```

4. Check that the cluster is healthy:
``` bash

```bash
nomad node status
```

## Skaffold

Skaffold commands should be executed from the `csi-driver` root directory and use the `-f` flag to point to the Nomad specific `skaffold.yaml`.

``` bash
```bash
skaffold -f nomad/skaffold.yaml build
```

Skaffold does not offer any native support for Nomad. For this reason we use the Nomad post build hooks to deploy/redeploy the csi plugin. To delete the csi plugin a manual execution of `stop_nomad.sh` is necessary.

``` bash
```bash
bash ./nomad/stop_nomad.sh
```

## E2E Tests

The nomad e2e tests are located in `test/e2e/nomad` and need a working development environment.

1. Deploy the csi-driver

``` bash
```bash
skaffold -f nomad/skaffold.yaml build
```

2. Run the e2e tests

``` bash
```bash
go test -v -tags e2e ./test/e2e/nomad/...
```
```
2 changes: 1 addition & 1 deletion nomad/hcloud-csi-node.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ EOH
}
}
}
}
}
2 changes: 1 addition & 1 deletion nomad/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ build:
local:
useBuildkit: true
insecureRegistries:
- localhost:30666
- localhost:30666
18 changes: 8 additions & 10 deletions nomad/start_nomad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

set -euo pipefail

if nomad job inspect hcloud-csi-controller > /dev/null
then
if nomad job inspect hcloud-csi-controller > /dev/null; then
nomad job stop -purge hcloud-csi-controller
fi

controller="$(mktemp)"
envsubst < "./nomad/hcloud-csi-controller.hcl" > $controller
sed -i 's/localhost:30666/docker-registry.service.consul:5000/' $controller
nomad job run $controller
envsubst < "./nomad/hcloud-csi-controller.hcl" > "$controller"
sed -i 's/localhost:30666/docker-registry.service.consul:5000/' "$controller"
nomad job run "$controller"

if nomad job inspect hcloud-csi-node > /dev/null
then
if nomad job inspect hcloud-csi-node > /dev/null; then
nomad job stop -purge hcloud-csi-node
fi

node="$(mktemp)"
envsubst < "./nomad/hcloud-csi-node.hcl" > $node
sed -i 's/localhost:30666/docker-registry.service.consul:5000/' $node
nomad job run $node
envsubst < "./nomad/hcloud-csi-node.hcl" > "$node"
sed -i 's/localhost:30666/docker-registry.service.consul:5000/' "$node"
nomad job run "$node"
2 changes: 1 addition & 1 deletion nomad/stop_nomad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ nomad job stop -purge hcloud-csi-controller
echo "Deleted hcloud-csi-controller"

nomad job stop -purge hcloud-csi-node
echo "Deleted hcloud-csi-node"
echo "Deleted hcloud-csi-node"

0 comments on commit d01edf6

Please sign in to comment.