@@ -26,14 +26,13 @@ import (
2626 // to ensure that exec-entrypoint and run can make use of them.
2727 _ "k8s.io/client-go/plugin/pkg/client/auth"
2828
29- tensorfusionaiv1 "github.com/NexusGPU/tensor-fusion-operator/api/v1"
29+ tfv1 "github.com/NexusGPU/tensor-fusion-operator/api/v1"
3030 "github.com/NexusGPU/tensor-fusion-operator/internal/config"
3131 "github.com/NexusGPU/tensor-fusion-operator/internal/controller"
3232 "github.com/NexusGPU/tensor-fusion-operator/internal/scheduler"
3333 "github.com/NexusGPU/tensor-fusion-operator/internal/server"
3434 "github.com/NexusGPU/tensor-fusion-operator/internal/server/router"
3535 webhookcorev1 "github.com/NexusGPU/tensor-fusion-operator/internal/webhook/v1"
36- "github.com/NexusGPU/tensor-fusion-operator/internal/worker"
3736 "k8s.io/apimachinery/pkg/runtime"
3837 utilruntime "k8s.io/apimachinery/pkg/util/runtime"
3938 clientgoscheme "k8s.io/client-go/kubernetes/scheme"
5554func init () {
5655 utilruntime .Must (clientgoscheme .AddToScheme (scheme ))
5756
58- utilruntime .Must (tensorfusionaiv1 .AddToScheme (scheme ))
57+ utilruntime .Must (tfv1 .AddToScheme (scheme ))
5958 // +kubebuilder:scaffold:scheme
6059}
6160
@@ -65,10 +64,8 @@ func main() {
6564 var probeAddr string
6665 var secureMetrics bool
6766 var enableHTTP2 bool
68- var configFile string
6967 var tlsOpts []func (* tls.Config )
7068
71- flag .StringVar (& configFile , "config" , "/etc/tensor-fusion/config.yaml" , "Config file of tensor-fusion-operator" )
7269 flag .StringVar (& metricsAddr , "metrics-bind-address" , "0" , "The address the metrics endpoint binds to. " +
7370 "Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service." )
7471 flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081" , "The address the probe endpoint binds to." )
@@ -154,21 +151,14 @@ func main() {
154151 }
155152
156153 ctx := context .Background ()
157- config , err := config .LoadConfig (configFile )
158- if os .IsNotExist (err ) {
159- setupLog .Info ("config file is not exists, use default config" , "configFile" , configFile )
160- } else if err != nil {
161- setupLog .Error (err , "unable to load config" , "configFile" , configFile , "err" , err )
162- os .Exit (1 )
163- }
154+ gpuPoolState := config .NewGpuPoolStateImpl ()
155+
164156 scheduler := scheduler .NewNaiveScheduler ()
165157 if err = (& controller.TensorFusionConnectionReconciler {
166- Client : mgr .GetClient (),
167- Scheme : mgr .GetScheme (),
168- Scheduler : scheduler ,
169- WorkerGenerator : & worker.WorkerGenerator {
170- WorkerConfig : & config .Worker ,
171- },
158+ Client : mgr .GetClient (),
159+ Scheme : mgr .GetScheme (),
160+ Scheduler : scheduler ,
161+ GpuPoolState : gpuPoolState ,
172162 }).SetupWithManager (mgr ); err != nil {
173163 setupLog .Error (err , "unable to create controller" , "controller" , "TensorFusionConnection" )
174164 os .Exit (1 )
@@ -185,7 +175,7 @@ func main() {
185175
186176 // nolint:goconst
187177 if os .Getenv ("ENABLE_WEBHOOKS" ) != "false" {
188- if err = webhookcorev1 .SetupPodWebhookWithManager (mgr , & config . PodMutation ); err != nil {
178+ if err = webhookcorev1 .SetupPodWebhookWithManager (mgr , gpuPoolState ); err != nil {
189179 setupLog .Error (err , "unable to create webhook" , "webhook" , "Pod" )
190180 os .Exit (1 )
191181 }
@@ -199,8 +189,9 @@ func main() {
199189 os .Exit (1 )
200190 }
201191 if err = (& controller.GPUPoolReconciler {
202- Client : mgr .GetClient (),
203- Scheme : mgr .GetScheme (),
192+ Client : mgr .GetClient (),
193+ Scheme : mgr .GetScheme (),
194+ GpuPoolState : gpuPoolState ,
204195 }).SetupWithManager (mgr ); err != nil {
205196 setupLog .Error (err , "unable to create controller" , "controller" , "GPUPool" )
206197 os .Exit (1 )
0 commit comments