@@ -63,10 +63,14 @@ func main() {
6363 var enableLeaderElection bool
6464 var probeAddr string
6565 var namespace string
66+ var enableServerless bool
67+ var podIP string
6668
6769 flag .StringVar (& metricsAddr , "metrics-bind-address" , ":8080" , "The address the metric endpoint binds to." )
6870 flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081" , "The address the probe endpoint binds to." )
6971 flag .StringVar (& namespace , "namespace" , "llmaz-system" , "The namespace of the llmaz to deploy" )
72+ flag .BoolVar (& enableServerless , "enable-serverless" , false , "Enable the serverless feature" )
73+ flag .StringVar (& podIP , "pod-ip" , "" , "The pod IP of the llmaz controller manager" )
7074 flag .BoolVar (& enableLeaderElection , "leader-elect" , false ,
7175 "Enable leader election for controller manager. " +
7276 "Enabling this will ensure there is only one active controller manager." )
@@ -120,7 +124,7 @@ func main() {
120124 // Cert won't be ready until manager starts, so start a goroutine here which
121125 // will block until the cert is ready before setting up the controllers.
122126 // Controllers who register after manager starts will start directly.
123- go setupControllers (mgr , certsReady )
127+ go setupControllers (mgr , certsReady , enableServerless , podIP )
124128
125129 //+kubebuilder:scaffold:builder
126130
@@ -140,7 +144,7 @@ func main() {
140144 }
141145}
142146
143- func setupControllers (mgr ctrl.Manager , certsReady chan struct {}) {
147+ func setupControllers (mgr ctrl.Manager , certsReady chan struct {}, enableServerless bool , podIP string ) {
144148 // The controllers won't work until the webhooks are operating,
145149 // and the webhook won't work until the certs are all in places.
146150 setupLog .Info ("waiting for the cert generation to complete" )
@@ -176,6 +180,21 @@ func setupControllers(mgr ctrl.Manager, certsReady chan struct{}) {
176180 os .Exit (1 )
177181 }
178182
183+
184+ if enableServerless {
185+ dynamicClient , err := dynamic .NewForConfig (mgr .GetConfig ())
186+ if err != nil {
187+ setupLog .Error (err , "unable to create dynamic client" )
188+ os .Exit (1 )
189+ }
190+
191+ activatorReconciler := inferencecontroller .NewActivatorReconciler (mgr , dynamicClient , podIP )
192+ if err := activatorReconciler .SetupWithManager (mgr ); err != nil {
193+ setupLog .Error (err , "unable to create controller" , "controller" , "Activator" )
194+ os .Exit (1 )
195+ }
196+ }
197+
179198 if os .Getenv ("ENABLE_WEBHOOKS" ) != "false" {
180199 if err := webhook .SetupOpenModelWebhook (mgr ); err != nil {
181200 setupLog .Error (err , "unable to create webhook" , "webhook" , "Model" )
0 commit comments