Add network router and resource (#189)

This change adds two new resources, NetworkRouter and NetworkResource,
which enable clusters to expose Kubernetes services to Netbird.

The NetworkRouter is responsible for creating the network, group, setup
key and routing peer all of which are unique to the isntance. Along with
the deployment of the client in the cluster.

The NetworkResource exposes a service by linking to the specific router
it wants to expose to. This makes coupling between the resource and
network easy to understand.

Routers also set a DNS zone which is used to give names to resources
based on the name and namespace of the service being exposed.

Part of #172

Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
Philip Laine
2026-04-23 08:55:49 +02:00
committed by GitHub
parent af11e31b28
commit 6768a76c9c
38 changed files with 2973 additions and 55 deletions
+1 -1
View File
@@ -2,6 +2,6 @@ apiVersion: netbird.io/v1alpha1
kind: Group
metadata:
name: test
namespace: default
namespace: netbird
spec:
name: test
+55
View File
@@ -0,0 +1,55 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: default
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
---
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: default
labels:
app: nginx
spec:
type: ClusterIP
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
---
apiVersion: netbird.io/v1alpha1
kind: NetworkResource
metadata:
name: test
namespace: default
spec:
networkRouterRef:
name: test
namespace: netbird
serviceRef:
name: nginx
+8
View File
@@ -0,0 +1,8 @@
apiVersion: netbird.io/v1alpha1
kind: NetworkRouter
metadata:
name: test
namespace: netbird
spec:
dnsZoneRef:
name: cluster.local
+2 -2
View File
@@ -2,6 +2,6 @@ apiVersion: netbird.io/v1alpha1
kind: SetupKey
metadata:
name: test
namespace: default
namespace: netbird
spec:
ephemeral: true
name: test