Skip to content

Commit

Permalink
[kueue] Setup provision admission check controller
Browse files Browse the repository at this point in the history
  • Loading branch information
trasc committed Oct 5, 2023
1 parent b456647 commit 11e8246
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cmd/kueue/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
"sigs.k8s.io/kueue/pkg/cache"
"sigs.k8s.io/kueue/pkg/config"
"sigs.k8s.io/kueue/pkg/constants"
"sigs.k8s.io/kueue/pkg/controller/admissionchecks/provisioning"
"sigs.k8s.io/kueue/pkg/controller/core"
"sigs.k8s.io/kueue/pkg/controller/core/indexer"
"sigs.k8s.io/kueue/pkg/controller/jobframework"
Expand Down Expand Up @@ -87,6 +88,9 @@ func init() {
return nil
}),
)

utilruntime.Must(provisioning.AddToScheme(scheme))

// +kubebuilder:scaffold:scheme
}

Expand Down Expand Up @@ -163,6 +167,22 @@ func main() {
// Controllers who register after manager starts will start directly.
go setupControllers(mgr, cCache, queues, certsReady, &cfg, serverVersionFetcher)

// setup provision controller
go func() {
if !provisioning.ManagerSupportsProvisioning(mgr) {
setupLog.Info("Provisioning Requests are not supported, skip admission check controller")
return
}
if err := provisioning.SetupIndexer(ctx, mgr.GetFieldIndexer()); err != nil {
setupLog.Error(err, "Could not setup provisioning indexer")
os.Exit(1)
}
if err := provisioning.NewController(mgr.GetClient()).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "Could not setup provisioning controller")
os.Exit(1)
}
}()

go func() {
queues.CleanUpOnContext(ctx)
}()
Expand Down

0 comments on commit 11e8246

Please sign in to comment.