Skip to content

Commit

Permalink
Move Replica check to getDeploymentSpec function
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmit committed Jan 25, 2022
1 parent 145564e commit 4a544b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 1 addition & 5 deletions pkg/devfile/generator/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,7 @@ func GetDeployment(devfileObj parser.DevfileObj, deployParams DeploymentParams)
deployment := &appsv1.Deployment{
TypeMeta: deployParams.TypeMeta,
ObjectMeta: deployParams.ObjectMeta,
Spec: *getDeploymentSpec(deploySpecParams),
}

if deployParams.Replicas != nil {
deployment.Spec.Replicas = deployParams.Replicas
Spec: *getDeploymentSpec(deploySpecParams, deployParams),
}

return deployment, nil
Expand Down
6 changes: 5 additions & 1 deletion pkg/devfile/generator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ type deploymentSpecParams struct {
}

// getDeploymentSpec gets a deployment spec
func getDeploymentSpec(deploySpecParams deploymentSpecParams) *appsv1.DeploymentSpec {
func getDeploymentSpec(deploySpecParams deploymentSpecParams, deployParams DeploymentParams) *appsv1.DeploymentSpec {
deploymentSpec := &appsv1.DeploymentSpec{
Strategy: appsv1.DeploymentStrategy{
Type: appsv1.RecreateDeploymentStrategyType,
Expand All @@ -247,6 +247,10 @@ func getDeploymentSpec(deploySpecParams deploymentSpecParams) *appsv1.Deployment
Template: deploySpecParams.PodTemplateSpec,
}

if deployParams.Replicas != nil {
deploymentSpec.Replicas = deployParams.Replicas
}

return deploymentSpec
}

Expand Down

0 comments on commit 4a544b1

Please sign in to comment.