Gateway API support (#117)

This change adds support for the new proxy service to the operator
through Gateway API. This change attempts to standardize concepts around
the Gateway API to allow for compatibility with other projects.

Fixes #111
Fixes #44

Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
Philip Laine
2026-03-19 13:01:58 +01:00
committed by GitHub
parent ccf819d2ff
commit 7acd175882
11 changed files with 769 additions and 69 deletions
+23
View File
@@ -40,6 +40,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
netbirdiov1 "github.com/netbirdio/kubernetes-operator/api/v1"
"github.com/netbirdio/kubernetes-operator/internal/controller"
@@ -57,6 +58,7 @@ func init() {
utilruntime.Must(netbirdiov1.AddToScheme(scheme))
utilruntime.Must(corev1.AddToScheme(scheme))
utilruntime.Must(gatewayv1.Install(scheme))
// +kubebuilder:scaffold:scheme
}
@@ -274,6 +276,27 @@ func main() {
os.Exit(1)
}
}
if err = (&controller.GatewayClassReconciler{
Client: mgr.GetClient(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "GatewayClass")
os.Exit(1)
}
if err = (&controller.GatewayReconciler{
Client: mgr.GetClient(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Gateway")
os.Exit(1)
}
if err = (&controller.HTTPRouteReconciler{
Client: mgr.GetClient(),
Netbird: netbird,
ClusterDNS: clusterDNS,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "HTTPRoute")
os.Exit(1)
}
} else {
setupLog.Info("netbird API key not provided, ingress capabilities disabled")
}