feat: add bare policy binding controller
CI / image check (pull_request) Successful in 58s
CI / install-dependencies (pull_request) Successful in 7m20s
CI / check format (pull_request) Successful in 25s
CI / test (pull_request) Successful in 25s
CI / build check (pull_request) Successful in 1m39s
CI / check lint (pull_request) Successful in 12m48s

This commit is contained in:
2026-05-17 19:38:29 +02:00
parent dedee24389
commit 4367bc78bc
30 changed files with 1822 additions and 1 deletions
+16 -1
View File
@@ -34,6 +34,7 @@ import (
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
applicationcontroller "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/controllers/application"
policybindingcontroller "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/controllers/policybinding"
proxyprovidercontroller "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/controllers/proxyprovider"
clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned"
informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions"
@@ -87,13 +88,19 @@ func main() {
applicationInformerFactory.Application().V1alpha1().Applications(),
)
policyBindingInformerFactory := informers.NewSharedInformerFactory(clientset, time.Second*30)
pbController := policybindingcontroller.NewController(ctx, kubeClient, clientset, authentikClient,
policyBindingInformerFactory.PolicyBinding().V1alpha1().PolicyBindings(),
)
// notice that there is no need to run Start methods in a separate goroutine. (i.e. go kubeInformerFactory.Start(ctx.done())
// Start method is non-blocking and runs all registered informers in a dedicated goroutine.
proxyProviderInformerFactory.Start(ctx.Done())
applicationInformerFactory.Start(ctx.Done())
policyBindingInformerFactory.Start(ctx.Done())
var wg sync.WaitGroup
wg.Add(2)
wg.Add(3)
go func() {
defer wg.Done()
@@ -111,6 +118,14 @@ func main() {
}
}()
go func() {
defer wg.Done()
if err := pbController.Run(ctx, 2); err != nil {
logger.Error(err, "Error running policy binding controller")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
}
}()
wg.Wait()
}