Skip to content

feat(ci): bump to upstream 1.74.0 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 127 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
1e8f8ee
VERSION.txt: this is v1.73.0 (#13181)
agottardo Aug 19, 2024
8fad8c4
tstest/tailmac: add customized macOS virtualization tooling (#13146)
barnstar Aug 19, 2024
f95785f
util/winutil: add constants from Win32 SDK for dll blocking mitigatio…
dblohm7 Aug 19, 2024
16bb541
wgengine/magicsock: replace deprecated poly1305 (#13184)
tomholford Aug 19, 2024
9d2b182
ipnlocal: support setting authkey at login using syspolicy (#13061)
agottardo Aug 20, 2024
01aa01f
ipn/ipnlocal: network-lock, error if no pubkey instead of panic
kradalby Jun 17, 2024
2105773
cmd/k8s-operator/deploy: replace wildcards in Kubernetes Operator RBA…
pierig-n3xtio Aug 20, 2024
8f6a235
util/winutil: add GetRegUserString/SetRegUserString accessors for sto…
dblohm7 Aug 13, 2024
93dc2de
cmd/k8s-operator: support default proxy class in k8s-operator (#12711)
ChandonPierre Aug 20, 2024
df6014f
net/tstun,wgengine{/netstack/gro}: refactor and re-enable gVisor GRO …
jwhited Aug 20, 2024
7675c3e
wgengine/netstack/gro: exclude importation of gVisor GRO pkg on iOS (…
jwhited Aug 20, 2024
7d83056
ssh/tailssh: fix SSH on busybox systems
oxtoacart Aug 5, 2024
151b77f
cmd/tl-longchain: tool to re-sign nodes with long rotation signatures
knyar Aug 20, 2024
af3d3c4
types/prefs: add a package containing generic preference types
nickkhyl Jul 16, 2024
4b525fd
ssh/tailssh: only chdir incubator process to user's homedir when nece…
oxtoacart Aug 16, 2024
8e42510
wgengine/netstack: disable gVisor GSO on Linux (#13215)
jwhited Aug 21, 2024
690d3bf
cmd/tailscale/cli: add debug command to do DNS lookups portably
bradfitz Aug 22, 2024
4637ac7
ipn/ipnlocal: remember last notified taildrive shares and only notify…
oxtoacart Aug 21, 2024
0ff474f
all: fix new lint warnings from bumping staticcheck
bradfitz Aug 22, 2024
696711c
all: switch to and require Go 1.23
bradfitz Aug 22, 2024
0cb7eb9
net/dns: updated gonotify dependency to v2 that supports closable con…
illarion Aug 22, 2024
aedfb82
go.mod.sri: update SRI hash for go.mod changes
Aug 22, 2024
e54c81d
types/views: add Slice.All iterator
bradfitz Jul 24, 2024
d00d6d6
go.mod: update to github.com/tailscale/netlink library that doesn't r…
oxtoacart Aug 22, 2024
743d296
update to github.com/tailscale/netlink library that doesn't require v…
oxtoacart Aug 22, 2024
1191eb0
tstest/natlab: add unix address to writer for dgram mode
barnstar Aug 22, 2024
6280c44
go.mod.sri: update SRI hash for go.mod changes
Aug 22, 2024
3c66ee3
cmd/systray: add a basic linux systray app
willnorris Jul 10, 2024
b091264
cmd/systray: set ipn.NotifyNoPrivateKeys, permit non-operator use
bradfitz Aug 23, 2024
d862898
go.mod.sri: update SRI hash for go.mod changes
Aug 23, 2024
3904e4d
cmd/tta, tstest/natlab/vnet: remove unneeded port 124 log hack, add l…
bradfitz Aug 23, 2024
3b70968
cmd/vnet: add --blend and --pcap flags
bradfitz Aug 23, 2024
5a99940
tstest/natlab/vnet: explicitly ignore PCP and SSDP UDP queries
bradfitz Aug 23, 2024
aa42ae9
tstest/natlab: make a new virtualIP type in prep for IPv6 support
bradfitz Aug 23, 2024
a9dc6e0
util/codegen, cmd/cloner, cmd/viewer: update codegen.LookupMethod to …
nickkhyl Aug 22, 2024
03acab2
cmd/cloner, cmd/viewer, util/codegen: add support for aliases of clon…
nickkhyl Aug 22, 2024
e5fd36a
tstest/natlab: respect NATTable interface's invalid-means-drop everyw…
bradfitz Aug 23, 2024
475ab1f
cmd/vnet: omit log spam when backend status hasn't changed
bradfitz Aug 23, 2024
641693d
ipn/ipnlocal: install IPv6 service addr route (#13252)
jwhited Aug 23, 2024
367bfa6
tstest/integration: exercise TCP DNS queries against quad-100 (#13231)
jwhited Aug 23, 2024
9783065
tstest/integration: change log.Fatal() to t.Fatal() (#13253)
jwhited Aug 23, 2024
31b5239
tstest/natlab/vnet: flush and sync pcap file after every packet
Aug 24, 2024
b78df4d
tstest/natlab/vnet: add start of IPv6 support
bradfitz Aug 14, 2024
8af50fa
ipn/ipnlocal: update routes on link change with ExitNodeAllowLANAccess
raggi Aug 23, 2024
cccacff
types/opt: add BoolFlag for setting Bool value as a flag
willnorris Aug 26, 2024
e0bdd5d
tstest/natlab: simplify a defer
bradfitz Aug 25, 2024
3a8cfbc
tstest/natlab: be more paranoid about IP versions from gvisor
bradfitz Aug 25, 2024
6dd1af0
tstest/natlab: refactor HandleEthernetPacketForRouter a bit
bradfitz Aug 25, 2024
2636a83
cmd/tta: pull out test driver dialing into a type, fix bugs
bradfitz Aug 26, 2024
9f7683e
logpolicy: extend the gokrazy/natlab wait-for-network delay for IPv6
bradfitz Aug 26, 2024
0157000
tstest/natlab: fix IPv6 tests, remove TODOs
bradfitz Aug 26, 2024
f99f970
tstest/natlab/vnet: rename some things for clarity
bradfitz Aug 26, 2024
6d4973e
wgengine/netstack: use types/logger.Logf instead of stdlib log.Printf…
jwhited Aug 26, 2024
d097096
net/tstun,wgengine/netstack: make inbound synthetic packet injection …
jwhited Aug 27, 2024
bfcb356
wgengine/netstack: re-enable gVisor GSO on Linux (#13269)
jwhited Aug 27, 2024
06c31f4
tsweb/varz: remove pprof
kradalby Aug 1, 2024
a2c42d3
usermetric: add initial user-facing metrics
kradalby Aug 1, 2024
31cdbd6
net/tstun: fix gvisor inbound GSO packet injection (#13283)
jwhited Aug 27, 2024
ff1d0aa
tstest/natlab/vnet: start adding tests
bradfitz Aug 27, 2024
8b23ba7
tstest/natlab/vnet: add qemu + Virtualization.framework protocol tests
bradfitz Aug 28, 2024
961ee32
ipn/{ipnauth,ipnlocal,ipnserver,localapi}: start baby step toward mov…
nickkhyl Aug 27, 2024
73b3c8f
tstest/natlab/vnet: add IPv6 all-nodes support
bradfitz Aug 28, 2024
80b2b45
ipn/ipnlocal: refactor and cleanup profileManager
nickkhyl Aug 28, 2024
d21ebc2
wgengine/netstack: implement netstack loopback (#13301)
jwhited Aug 29, 2024
82c2c5c
tstest/natlab/vnet: add more tests
bradfitz Aug 28, 2024
b48c8db
ipn/ipnlocal: set WantRunning upon an interactive login, but not duri…
nickkhyl Aug 26, 2024
e93c160
nix: update nix and use go 1.23
kradalby Aug 29, 2024
71acf87
tstest/integration: add UDP netstack loopback integration test (#13312)
jwhited Aug 29, 2024
0926954
net/tstun,wgengine/netstack: implement TCP GRO for local services (#1…
jwhited Aug 29, 2024
a584d04
dns: increase TimeToVisible before DNS unavailable warning (#13317)
agottardo Aug 29, 2024
ecc4515
ssh/tailssh: add ability to force V2 behavior using new feature flag
oxtoacart Aug 6, 2024
45c9775
net/tstun: clarify GROFilterFunc *gro.GRO usage (#13318)
jwhited Aug 29, 2024
35423fc
drive/driveimpl: use su instead of sudo
oxtoacart Aug 29, 2024
959285e
ipn/ipnlocal: fix race condition that results in a panic sending on a…
nickkhyl Aug 28, 2024
109d089
posture: stop logging serial numbers
knyar Aug 30, 2024
ffa1c93
tstest/natlab/vnet: use mkPacketErr in more places
bradfitz Aug 29, 2024
b1a5b40
tstest/natlab/vnet: add DHCP tests, ignore DHCPv4 on v6-only networks
bradfitz Aug 29, 2024
7e88d67
tstest/natlab/vnet: add syslog tests
bradfitz Aug 30, 2024
3d9e3a1
tstest/natlab/vnet: move some boilerplate to mkPacket helper
bradfitz Aug 31, 2024
2f2aeae
ipn/ipnlocal: fix a nil pointer dereference when serving /localapi/v0…
nickkhyl Aug 31, 2024
65fe0ba
wgengine/magicsock: fix panic regression from cryptokey routing change
bradfitz Aug 31, 2024
20cf48b
gokrazy{,/natlabapp.arm64}: start adding arm64 appliance support
bradfitz Sep 3, 2024
eb2fa16
tailcfg: bump capver for earlier cryptokey panic fix [capver 106]
bradfitz Sep 3, 2024
1c972bc
wgengine/magicsock: actually use AF_PACKET socket for raw disco
andrew-d Aug 13, 2024
8e1c00f
cmd/k8s-operator,k8s-operator/sessionrecording: ensure recording head…
irbekrm Sep 3, 2024
345876d
client/tailscale: adding missing proto field in ACL parsing structure…
swthorn Sep 3, 2024
e865a0e
cmd/tailscale/cli: add 'debug go-buildinfo' subcommand
bradfitz Jul 30, 2024
aeb15de
util/syspolicy/source: add package for reading policy settings from e…
nickkhyl Aug 13, 2024
c4d0237
tstest/natlab: add dual stack with blackholed IPv4
bradfitz Sep 3, 2024
6d6b177
cmd/stunstamp: implement ICMP{v6} probing (#13354)
jwhited Sep 4, 2024
1dd1798
cmd/stunstamp: use measureFn more consistently in naming/signatures (…
jwhited Sep 4, 2024
1fc4268
cmd/stunstamp: increase probe jitter (#13362)
jwhited Sep 4, 2024
0112da6
net/dns: support GetBaseConfig on Darwin OSS tailscaled (#13351)
agottardo Sep 4, 2024
5bc9faf
ipn/ipnlocal: always send auth URL notifications when a user requests…
nickkhyl Aug 30, 2024
d060b3f
cli: implement `tailscale dns status` (#13353)
agottardo Sep 4, 2024
11d205f
control/controlclient,posture,util/syspolicy: use predefined syspolic…
nickkhyl Sep 4, 2024
bcc47d9
cmd/tailscale/cli: use new Go 1.23 slices.Sorted
bradfitz Sep 4, 2024
fd6686d
tka: truncate long rotation signature chains
knyar Aug 19, 2024
3d401c1
all: use new Go 1.23 slices.Sorted more
bradfitz Sep 4, 2024
13dee9d
health: fix magicsockReceiveFuncWarnable health clearing
bradfitz Sep 4, 2024
7dcf65a
net/dns: fix IsZero and Equal methods on OSConfig
andrew-d Sep 5, 2024
7aa766e
net/tstun: probe TCP GRO (#13376)
jwhited Sep 5, 2024
4f2a2bf
go.mod.sri: update SRI hash for go.mod changes
Sep 5, 2024
e7a6e79
cmd/systray: handle reconnects to IPN bus (#13386)
awly Sep 5, 2024
e7b5e8c
ipn/ipnserver: remove IdleTimeout
nickkhyl Sep 5, 2024
95f0094
cmd/stunstamp: cleanup timeout and interval constants (#13393)
jwhited Sep 5, 2024
71ff3d7
go.mod: bump github.com/illarion/gonotify/v2
bradfitz Sep 6, 2024
7ce9c19
go.toolchain.rev: update to 1.23.1 (#13408)
patrickod Sep 6, 2024
2b0d0dd
sessionrecording,ssh/tailssh,k8s-operator: log connected recorder add…
irbekrm Sep 7, 2024
4dfde7b
net/dns: disable DNS registration for Tailscale interface on Windows
nickkhyl Sep 7, 2024
ecd64f6
cmd/k8s-operator,kube: set app name for Kubernetes Operator proxies (…
irbekrm Sep 8, 2024
d6dfb7f
kube,cmd/{k8s-operator,containerboot},envknob,ipn/store/kubestore,*/d…
irbekrm Sep 8, 2024
209567e
kube,cmd/{k8s-operator,containerboot},envknob,ipn/store/kubestore,*/d…
irbekrm Sep 8, 2024
0a2e5af
tsnet: remove old package doc experimental warning
bradfitz Sep 9, 2024
0970615
ipn/ipnlocal: don't program system DNS when node key is expired (#13370)
andrew-d Sep 9, 2024
a228d77
cmd/stunstamp: add protocol context to timeout logs (#13422)
jwhited Sep 10, 2024
71b550c
.github: Bump peter-evans/create-pull-request from 5.0.1 to 7.0.1 (#1…
dependabot[bot] Sep 10, 2024
436a078
build(deps): bump ws from 8.14.2 to 8.17.1 in /client/web (#12524)
dependabot[bot] Sep 10, 2024
7d16af8
cmd/natc: fix nil pointer
franbull Sep 10, 2024
9f9470f
ipnlocal,proxymap,wgengine/netstack: add optional WhoIs/proxymap debug
bradfitz Sep 10, 2024
98f4dd9
cmd/k8s-operator,k8s-operator,kube: Add TSRecorder CRD + controller (…
tomhjp Sep 11, 2024
4d6a822
util/linuxfw: fall back to nftables when iptables not found
Sep 11, 2024
f2713b6
.github: enable fuzz testing again (go1.23)
Sep 11, 2024
910462a
derp: unify server's clientSet interface into concrete type
bradfitz Sep 11, 2024
cec779e
util/slicesx: add FirstElementEqual and LastElementEqual
bradfitz Sep 11, 2024
2118d0c
VERSION.txt: this is v1.74.0
kari-ts Sep 12, 2024
2da2083
Merge branch 'release-branch/1.74' into cpierra/coreweave-1.74
ChandonPierre Sep 13, 2024
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ client/web/build/assets
/gocross
/dist

.DS_Store
# Ignore xcode userstate and workspace data
*.xcuserstate
*.xcworkspacedata
/tstest/tailmac/bin
/tstest/tailmac/build
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# $ docker exec tailscaled tailscale status


FROM golang:1.22-alpine AS build-env
FROM golang:1.23-alpine AS build-env

WORKDIR /go/src/tailscale

Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ sshintegrationtest: ## Run the SSH integration tests in various Docker container
echo "Testing on ubuntu:focal" && docker build --build-arg="BASE=ubuntu:focal" -t ssh-ubuntu-focal ssh/tailssh/testcontainers && \
echo "Testing on ubuntu:jammy" && docker build --build-arg="BASE=ubuntu:jammy" -t ssh-ubuntu-jammy ssh/tailssh/testcontainers && \
echo "Testing on ubuntu:mantic" && docker build --build-arg="BASE=ubuntu:mantic" -t ssh-ubuntu-mantic ssh/tailssh/testcontainers && \
echo "Testing on ubuntu:noble" && docker build --build-arg="BASE=ubuntu:noble" -t ssh-ubuntu-noble ssh/tailssh/testcontainers
echo "Testing on ubuntu:noble" && docker build --build-arg="BASE=ubuntu:noble" -t ssh-ubuntu-noble ssh/tailssh/testcontainers && \
echo "Testing on alpine:latest" && docker build --build-arg="BASE=alpine:latest" -t ssh-alpine-latest ssh/tailssh/testcontainers

help: ## Show this help
@echo "\nSpecify a command. The choices are:\n"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ not open source.

## Building

We always require the latest Go release, currently Go 1.22. (While we build
We always require the latest Go release, currently Go 1.23. (While we build
releases with our [Go fork](https://github.com/tailscale/go/), its use is not
required.)

Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.72.1
1.74.0
2 changes: 2 additions & 0 deletions client/tailscale/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
// Only one of Src/Dst or Users/Ports may be specified.
type ACLRow struct {
Action string `json:"action,omitempty"` // valid values: "accept"
Proto string `json:"proto,omitempty"` // protocol
Users []string `json:"users,omitempty"` // old name for src
Ports []string `json:"ports,omitempty"` // old name for dst
Src []string `json:"src,omitempty"`
Expand All @@ -31,6 +32,7 @@ type ACLRow struct {
type ACLTest struct {
Src string `json:"src,omitempty"` // source
User string `json:"user,omitempty"` // old name for source
Proto string `json:"proto,omitempty"` // protocol
Accept []string `json:"accept,omitempty"` // expected destination ip:port that user can access
Deny []string `json:"deny,omitempty"` // expected destination ip:port that user cannot access

Expand Down
8 changes: 8 additions & 0 deletions client/tailscale/apitype/apitype.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,11 @@ type ExitNodeSuggestionResponse struct {
Name string
Location tailcfg.LocationView `json:",omitempty"`
}

// DNSOSConfig mimics dns.OSConfig without forcing us to import the entire dns package
// into the CLI.
type DNSOSConfig struct {
Nameservers []string
SearchDomains []string
MatchDomains []string
}
18 changes: 18 additions & 0 deletions client/tailscale/localclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ func (lc *LocalClient) DaemonMetrics(ctx context.Context) ([]byte, error) {
return lc.get200(ctx, "/localapi/v0/metrics")
}

// UserMetrics returns the user metrics in
// the Prometheus text exposition format.
func (lc *LocalClient) UserMetrics(ctx context.Context) ([]byte, error) {
return lc.get200(ctx, "/localapi/v0/usermetrics")
}

// IncrementCounter increments the value of a Tailscale daemon's counter
// metric by the given delta. If the metric has yet to exist, a new counter
// metric is created and initialized to delta.
Expand Down Expand Up @@ -807,6 +813,18 @@ func (lc *LocalClient) EditPrefs(ctx context.Context, mp *ipn.MaskedPrefs) (*ipn
return decodeJSON[*ipn.Prefs](body)
}

func (lc *LocalClient) GetDNSOSConfig(ctx context.Context) (*apitype.DNSOSConfig, error) {
body, err := lc.get200(ctx, "/localapi/v0/dns-osconfig")
if err != nil {
return nil, err
}
var osCfg apitype.DNSOSConfig
if err := json.Unmarshal(body, &osCfg); err != nil {
return nil, fmt.Errorf("invalid dns.OSConfig: %w", err)
}
return &osCfg, nil
}

// StartLoginInteractive starts an interactive login.
func (lc *LocalClient) StartLoginInteractive(ctx context.Context) error {
_, err := lc.send(ctx, "POST", "/localapi/v0/login-interactive", http.StatusNoContent, nil)
Expand Down
4 changes: 2 additions & 2 deletions client/tailscale/required_version.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause

//go:build !go1.21
//go:build !go1.23

package tailscale

func init() {
you_need_Go_1_21_to_compile_Tailscale()
you_need_Go_1_23_to_compile_Tailscale()
}
6 changes: 6 additions & 0 deletions client/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ func (s *Server) serve(w http.ResponseWriter, r *http.Request) {
}
}

if r.URL.Path == "/metrics" {
r.URL.Path = "/api/local/v0/usermetrics"
s.proxyRequestToLocalAPI(w, r)
return
}

if strings.HasPrefix(r.URL.Path, "/api/") {
switch {
case r.URL.Path == "/api/auth" && r.Method == httpm.GET:
Expand Down
6 changes: 3 additions & 3 deletions client/web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5382,9 +5382,9 @@ wrappy@1:
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==

ws@^8.14.2:
version "8.14.2"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f"
integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==
version "8.17.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b"
integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==

xml-name-validator@^5.0.0:
version "5.0.0"
Expand Down
6 changes: 3 additions & 3 deletions cmd/cloner/cloner.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func main() {
it := codegen.NewImportTracker(pkg.Types)
buf := new(bytes.Buffer)
for _, typeName := range typeNames {
typ, ok := namedTypes[typeName]
typ, ok := namedTypes[typeName].(*types.Named)
if !ok {
log.Fatalf("could not find type %s", typeName)
}
Expand Down Expand Up @@ -115,7 +115,7 @@ func gen(buf *bytes.Buffer, it *codegen.ImportTracker, typ *types.Named) {
if !codegen.ContainsPointers(ft) || codegen.HasNoClone(t.Tag(i)) {
continue
}
if named, _ := ft.(*types.Named); named != nil {
if named, _ := codegen.NamedTypeOf(ft); named != nil {
if codegen.IsViewType(ft) {
writef("dst.%s = src.%s", fname, fname)
continue
Expand Down Expand Up @@ -161,7 +161,7 @@ func gen(buf *bytes.Buffer, it *codegen.ImportTracker, typ *types.Named) {
case *types.Pointer:
base := ft.Elem()
hasPtrs := codegen.ContainsPointers(base)
if named, _ := base.(*types.Named); named != nil && hasPtrs {
if named, _ := codegen.NamedTypeOf(base); named != nil && hasPtrs {
writef("dst.%s = src.%s.Clone()", fname, fname)
continue
}
Expand Down
21 changes: 11 additions & 10 deletions cmd/containerboot/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ import (
"net/netip"
"os"

"tailscale.com/kube"
"tailscale.com/kube/kubeapi"
"tailscale.com/kube/kubeclient"
"tailscale.com/tailcfg"
)

// storeDeviceID writes deviceID to 'device_id' data field of the named
// Kubernetes Secret.
func storeDeviceID(ctx context.Context, secretName string, deviceID tailcfg.StableNodeID) error {
s := &kube.Secret{
s := &kubeapi.Secret{
Data: map[string][]byte{
"device_id": []byte(deviceID),
},
Expand All @@ -42,7 +43,7 @@ func storeDeviceEndpoints(ctx context.Context, secretName string, fqdn string, a
return err
}

s := &kube.Secret{
s := &kubeapi.Secret{
Data: map[string][]byte{
"device_fqdn": []byte(fqdn),
"device_ips": deviceIPs,
Expand All @@ -55,14 +56,14 @@ func storeDeviceEndpoints(ctx context.Context, secretName string, fqdn string, a
// secret. No-op if there is no authkey in the secret.
func deleteAuthKey(ctx context.Context, secretName string) error {
// m is a JSON Patch data structure, see https://jsonpatch.com/ or RFC 6902.
m := []kube.JSONPatch{
m := []kubeclient.JSONPatch{
{
Op: "remove",
Path: "/data/authkey",
},
}
if err := kc.JSONPatchSecret(ctx, secretName, m); err != nil {
if s, ok := err.(*kube.Status); ok && s.Code == http.StatusUnprocessableEntity {
if s, ok := err.(*kubeapi.Status); ok && s.Code == http.StatusUnprocessableEntity {
// This is kubernetes-ese for "the field you asked to
// delete already doesn't exist", aka no-op.
return nil
Expand All @@ -72,7 +73,7 @@ func deleteAuthKey(ctx context.Context, secretName string) error {
return nil
}

var kc kube.Client
var kc kubeclient.Client

// setupKube is responsible for doing any necessary configuration and checks to
// ensure that tailscale state storage and authentication mechanism will work on
Expand All @@ -88,12 +89,12 @@ func (cfg *settings) setupKube(ctx context.Context) error {
cfg.KubernetesCanPatch = canPatch

s, err := kc.GetSecret(ctx, cfg.KubeSecret)
if err != nil && kube.IsNotFoundErr(err) && !canCreate {
if err != nil && kubeclient.IsNotFoundErr(err) && !canCreate {
return fmt.Errorf("Tailscale state Secret %s does not exist and we don't have permissions to create it. "+
"If you intend to store tailscale state elsewhere than a Kubernetes Secret, "+
"you can explicitly set TS_KUBE_SECRET env var to an empty string. "+
"Else ensure that RBAC is set up that allows the service account associated with this installation to create Secrets.", cfg.KubeSecret)
} else if err != nil && !kube.IsNotFoundErr(err) {
} else if err != nil && !kubeclient.IsNotFoundErr(err) {
return fmt.Errorf("Getting Tailscale state Secret %s: %v", cfg.KubeSecret, err)
}

Expand Down Expand Up @@ -128,10 +129,10 @@ func initKubeClient(root string) {
if root != "/" {
// If we are running in a test, we need to set the root path to the fake
// service account directory.
kube.SetRootPathForTesting(root)
kubeclient.SetRootPathForTesting(root)
}
var err error
kc, err = kube.New()
kc, err = kubeclient.New()
if err != nil {
log.Fatalf("Error creating kube client: %v", err)
}
Expand Down
Loading