@@ -101,30 +101,7 @@ func setModelStateUpdates(req infer.UpdateRequest[VertexModelDeploymentArgs, Ver
101101 // ImageUri is immutable, requires replacement.
102102 // See: https://cloud.google.com/vertex-ai/docs/reference/rest/v1/ModelContainerSpec
103103
104- if updatedModel .ContainerSpec .PredictRoute != "" {
105- updatedState .PredictRoute = updatedModel .ContainerSpec .PredictRoute
106- }
107- if updatedModel .ContainerSpec .HealthRoute != "" {
108- updatedState .HealthRoute = updatedModel .ContainerSpec .HealthRoute
109- }
110-
111- // Update container args
112- if len (updatedModel .ContainerSpec .Args ) > 0 {
113- updatedState .Args = updatedModel .ContainerSpec .Args
114- }
115-
116- // Update environment variables
117- if len (updatedModel .ContainerSpec .Env ) > 0 {
118- updatedState .EnvVars = make (map [string ]string )
119- for _ , env := range updatedModel .ContainerSpec .Env {
120- updatedState .EnvVars [env .Name ] = env .Value
121- }
122- }
123-
124- // Update port
125- if len (updatedModel .ContainerSpec .Ports ) > 0 {
126- updatedState .Port = updatedModel .ContainerSpec .Ports [0 ].ContainerPort
127- }
104+ setContainerSpecStateUpdates (updatedModel , updatedState )
128105 }
129106
130107 // Update predict schemata fields if available
@@ -143,6 +120,33 @@ func setModelStateUpdates(req infer.UpdateRequest[VertexModelDeploymentArgs, Ver
143120 return updatedState
144121}
145122
123+ func setContainerSpecStateUpdates (updatedModel * aiplatformpb.Model , updatedState VertexModelDeploymentState ) {
124+ if updatedModel .ContainerSpec .PredictRoute != "" {
125+ updatedState .PredictRoute = updatedModel .ContainerSpec .PredictRoute
126+ }
127+ if updatedModel .ContainerSpec .HealthRoute != "" {
128+ updatedState .HealthRoute = updatedModel .ContainerSpec .HealthRoute
129+ }
130+
131+ // Update container args
132+ if len (updatedModel .ContainerSpec .Args ) > 0 {
133+ updatedState .Args = updatedModel .ContainerSpec .Args
134+ }
135+
136+ // Update environment variables
137+ if len (updatedModel .ContainerSpec .Env ) > 0 {
138+ updatedState .EnvVars = make (map [string ]string )
139+ for _ , env := range updatedModel .ContainerSpec .Env {
140+ updatedState .EnvVars [env .Name ] = env .Value
141+ }
142+ }
143+
144+ // Update port
145+ if len (updatedModel .ContainerSpec .Ports ) > 0 {
146+ updatedState .Port = updatedModel .ContainerSpec .Ports [0 ].ContainerPort
147+ }
148+ }
149+
146150func collectUpdates (req infer.UpdateRequest [VertexModelDeploymentArgs , VertexModelDeploymentState ]) (bool , []string ) {
147151 needsUpdate := false
148152 updatePathsMap := make (map [string ]bool )
0 commit comments