@@ -193,7 +193,10 @@ type DeploymentParams struct {
193
193
// GetDeployment gets a deployment object
194
194
func GetDeployment (devfileObj parser.DevfileObj , deployParams DeploymentParams ) (* appsv1.Deployment , error ) {
195
195
196
- var deploySpecParams deploymentSpecParams
196
+ deploySpecParams := deploymentSpecParams {
197
+ PodSelectorLabels : deployParams .PodSelectorLabels ,
198
+ Replicas : deployParams .Replicas ,
199
+ }
197
200
if deployParams .PodTemplateSpec == nil {
198
201
// Deprecated
199
202
podTemplateSpecParams := podTemplateSpecParams {
@@ -206,23 +209,15 @@ func GetDeployment(devfileObj parser.DevfileObj, deployParams DeploymentParams)
206
209
if err != nil {
207
210
return nil , err
208
211
}
209
- deploySpecParams = deploymentSpecParams {
210
- PodTemplateSpec : * podTemplateSpec ,
211
- PodSelectorLabels : deployParams .PodSelectorLabels ,
212
- Replicas : deployParams .Replicas ,
213
- }
212
+ deploySpecParams .PodTemplateSpec = * podTemplateSpec
214
213
} else {
215
214
if len (deployParams .InitContainers ) > 0 ||
216
215
len (deployParams .Containers ) > 0 ||
217
216
len (deployParams .Volumes ) > 0 {
218
217
return nil , errors .New ("InitContainers, Containers and Volumes cannot be set when PodTemplateSpec is set in parameters" )
219
218
}
220
219
221
- deploySpecParams = deploymentSpecParams {
222
- PodTemplateSpec : * deployParams .PodTemplateSpec ,
223
- PodSelectorLabels : deployParams .PodSelectorLabels ,
224
- Replicas : deployParams .Replicas ,
225
- }
220
+ deploySpecParams .PodTemplateSpec = * deployParams .PodTemplateSpec
226
221
}
227
222
228
223
containerAnnotations , err := getContainerAnnotations (devfileObj , common.DevfileOptions {})
0 commit comments