Skip to content

Commit 31bc8c8

Browse files
batleforcfrezbo
authored andcommitted
feat(netbird): go further in making it work
Fixup netbird extension. Signed-off-by: Max Batleforc <[email protected]> Signed-off-by: Noel Georgi <[email protected]>
1 parent 25c20c9 commit 31bc8c8

File tree

5 files changed

+86
-3
lines changed

5 files changed

+86
-3
lines changed

network/netbird/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Tailscale
1+
# Netbird
22

33
Adds https://netbird.io network interfaces as system extensions.
44
This means you can access your talos nodes from machines you have configured
@@ -21,6 +21,19 @@ environment:
2121
- NB_SETUP_KEYS=<peer setup key>
2222
```
2323
24+
or if you are selfhosting it with something like :
25+
26+
```yaml
27+
---
28+
apiVersion: v1alpha1
29+
kind: ExtensionServiceConfig
30+
name: netbird
31+
environment:
32+
- NB_SETUP_KEYS=<peer setup key>
33+
- NB_MANAGEMENT_URL=https://netbird.selfhosted:443
34+
- NB_ADMIN_URL=https://netbird.selfhosted:443
35+
```
36+
2437
Then apply the patch to your node's MachineConfigs
2538
```bash
2639
talosctl patch mc -p @netbird-config.yaml

network/netbird/netbird.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ depends:
99
- configuration: true
1010
container:
1111
entrypoint: /usr/local/bin/netbird
12+
args:
13+
- "up"
14+
- "--foreground-mode"
15+
environment:
16+
- NB_DAEMON_ADDR=unix:///var/run/netbird/netbird.sock
17+
- NB_LOG_FILE=console,/var/log/netbird/client.log
18+
- NB_DISABLE_PROFILES=true
19+
- USER=talos
20+
- NB_CONFIG=/var/run/netbird/config.json
21+
- HOME=/var/run/netbird
22+
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
1223
security:
1324
writeableRootfs: false
1425
writeableSysfs: true
@@ -31,4 +42,22 @@ container:
3142
options:
3243
- bind
3344
- rw
45+
- source: /var/run/netbird
46+
destination: /var/run/netbird
47+
type: bind
48+
options:
49+
- bind
50+
- rw
51+
- source: /etc/ssl/certs
52+
destination: /etc/ssl/certs
53+
type: bind
54+
options:
55+
- rbind
56+
- ro
57+
- source: /etc/os-release
58+
destination: /etc/os-release
59+
type: bind
60+
options:
61+
- bind
62+
- ro
3463
restart: always

network/netbird/pkg.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@ steps:
2121
tar -xzvf netbird.tar.gz
2222
- |
2323
cd netbird-{{ .NETBIRD_VERSION }}
24-
sed -i 's/development/{{ .NETBIRD_VERSION }}/' version/version.go
24+
sed -i 's/development/{{ .NETBIRD_VERSION }}/' version/version.go
2525
cd client
26-
go mod download
26+
go mod download
2727
- network: none
2828
build:
2929
- |
3030
cd netbird-{{ .NETBIRD_VERSION }}
3131
go build -o netbird ./client
32+
cd /pkg/src
33+
go build -o ./uname .
3234
install:
3335
- |
3436
cd netbird-{{ .NETBIRD_VERSION }}
3537
mkdir -p /rootfs/usr/local/lib/containers/netbird/usr/local/bin/
3638
cp -p netbird /rootfs/usr/local/lib/containers/netbird/usr/local/bin/
39+
cp -p /pkg/src/uname /rootfs/usr/local/lib/containers/netbird/usr/local/bin/
3740
chmod +x -R /rootfs/usr/local/lib/containers/netbird/usr/local/bin/
3841
- |
3942
mkdir -p /rootfs/usr/local/etc/containers

network/netbird/src/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/siderolabs/extensions/uname
2+
3+
go 1.25.1

network/netbird/src/main.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// This Source Code Form is subject to the terms of the Mozilla Public
2+
// License, v. 2.0. If a copy of the MPL was not distributed with this
3+
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
package main
6+
7+
import (
8+
"fmt"
9+
"syscall"
10+
)
11+
12+
func utsFieldToString(field [65]int8) string {
13+
b := make([]byte, 0, len(field))
14+
for _, c := range field {
15+
if c == 0 {
16+
break
17+
}
18+
b = append(b, byte(c))
19+
}
20+
return string(b)
21+
}
22+
23+
func main() {
24+
var uts syscall.Utsname
25+
if err := syscall.Uname(&uts); err != nil {
26+
fmt.Println("Error:", err)
27+
return
28+
}
29+
fmt.Printf("%s %s %s %s\n",
30+
utsFieldToString(uts.Sysname),
31+
utsFieldToString(uts.Release),
32+
utsFieldToString(uts.Version),
33+
utsFieldToString(uts.Machine),
34+
)
35+
}

0 commit comments

Comments
 (0)