From d01edf69bb88d47105f09763167531480c2eff26 Mon Sep 17 00:00:00 2001 From: lukasmetzner Date: Fri, 13 Dec 2024 10:20:54 +0100 Subject: [PATCH] style: file formatting --- nomad/README.md | 23 +++++++++++++++-------- nomad/hcloud-csi-node.hcl | 2 +- nomad/skaffold.yaml | 2 +- nomad/start_nomad.sh | 18 ++++++++---------- nomad/stop_nomad.sh | 2 +- 5 files changed, 26 insertions(+), 21 deletions(-) diff --git a/nomad/README.md b/nomad/README.md index 09c400fd..6295be29 100644 --- a/nomad/README.md +++ b/nomad/README.md @@ -3,19 +3,25 @@ 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 ``` @@ -23,27 +29,28 @@ nomad node status 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/... -``` \ No newline at end of file +``` diff --git a/nomad/hcloud-csi-node.hcl b/nomad/hcloud-csi-node.hcl index 0d5310d8..2ff2c62b 100644 --- a/nomad/hcloud-csi-node.hcl +++ b/nomad/hcloud-csi-node.hcl @@ -38,4 +38,4 @@ EOH } } } -} \ No newline at end of file +} diff --git a/nomad/skaffold.yaml b/nomad/skaffold.yaml index 94a7b6a3..12cb3046 100644 --- a/nomad/skaffold.yaml +++ b/nomad/skaffold.yaml @@ -14,4 +14,4 @@ build: local: useBuildkit: true insecureRegistries: - - localhost:30666 \ No newline at end of file + - localhost:30666 diff --git a/nomad/start_nomad.sh b/nomad/start_nomad.sh index 7691d9ee..19f874ce 100755 --- a/nomad/start_nomad.sh +++ b/nomad/start_nomad.sh @@ -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" diff --git a/nomad/stop_nomad.sh b/nomad/stop_nomad.sh index 736d087d..dc1d5541 100755 --- a/nomad/stop_nomad.sh +++ b/nomad/stop_nomad.sh @@ -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" \ No newline at end of file +echo "Deleted hcloud-csi-node"