-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Replicas field to DeploymentParams struct #129
Conversation
pkg/devfile/generator/generators.go
Outdated
@@ -158,6 +159,7 @@ type DeploymentParams struct { | |||
Containers []corev1.Container | |||
Volumes []corev1.Volume | |||
PodSelectorLabels map[string]string | |||
Replicas int32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would set the Replicas as a pointer, to make it optional (the nil value indicating the user does not want to set it). The 0 value on which you test below is a valid value a user would want to set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Does 145564e look good?
pkg/devfile/generator/generators.go
Outdated
@@ -187,6 +187,10 @@ func GetDeployment(devfileObj parser.DevfileObj, deployParams DeploymentParams) | |||
Spec: *getDeploymentSpec(deploySpecParams), | |||
} | |||
|
|||
if deployParams.Replicas != nil { | |||
deployment.Spec.Replicas = deployParams.Replicas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this affectation should be done in getDeploymentSpec which is the dedicated function for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. That's where I first looked. But that would mean changing the signature of getDeploymentSpec
. I was not sure if that would be OK. But it's an internal function, so changing signature shouldn't be a big deal.
Pushed 4a544b1. PTAL.
the changes look good, just need to pass the ci, and I will add the label |
/approve |
@yangcao77 do I need to make any changes to the PR? Would |
@dharmit yes, please run |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dharmit, yangcao77 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What does this PR do?:
Adds
Replicas
field toDeploymentParams
struct. This will help initialize a Deployment with Replica set to what the tooling would like to have. By default, library doesn't set it to anything at the moment.Which issue(s) this PR fixes:
redhat-developer/odo#5347
PR acceptance criteria:
Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.
Unit/Functional tests
QE Integration test
Documentation
Client Impact
How to test changes / Special notes to the reviewer: