-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify map session management (#1931)
This PR removes the complicated session management introduced in #1791 which kept track of the sessions in a map, in addition to the channel already kept track of in the notifier. Instead of trying to close the mapsession, it will now be replaced by the new one and closed after so all new updates goes to the right place. The map session serve function is also split into a streaming and a non-streaming version for better readability. RemoveNode in the notifier will not remove a node if the channel is not matching the one that has been passed (e.g. it has been replaced with a new one). A new tuning parameter has been added to added to set timeout before the notifier gives up to send an update to a node. Add a keep alive resetter so we wait with sending keep alives if a node has just received an update. In addition it adds a bunch of env debug flags that can be set: - `HEADSCALE_DEBUG_HIGH_CARDINALITY_METRICS`: make certain metrics include per node.id, not recommended to use in prod. - `HEADSCALE_DEBUG_PROFILING_ENABLED`: activate tracing - `HEADSCALE_DEBUG_PROFILING_PATH`: where to store traces - `HEADSCALE_DEBUG_DUMP_CONFIG`: calls `spew.Dump` on the config object startup - `HEADSCALE_DEBUG_DEADLOCK`: enable go-deadlock to dump goroutines if it looks like a deadlock has occured, enabled in integration tests. Signed-off-by: Kristoffer Dalby <[email protected]>
- Loading branch information
Showing
18 changed files
with
423 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,43 @@ | ||
# This Dockerfile and the images produced are for testing headscale, | ||
# and are in no way endorsed by Headscale's maintainers as an | ||
# official nor supported release or distribution. | ||
# Copyright (c) Tailscale Inc & AUTHORS | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
FROM golang:latest | ||
# This Dockerfile is more or less lifted from tailscale/tailscale | ||
# to ensure a similar build process when testing the HEAD of tailscale. | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y dnsutils git iptables ssh ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
FROM golang:1.22-alpine AS build-env | ||
|
||
RUN useradd --shell=/bin/bash --create-home ssh-it-user | ||
WORKDIR /go/src | ||
|
||
RUN apk add --no-cache git | ||
|
||
# Replace `RUN git...` with `COPY` and a local checked out version of Tailscale in `./tailscale` | ||
# to test specific commits of the Tailscale client. This is useful when trying to find out why | ||
# something specific broke between two versions of Tailscale with for example `git bisect`. | ||
# COPY ./tailscale . | ||
RUN git clone https://github.com/tailscale/tailscale.git | ||
|
||
WORKDIR /go/tailscale | ||
WORKDIR /go/src/tailscale | ||
|
||
|
||
# see build_docker.sh | ||
ARG VERSION_LONG="" | ||
ENV VERSION_LONG=$VERSION_LONG | ||
ARG VERSION_SHORT="" | ||
ENV VERSION_SHORT=$VERSION_SHORT | ||
ARG VERSION_GIT_HASH="" | ||
ENV VERSION_GIT_HASH=$VERSION_GIT_HASH | ||
ARG TARGETARCH | ||
|
||
RUN GOARCH=$TARGETARCH go install -ldflags="\ | ||
-X tailscale.com/version.longStamp=$VERSION_LONG \ | ||
-X tailscale.com/version.shortStamp=$VERSION_SHORT \ | ||
-X tailscale.com/version.gitCommitStamp=$VERSION_GIT_HASH" \ | ||
-v ./cmd/tailscale ./cmd/tailscaled ./cmd/containerboot | ||
|
||
FROM alpine:3.18 | ||
RUN apk add --no-cache ca-certificates iptables iproute2 ip6tables curl | ||
|
||
RUN git checkout main \ | ||
&& sh build_dist.sh tailscale.com/cmd/tailscale \ | ||
&& sh build_dist.sh tailscale.com/cmd/tailscaled \ | ||
&& cp tailscale /usr/local/bin/ \ | ||
&& cp tailscaled /usr/local/bin/ | ||
COPY --from=build-env /go/bin/* /usr/local/bin/ | ||
# For compat with the previous run.sh, although ideally you should be | ||
# using build_docker.sh which sets an entrypoint for the image. | ||
RUN mkdir /tailscale && ln -s /usr/local/bin/containerboot /tailscale/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.