Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
badb930
refactor: :arrow_up: move to tailscale 1.44, update dependencies
Jun 27, 2023
586cd80
ci: :construction_worker: update docker reference
Jun 27, 2023
aaf0c83
feat: :sparkles: graceful shutdown, remove nodes from tailnet
Jun 27, 2023
8b44af6
fix: :bug: support named ports instead of numbers in the ingest spec
Jun 27, 2023
70acbc4
fix: :bug: construct proper URL with correct for the reverse proxy
Jun 27, 2023
9b3cdda
fix: :bug: host is FQDN
Jun 27, 2023
b774f6c
feat: :loud_sound: additional debug information if upstream match is …
Jun 27, 2023
bd41d21
refactor: :art: organize imports
Jun 27, 2023
0ac35c8
docs: attribution
Jun 27, 2023
86a821e
ci: :rocket: update dockerhub references
Jun 27, 2023
3dadd81
fix: :bug: include query string in the backend URL
Jun 27, 2023
cf75e60
feat: :sparkles: implement provisioning of Tailscale Funnel option
Jun 28, 2023
386bc74
docs: :art: split documentation by topic
Jun 28, 2023
e2625c4
feat: :sparkles: track ingress definition generation to re-create hosts
Jun 28, 2023
f904f29
build: :sparkles: stable tag for docker images
Jun 28, 2023
643ad39
feat: :sparkles: implement TCP proxies
Jun 28, 2023
5b6379c
ci: :art: use own package name
Jun 29, 2023
55af3b2
refactor: :art: refactor target resolution into common method
Jun 30, 2023
b3b8272
fix: :bug: do not crash if service was not found
Jul 3, 2023
36179c2
fix: :sparkles: do not re-create TCP proxies if nothing has changed i…
Jul 3, 2023
bc9cc3f
feat: :sparkles: store state in k8s secrets
Jul 3, 2023
20171a7
fix: :sparkles: use full spec to track TCP services, not just the hos…
Jul 3, 2023
6e8b1cd
refactor: :art: split TCP and HTTP controllers
Jul 3, 2023
df272ca
fix: :bug: avoid race condition on shutdown
Jul 4, 2023
47fea4a
refactor: :art: break up further into modules
Jul 4, 2023
17bbe01
style: :memo: cleanup TIC messaging
Jul 4, 2023
c4d317a
docs: :memo: adding more documentation to the tool
Jul 4, 2023
1e809ff
fix: :bug: wait for the termination signal
Jul 4, 2023
bd9c99d
ci: :sparkles: build for amd64 and arm64 architectures
Jul 4, 2023
fccd3ba
ci: :construction_worker: generalize build
Jul 5, 2023
f674edd
feat: :sparkles: filter ingress resources by ingressClassName
Jul 5, 2023
e6687dc
feat: :wrench: add minimal resource requirements for the pods
Jul 5, 2023
cfb77d6
Fix ConfigMap: strict decoding error: unknown field "spec"
Brandl Aug 28, 2023
1f350e1
Merge pull request #1 from Brandl/Brandl-patch-demo
valentinalexeev Sep 12, 2023
9041e5e
ci: bump action versions
valentinalexeev Sep 12, 2023
4d9ea80
ci: allow forks to define own usernames and repos
valentinalexeev Sep 12, 2023
7f2a56b
ci: setup dependabot
valentinalexeev Sep 12, 2023
699334a
build(deps): bump k8s.io/api from 0.27.2 to 0.28.1
dependabot[bot] Sep 12, 2023
9444a95
Merge pull request #2 from valentinalexeev/dependabot/go_modules/k8s.…
valentinalexeev Sep 12, 2023
519b6e8
build(deps): bump k8s.io/client-go from 0.27.2 to 0.28.1
dependabot[bot] Sep 12, 2023
7757d3e
Merge pull request #4 from valentinalexeev/dependabot/go_modules/k8s.…
valentinalexeev Sep 12, 2023
c40024d
build: :arrow_up: bump tailscale up to v1.48.2
Sep 12, 2023
ad8ebef
build: :poop: temporary disable toolchain to fix buildx on github
Sep 12, 2023
08a5646
build: :arrow_up: move to 1.21 in the builder
Sep 12, 2023
4a38a21
build: :arrow_up: bump to 1.56 for tailscale and 0.29 for k8s apis
Dec 14, 2023
111da38
feat: :sparkles: introduce webclient annotation to enable Tailscale W…
Dec 19, 2023
5ce42e8
build: :arrow_up: update tsnet to 1.58.0
Jan 19, 2024
aa3e4ed
Allow for overriding registry when building/pushing
halkeye Jan 31, 2024
7aa63a0
fix segmentation violation (#20) by handling null ingress class name
halkeye Feb 1, 2024
9508332
build: :arrow_up: use go 1.22 image
Feb 28, 2024
995ae07
build: :arrow_up: move to 1.60, fix gvisor build dependency issue
Feb 28, 2024
01c5947
docs: :art: Add myself to the authors
Feb 28, 2024
fa0d014
Merge pull request #22 from halkeye/makefile
valentinalexeev Feb 28, 2024
2fd05f6
Merge pull request #23 from halkeye/fix-20
valentinalexeev Feb 28, 2024
d26db19
build: :arrow_up: update tailscale to 1.60.1
Mar 1, 2024
6be53d1
build: :arrow_up: bump tailscale version to 1.62.0
Mar 14, 2024
9c33e93
build: :arrow_up: bump protobuf dependency to 1.33.0 via dependabot
Mar 14, 2024
9238622
build: :arrow_up: bump up dependencies identified by dependabot
Mar 20, 2024
519bf89
build: :arrow_up: move to tailscale 1.66.1
May 10, 2024
358403a
build: :arrow_up: bump tailscale to 1.66.3
May 17, 2024
02fa2a2
fix: :pushpin: pin gvisor to the version compatible with tailscale
May 19, 2024
a055be4
build: :arrow_up: bump k8s to 0.30.1
May 19, 2024
2415bb7
build: :arrow_up: bump tailscale to version 1.66.4
May 24, 2024
1125d62
build: :construction_worker: add image provenance calculation
valentinalexeev May 24, 2024
161defa
fix: :construction_worker: add missing options for attestations
valentinalexeev May 24, 2024
2b2fcd4
Revert "build: :construction_worker: add image provenance calculation"
Jun 16, 2024
fced4f4
build: :zap: go mod tidy
Jun 16, 2024
c20a5c8
build: :arrow_up: tailscale 1.68.1, k8s dependencies
Jun 16, 2024
eb55595
build: :arrow_up: update Go version and dependencies, bump tailscale …
valentinalexeev Feb 26, 2025
cea42e0
build: :arrow_up: update base image to golang 1.24-alpine
valentinalexeev Feb 26, 2025
1b28c79
build: :zap: remove unused indirect dependencies from go.mod
valentinalexeev Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
13 changes: 7 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v1
- uses: docker/login-action@v3
with:
username: mewil
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: docker/build-push-action@v2
- uses: docker/build-push-action@v5
with:
push: true
tags: mewil/tailscale-ingress-controller:latest
platforms: linux/amd64,linux/arm64
tags: ${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPO }}:stable
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM golang:1.19-alpine as builder
FROM golang:1.24-alpine as builder

RUN apk add --update \
ca-certificates \
git \
&& rm -rf /var/cache/apk/*

ENV CGO_ENABLED=0
WORKDIR /go/src/github.com/mewil/tailscale-ingress-controller
WORKDIR /go/src/github.com/valentinalexeev/tailscale-ingress-controller
COPY go.mod go.sum ./
RUN go mod download

Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2022 Michael Wilson
Copyright (c) 2023 Valentin A. Alekseev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
VARIANT?=latest
VARIANT_SUFFIX=
REGISTRY?=valentinalexeev

ifneq (${VARIANT},latest)
VARIANT_SUFFIX=-${VARIANT}
endif

build:
docker build -t ${REGISTRY}/tailscale-ingress-controller:${VARIANT} --push .

deploy:
kubectl apply -f demo/ingress-controller${VARIANT_SUFFIX}.yaml

remove:
kubectl delete -f demo/ingress-controller${VARIANT_SUFFIX}.yaml

redeploy: remove deploy
60 changes: 57 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The controller will [create a Tailscale node](https://tailscale.com/blog/tsnet-v

Try it out by applying the resources in the demo directory:
```
git clone https://github.com/mewil/tailscale-ingress-controller
git clone https://github.com/valentinalexeev/tailscale-ingress-controller
cd tailscale-ingress-controller/demo
export TS_AUTHKEY=<your authkey>
sed "s/\$TS_AUTHKEY/$TS_AUTHKEY/g" * | kubectl apply -f -
Expand All @@ -18,10 +18,64 @@ If all goes well, you should be able to access the hello world HTTP demo service
The demo manifests create a demo backend deployment and service, a demo ingress resource, a deployment for the ingress controller, and a secret for your Tailscale key.
The controller will create a Tailscale node with the hostname `demo` and proxy traffic from the Tailscale network to the backend Kubernetes service.

The controller proxy server will also parse the remote IP address from Tailscale and add `X-Webauth-User` and `X-Webauth-Name` HTTP headers to the request before forwarding it for the Tailscale login name and display name, respectively.
### Tailscale SSO
As Tailscale provides authentication information as part of the requests the Ingress Controller is able to supply this information to the services.

The controller proxy server will parse the remote IP address from Tailscale and add `X-Webauth-User` and `X-Webauth-Name` HTTP headers to the request before forwarding it for the Tailscale login name and display name, respectively.

The services can be configured to use the provided headers as SSO credentials. See sample use case on [How To Seamlessly Authenticate to Grafana using Tailscale](https://tailscale.com/blog/grafana-auth/)

### TLS support
Tailscale provides native HTTPS implementation with certificates by Let's Encrypt.

If the host is also listed in the `tls` section of the Ingress spec (see comment in the example Ingress to try it), then the Tailscale node will proxy requests from port 443 instead of 80 and [automatically generate a certificate for itself](https://tailscale.com/blog/tls-certs/).

### Funnel support
The Ingress Controller allows the use of [Tailscale Funnel](https://tailscale.com/kb/1223/tailscale-funnel/) to expose services to the public network.

Unlike HTTPS support, to enable Funnel for an Ingress point a custom annotation ``tailscale.com/funnel: "true"`` needs to be added to the resource definition.
```yaml
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tailscale-ingress-funnel
labels:
tailscale.com/funnel: "true"
spec:
rules:
- host: demo-funnel
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: demo-backend
port:
number: 8080
```

Please refer to the Tailscale documentation on additional opt-in actions (nodeAttrs and ACL tag set-up) required to make Funnel enabled for the services.

### TCP service support
The TCP support was inspired by the ``ingress-nginx`` and relies on a dedicated ConfigMap with a mapping between virtual Tailscale nodes and kubernetes services.

To configure ``tailscale-ingress-controller`` to proxy TCP requests the following settings must be done:
* Create a new ConfigMap that will include service mappings. The notation of the config map is the following:
```yaml
...
data:
# <Host>.<Port>: [<Namespace>/]<Service>:<Port>
# A sample mapping to allow connection to the Clickhouse native port (deployed from a Bitnami Helm chart)
clickhouse.9000: clickhouse/clickhouse-1687979852:9000
```
* Deploy controller with an additional environment variable ``TCP_SERVICES_CONFIGMAP`` set to the name of the newly created ConfigMap.

## Future Work
- Store Tailscale state in a Kubernetes Secret
- Support Ingress Classes
- High Availability

## Authors
- Michael Wilson http://github.com/mewil
- Valentin Alekseev http://github.com/valentinalexeev
238 changes: 0 additions & 238 deletions controller.go

This file was deleted.

Loading