@@ -44,8 +44,6 @@ import (
4444 "github.com/NVIDIA/k8s-nim-operator/internal/conditions"
4545 "github.com/NVIDIA/k8s-nim-operator/internal/controller"
4646 "github.com/NVIDIA/k8s-nim-operator/internal/controller/platform"
47- "github.com/NVIDIA/k8s-nim-operator/internal/controller/platform/kserve"
48- "github.com/NVIDIA/k8s-nim-operator/internal/controller/platform/standalone"
4947 "github.com/NVIDIA/k8s-nim-operator/internal/render"
5048 // +kubebuilder:scaffold:imports
5149)
@@ -72,8 +70,9 @@ func main() {
7270 var enableHTTP2 bool
7371 var platformType string
7472
75- flag .StringVar (& platformType , "platform" , "standalone" , "The model-serving inference platform to use." +
76- "E.g., 'standalone (default)', 'kserve'." )
73+ flag .StringVar (& platformType , "platform" , "" , "DEPRECATED: Default platform for all NIMServices. " +
74+ "Use the 'platform' field in NIMService CR instead. If specified, this value is used as fallback " +
75+ "when NIMService doesn't specify a platform. Valid values: 'standalone', 'kserve'." )
7776 flag .StringVar (& metricsAddr , "metrics-bind-address" , "0" , "The address the metric endpoint binds to. " +
7877 "Use the port :8080. If not set, it will be 0 in order to disable the metrics server" )
7978 flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081" , "The address the probe endpoint binds to." )
@@ -92,17 +91,21 @@ func main() {
9291
9392 ctrl .SetLogger (zap .New (zap .UseFlagOptions (& opts )))
9493
95- var platformImpl platform.Platform
96- switch platformType {
97- case "standalone" :
98- platformImpl = & standalone.Standalone {}
99- case "kserve" :
100- platformImpl = & kserve.KServe {}
101- default :
102- setupLog .Error (nil , "unsupported model-serving platform type" , "platformType" , platformType )
103- os .Exit (1 )
94+ // Validate the deprecated global platform flag if provided
95+ if platformType != "" {
96+ setupLog .Info ("DEPRECATED: Global platform flag is deprecated. Use 'platform' field in NIMService CR instead." , "platform" , platformType )
97+ switch platformType {
98+ case "standalone" , "kserve" :
99+ // Valid platform types
100+ default :
101+ setupLog .Error (nil , "unsupported model-serving platform type" , "platformType" , platformType )
102+ os .Exit (1 )
103+ }
104104 }
105105
106+ // Create platform factory
107+ platformFactory := platform .NewFactory ()
108+
106109 // if the enable-http2 flag is false (the default), http/2 should be disabled
107110 // due to its vulnerabilities. More specifically, disabling http/2 will
108111 // prevent from being vulnerable to the HTTP/2 Stream Cancellation and
@@ -164,7 +167,6 @@ func main() {
164167 mgr .GetClient (),
165168 mgr .GetScheme (),
166169 ctrl .Log .WithName ("controllers" ).WithName ("NIMCache" ),
167- platformImpl ,
168170 ).SetupWithManager (mgr ); err != nil {
169171 setupLog .Error (err , "unable to create controller" , "controller" , "NIMCache" )
170172 os .Exit (1 )
@@ -177,7 +179,7 @@ func main() {
177179 discoveryClient ,
178180 render .NewRenderer ("/manifests" ),
179181 ctrl .Log .WithName ("controllers" ).WithName ("NIMService" ),
180- platformImpl ,
182+ platformFactory ,
181183 ).SetupWithManager (mgr ); err != nil {
182184 setupLog .Error (err , "unable to create controller" , "controller" , "NIMService" )
183185 os .Exit (1 )
@@ -195,7 +197,6 @@ func main() {
195197 mgr .GetClient (),
196198 mgr .GetScheme (),
197199 ctrl .Log .WithName ("controllers" ).WithName ("NIMBuild" ),
198- platformImpl ,
199200 ).SetupWithManager (mgr ); err != nil {
200201 setupLog .Error (err , "unable to create controller" , "controller" , "NIMBuild" )
201202 os .Exit (1 )
0 commit comments