Commit graph

1330 commits

Author SHA1 Message Date
Kristoffer Dalby
a054e2514a
Keep tailscale count at 25 in integration tests 2021-08-21 09:26:18 +01:00
Kristoffer Dalby
c49fe26da7
Code clean up, loglevel debug for integration tests 2021-08-21 09:15:16 +01:00
ohdearaugustin
75afdc6306 github/workflows: remove version tag 2021-08-20 20:10:34 +02:00
ohdearaugustin
f02beaf075 github/workflows: add checkout 2021-08-20 19:45:01 +02:00
ohdearaugustin
8bcc7e88f0 github/workflows: add dispatch 2021-08-20 19:37:15 +02:00
ohdearaugustin
0adbd720bf github/workflows: add docker release 2021-08-20 19:15:20 +02:00
Kristoffer Dalby
d93a7f2e02
Make Info default log level 2021-08-20 17:15:07 +01:00
Kristoffer Dalby
88d7ac04bf
Account for racecondition in deleting/closing update channel
This commit tries to address the possible raceondition  that can happen
if a client closes its connection after we have fetched it from the
syncmap before sending the message.

To try to avoid introducing new dead lock conditions, all messages sent
to updateChannel has been moved into a function, which handles the
locking (instead of calling it all over the place)

The same lock is used around the delete/close function.
2021-08-20 16:52:34 +01:00
Kristoffer Dalby
1f422af1c8
Save headscale logs if jobs fail 2021-08-20 16:50:55 +01:00
Kristoffer Dalby
53168d54d8
Make http timeout 30s instead of 10s 2021-08-19 22:29:03 +01:00
Kristoffer Dalby
b0ec945dbb
Make lastStateChange namespaced 2021-08-19 18:19:26 +01:00
Kristoffer Dalby
48ef6e5a6f
Rename keepAlive function, as it now does more things 2021-08-19 18:06:57 +01:00
Kristoffer Dalby
8d1adaaef3
Move isOutdated logic to updateChan consumation 2021-08-19 18:05:33 +01:00
Kristoffer Dalby
dd8c0d1e9e Move most "poll" functionality to poll.go
This function migrates more poll functions (including keepalive) to
poll.go to keep it somehow in the same file.

In addition it makes changes to improve the stability and ensure nodes
get the appropriate updates from the headscale control and are not left
in an inconsistent state.

Two new additions is:

omitpeers=true will now trigger an update if the clients are not already up
to date

keepalive has been extended with a timer that will check every 120s if
all nodes are up to date.
2021-08-18 23:24:22 +01:00
Kristoffer Dalby
57b79aa852 Set timeout, add lastupdate field
This commit makes two reasonably major changes:

Set a default timeout for the go HTTP server (which gin uses), which
allows us to actually have broken long poll sessions fail so we can have
the client re-establish them.
The current 10s number is chosen randomly and we need more testing to
ensure that the feature work as intended.

The second is adding a last updated field to keep track of the last time
we had an update that needs to be propagated to all of our
clients/nodes. This will be used to keep track of our machines and if
they are up to date or need us to push an update.
2021-08-18 23:21:11 +01:00
Kristoffer Dalby
2f883410d2 Add lastUpdate field to machine, function issue message on update channel
This commit adds a new field to machine, lastSuccessfulUpdate which
tracks when we last was able to send a proper mapupdate to the node. The
purpose of this is to be able to compare to a "global" last updated time
and determine if we need to send an update map request to a node.

In addition it allows us to create a scheduled check to see if all known
nodes are up to date.

Also, add a helper function to send a message to the update channel of a
machine.
2021-08-18 23:17:38 +01:00
Kristoffer Dalby
6fa61380b2
Up client count, make arguments more explicit and clean up unused assignments 2021-08-18 23:17:09 +01:00
Juan Font
47b61c0cea
Merge pull request #86 from juanfont/better-ui
Improve tables in CLI
2021-08-16 09:33:47 +02:00
Juan Font
d739ac830f
Merge pull request #87 from juanfont/fix-route-notify
Send notifications when enabling a route
2021-08-16 09:25:31 +02:00
Juan Font
26024fedc7
Merge branch 'main' into fix-route-notify 2021-08-16 00:29:38 +02:00
Juan Font
a376b697c0 Send notifications when enabling a route 2021-08-16 00:17:26 +02:00
Juan Font
bc2574680d Linting 2021-08-15 23:35:03 +02:00
Juan Font
f194b41435 Better table in preauthkeys 2021-08-15 23:29:55 +02:00
Juan Font
350f7da55d Better table in namespaces 2021-08-15 23:20:38 +02:00
Juan Font
36f5f78f46 pterm dependency 2021-08-15 23:10:50 +02:00
Juan Font
55fe5b0b41 Use pterm table in node list 2021-08-15 23:10:39 +02:00
Kristoffer Dalby
7d1a5c00a0
Try with longer timeout 2021-08-13 16:56:28 +01:00
Kristoffer Dalby
036061664e
initial integration test file 2021-08-13 16:12:01 +01:00
Kristoffer Dalby
5b1b40ce93
Merge pull request #83 from kradalby/more-integration-tests
Improve reliability of PollMapHandler, more integration tests
2021-08-13 16:05:32 +01:00
Kristoffer Dalby
a8d9fdce3c
Uncomment ping test 2021-08-13 11:01:23 +01:00
Kristoffer Dalby
700382cba4
Split stream part of pollhandlermap into its own func 2021-08-13 10:33:50 +01:00
Kristoffer Dalby
9698abbfd5
Resolve merge conflict 2021-08-13 10:33:19 +01:00
Juan Font
5bfcf5c917
Merge pull request #82 from juanfont/really-expire-ephemeral
Also notify peers when deleting ephemerals
2021-08-12 22:05:53 +02:00
Juan Font
8eb7d47072 Fixed linting 2021-08-12 21:57:20 +02:00
Juan Font
ab61c87701 Also notify peers when deleting ephemerals 2021-08-12 21:53:37 +02:00
Juan Font
c1e6157847 Expire ephemeral is internal 2021-08-12 21:45:40 +02:00
Juan Font
4c849539fc Expire the ephemeral nodes in the Serve method 2021-08-12 21:44:12 +02:00
Juan Font
9c2a630055
Merge pull request #81 from kradalby/integration-tests
Add Integration tests
2021-08-12 11:15:45 +02:00
Kristoffer Dalby
0e1ddf9715
Set longer timeout for integration tests 2021-08-12 07:36:38 +01:00
Kristoffer Dalby
54da1a4155
Commit the correct integration etc files 2021-08-12 07:05:26 +01:00
Kristoffer Dalby
7141e2ed70
Fix hostname passed to join command 2021-08-11 17:12:39 +01:00
Kristoffer Dalby
c9e5048015 Merge remote-tracking branch 'upstream/main' into integration-tests 2021-08-08 17:57:28 +01:00
Kristoffer Dalby
4e077b053c Initial work, add integration tests
This commit adds integration tests to headscale. They are currently
quite simple, but it lays the groundwork for more comprehensive testing
and ensuring we dont break things with the official tailscale client.

The test works by leveraging Docker (via dockertest) to spin up a
Headscale container, and a number of tailscale containers (10).

Each tailscale container is joined to the headscale and then "passed on"
to the tests.

Currently three tests have been implemented:

- Have all tailscale containers join headscale (in the setup process)
- Get IP from each container (I plan to extend this with cross-ping)
- List nodes with headscales CLI and verify all has been registered

This test depends on Docker, and currently, I have not looked into
hooking it into Github Actions.
2021-08-08 17:50:32 +01:00
Kristoffer Dalby
f973aef80c Add Dockerfile to build tailscale docker image for integration tests 2021-08-08 17:43:06 +01:00
Kristoffer Dalby
a43bb1bb40 Improve Dockerfile
This commit makes several changes to the dockerfile:

- Add go.mod and go.sum in a seperate stage, subsequently calling `go
  mod download` to make it cache dependencies and speed up builds
- Use ubuntu:latest (28MB larger) instead of scratch, makes the image a
  lot easier to debug (e.g. it has a shell and a package manager)
- Change ENTRYPOINT to CMD, this makes the behaviour of the image
  slightly different from a CLI perspective, but makes interacting with
  the image from code, docker-compose and kubernetes easier.
2021-08-08 17:39:39 +01:00
Kristoffer Dalby
d86123195c
Add a dockerignore file to speed up builds and make cachine better 2021-08-08 17:38:44 +01:00
Kristoffer Dalby
91ffd10192 Remove "Keys: " from create auth key output
This is based on the premis that "the user know what command they
executed" and therefor know that the output is the key.

This makes the command a lot more useful in scripts.
2021-08-08 17:37:23 +01:00
Kristoffer Dalby
642c7824a7
Add trace log for machine failing to parce ip in toNode 2021-08-08 17:37:04 +01:00
Kristoffer Dalby
149279f3d5 Add health endpoint
Allow us to tell when the server is up and running and can answer
requests
2021-08-08 17:36:25 +01:00
Juan Font
275214920f
Merge pull request #80 from juanfont/delete-pak
Add CLI command to mark preauthkeys as expired
2021-08-08 10:52:18 +02:00