Commit Graph

198 Commits

Author SHA1 Message Date
1a0d71a4cd Update Go Modules 2021-10-11 18:39:15 +02:00
6aa9deba39 Add dependency management commands to Makefile
* `make upgrade-deps`
* `make tidy-deps`
2021-10-11 18:39:15 +02:00
8461c24dbe Merge pull request #10 from openHPI/dependabot
Add dependabot auto updates
2021-10-08 18:51:21 +02:00
3be00b18a1 Add dependabot auto updates 2021-10-05 11:53:46 +02:00
9d7e59df36 Change authorization header key (#6)
* Change authorization header key

as the use of headers starting with X- has been deprecated in RFC6648.

* Update configuration.example.yaml

Co-authored-by: Sebastian Serth <MrSerth@users.noreply.github.com>
2021-10-04 12:23:41 +02:00
b530c58ee8 Merge pull request #2 from openHPI/feature/github-actions
Migrate from GitLab CI/CD to GitHub actions
2021-09-09 15:26:06 +02:00
9b106f4cd8 Fix linting issues
An update of golangci-lint yielded new linting issues. This commit
fixes them.
2021-08-05 13:40:48 +02:00
aae0c6e377 Migrate from GitLab CI/CD to GitHub actions (#1)
This also adds a new Dockerfile for a e2e-test-image, as the old
image was hosted on our private registry. By having the image located
near the code, we don't have to rely on images on external registries.
2021-08-05 13:40:48 +02:00
c8c5357b8c Rename module for GitHub 2021-07-30 16:43:05 +02:00
36dc99f019 Don't embed the execution.Storer interface into a runner
Previously, the execution.Storer interface was embedded in the Runner interface.
However, this resulted in calls like runner.Add(...) to add an execution to the
store which is kind of ugly. Thus, we decided to add only the required functions to
the runner interface and make the execution.Storer a field of the implementation.
2021-07-30 14:28:06 +02:00
4ad470a5c4 Rename execution.Storage to Storer to follow Go convention
Interfaces should be named like someone actively doing a thing. Thus,
instead of Storage we use Storer.
2021-07-30 14:26:44 +02:00
bd14b1e181 Move execution storage to new package 2021-07-30 14:26:44 +02:00
8197235f1c Add Poseidon icon 2021-07-30 12:22:10 +00:00
3c2e85ed4a Correct destination of nomad-ca.crt template to be inside NOMAD_SECRETS_DIR 2021-07-30 12:08:56 +00:00
8fcb5f3581 Add attribution for Poseidon icon 2021-07-30 09:16:30 +02:00
3b6c616d9c Describe purpose of Poseidon 2021-07-29 15:03:41 +00:00
a1366a9f76 Split README documentation into multiple files inside the docs folder 2021-07-29 15:03:41 +00:00
de6edeedcc Add docs on how to avoid Nomad rate limiting
Without this configuration, Nomad caps the maximum concurrent connections
of a unique client to 100. This is not sufficient for our use case.
2021-07-29 14:07:22 +00:00
f03d07cd54 Add LICENSE 2021-07-29 13:42:39 +00:00
c21b85b32a Add missing copyright header 2021-07-29 13:42:39 +00:00
c9d6cd5996 Move runner interactivity timer to own file
Previously, the interactivity timer was implemented in the same file
as the runner. This made the file long and the project structure more
complicated.
2021-07-29 13:30:46 +00:00
5c9f975285 Update api.tpl.nomad to allow configuration Nomad ACL Token for Poseidon 2021-07-29 12:49:17 +00:00
67ebdbd650 Add option to configure template job HCL file
Previously, the template job HCL file was hardcoded using go:embed
in the binary. However, this did not allow users running Poseidon
to change its content. Now, users can change the content of the
template job HCL file using the configuration option.
2021-07-29 11:54:36 +00:00
12da813081 Describe how Poseidon abstracts from Nomad 2021-07-29 11:32:52 +00:00
81eccbdf9c Remove custom deployment watcher script
As of version 1.1.2 of Nomad, the CLI monitors job deployments by
default until they are finished. Thus our custom job deployment
watcher script is not required anymore.
2021-07-29 09:57:04 +00:00
3564cf767e Update Nomad dependencies to 1.1.2 2021-07-29 09:57:04 +00:00
210a048b5e Update api.tpl.nomad to allow configuring TLS to Nomad through gitlab 2021-07-29 09:43:21 +00:00
01d16600b0 Document activating TLS between Poseidon and Nomad 2021-07-29 09:43:21 +00:00
6a60b6cd89 Add config option to enable (m)TLS between Poseidon and Nomad 2021-07-29 09:43:21 +00:00
e2d71a11ad Avoid concurrent writes to the websocket connection
Previously, the server sometimes crashed due to concurrent writes
to the websocket connection. Now, we ensure that only one concurrent
function writes to the websocket at a time by enclosing the WriteMessage
function with a mutex.
2021-07-29 09:21:15 +00:00
6929169cb5 Add test for nullio.ReadWriter 2021-07-29 10:28:47 +02:00
8d24bda61a Send SIGQUIT when cancelling an execution
When the context passed to Nomad Allocation Exec is cancelled, the
process is not terminated. Instead, just the WebSocket connection is
closed. In order to terminate long-running processes, a special
character is injected into the standard input stream. This character is
parsed by the tty line discipline (tty has to be true). The line
discipline sends a SIGQUIT signal to the process, terminating it and
producing a core dump (in a file called 'core'). The SIGQUIT signal can
be caught but isn't by default, which is why the runner is destroyed if
the program does not terminate during a grace period after the signal
was sent.
2021-07-29 10:28:47 +02:00
91537a7364 Use test docker image in e2e tests
The TestCreateOrUpdateEnvironment function would previously use
the python:latest Docker image in its execution environment request.
However, this lead to pull rate limiting by Docker Hub in our CI.
2021-07-27 15:26:53 +00:00
fe240c82b4 Remove demo job HCL file
Previously we used this file to deploy a job on Nomad that our API
used for e2e tests. Now that we create the environments in the e2e
tests, we don't need the demo job anymore.
2021-07-27 16:31:03 +02:00
f323bdf169 Add documentation on authenticating against Nomad 2021-07-27 11:35:55 +00:00
3aa1227db6 Use authentication token from config for communication with Nomad 2021-07-27 11:35:55 +00:00
23b726cef9 Correct behavior when WebSocket closes. 2021-07-26 06:47:55 +00:00
909f347d2f Remove tests dependency from nullreader test
Previously we had a dependency to the tests package. As the
nullreader package is in the pkg directory it should be publicly
available. However, having the tests dependency could lead to a
transitive dependency to an internal package, if the tests package
would import one. Thus, we removed it.
2021-07-21 12:55:35 +02:00
8b26ecbe5f Restructure project
We previously didn't really had any structure in our project apart
from creating a new folder for each package in our project root.
Now that we have accumulated some packages, we use the well-known
Golang project layout in order to clearly communicate our intent
with packages. See https://github.com/golang-standards/project-layout
2021-07-21 12:55:35 +02:00
2f1383b743 Add tests for returning mapped ports of runners 2021-07-21 08:22:10 +02:00
64764a9809 Return mapped ports when requesting runners
We now store the mapped ports returned by Nomad locally in our runner
struct and return them when requesting the runner. The returned ip
address is in most Nomad setups not reachable from external users.
2021-07-20 23:22:58 +02:00
d7c1787b57 Disable allow-failure for linting pipeline
Now that all linting issues are fixed, we disable allow-failure for
the linting step to ensure that later commits adhere to the linter.
2021-07-13 08:59:25 +02:00
c7606f3d5f Fix a lot of linting issues
After we introduced the linter we haven't really touched the old code.
This commit now fixes all linting issue that exist right now.
2021-07-13 08:59:25 +02:00
bd7fb53385 Fix bug that the count of the default task group is set to the prewarming pool size 2021-07-07 09:21:57 +02:00
68eacae7fe Fix bug that config task group is not added to the template job (and the faulty tests) 2021-07-06 10:09:36 +02:00
bbc1ce12ca Delete idle runners when the environment is scaled down 2021-07-02 13:00:13 +02:00
66d04fde2a Remove unused function ScaleAllEnvironments 2021-07-01 09:21:09 +00:00
50a2a22b74 Only create exactly one new runner when one runner is claimed
Previously we would create as much runners as needed based on the
local idleRunnersCount and the desiredIdleRunnersCount. This is
problematic if two runners are claimed shortly after one another.
As we only add a runner to the idleRunners list once we get the
event from Nomad, the second runner claim in a short timeframe
would create two new runners. This has been fixed now.
2021-06-29 09:11:21 +02:00
e0e254a6af Persist runner timeout in metadata
To be able to restore the runner timeouts even after a Poseidon restart,
the timeout is stored in the Nomad metadata. The timeout will restart,
but at least the runner will be returned at all.
2021-06-23 11:07:17 +02:00
ae08e37106 Add end to end test for inactivity timeout 2021-06-23 11:04:19 +02:00