-
Notifications
You must be signed in to change notification settings - Fork 867
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
feat: Add name attribute to ServicePort #2572
Conversation
Signed-off-by: Daniel Del Rio <[email protected]>
e54d4cd
to
6cd8202
Compare
Signed-off-by: Daniel Del Rio <[email protected]>
Signed-off-by: Daniel Del Rio <[email protected]>
Codecov ReportBase: 81.60% // Head: 81.60% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2572 +/- ##
=======================================
Coverage 81.60% 81.60%
=======================================
Files 130 130
Lines 19481 19483 +2
=======================================
+ Hits 15898 15900 +2
Misses 2766 2766
Partials 817 817
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
experiments/experiment.go
Outdated
@@ -290,6 +290,7 @@ func (ec *experimentContext) createTemplateService(template *v1alpha1.TemplateSp | |||
for _, ctr := range rs.Spec.Template.Spec.Containers { | |||
for _, port := range ctr.Ports { | |||
servicePort := corev1.ServicePort{ | |||
Name: port.Name, |
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 believe ports can also be unnamed. what is the default value here, is it compatible? (ideally type's default which is "")
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.
Documentation says it will be omitted if the name is not given. Should we make it by default an empty string if not given?
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 not set it at all
@@ -26,5 +26,6 @@ spec: | |||
memory: 16Mi | |||
cpu: 1m | |||
ports: | |||
- protocol: TCP | |||
- name: testport |
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.
does the test fail when name is not present? can we rather have two tests, one with single, unnamed port, another one with two named ports?
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.
Yes, test fails when name isn't present. I'll try that out
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.
okay, so let's make sure the test doesn't fails without name first
Signed-off-by: Daniel Del Rio <[email protected]>
Signed-off-by: Daniel Del Rio <[email protected]>
experiments/experiment_test.go
Outdated
@@ -70,6 +70,7 @@ func setExperimentService(template *v1alpha1.TemplateSpec) { | |||
template.Service = &v1alpha1.TemplateService{} | |||
template.Template.Spec.Containers[0].Ports = []corev1.ContainerPort{ | |||
{ | |||
Name: "testport", |
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.
this is not needed any more
Signed-off-by: Daniel Del Rio <[email protected]>
test/e2e/experiment_test.go
Outdated
g.ApplyManifests("@functional/experiment-with-multiport-service.yaml") | ||
g.When(). | ||
WaitForExperimentPhase("experiment-with-multiport-service", "Running"). | ||
Sleep(time.Second*5). |
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.
Sleep(time.Second*5). | |
WaitForExperimentCondition("experiment-with-service", func(ex *rov1.Experiment) bool { | |
return s.GetReplicaSetFromExperiment(ex, "test").Status.Replicas == 1 | |
}, "number-of-rs-pods-meet", fixtures.E2EWaitTimeout). |
I saw a few test have these long waits I would rather not slow down the e2e tests any more, I think this is what you where trying to accomplish if so could you switch to it?
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.
@alexef what do you think about 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.
the proposed change makes sense, most of the time rs gets ready in less than 5 seconds
test/e2e/experiment_test.go
Outdated
ExpectExperimentServiceCount("experiment-with-multiport-service", 1). | ||
When(). | ||
WaitForExperimentPhase("experiment-with-multiport-service", "Successful"). | ||
Sleep(time.Second*15). |
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.
Sleep(time.Second*15). | |
WaitForExperimentCondition("experiment-with-service", func(ex *rov1.Experiment) bool { | |
return s.GetReplicaSetFromExperiment(ex, "test").Status.Replicas == 0 | |
}, "number-of-rs-pods-meet", fixtures.E2EWaitTimeout). |
I saw a few test have these long waits I would rather not slow down the e2e tests any more, I think this is what you where trying to accomplish if so could you switch to it?
Signed-off-by: Daniel Del Rio <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Thanks for contributing! |
* Add name attribute to ServicePort Signed-off-by: Daniel Del Rio <[email protected]> * Format with gofmt Signed-off-by: Daniel Del Rio <[email protected]> * Update experiment test by adding port name Signed-off-by: Daniel Del Rio <[email protected]> * Include port name only when given Signed-off-by: Daniel Del Rio <[email protected]> * Implement separate e2e tests for single unnamed port and two named ports Signed-off-by: Daniel Del Rio <[email protected]> * Remove port name in experiment_test.go Signed-off-by: Daniel Del Rio <[email protected]> * Replace Sleep in new multiport service experiment Signed-off-by: Daniel Del Rio <[email protected]> --------- Signed-off-by: Daniel Del Rio <[email protected]> Signed-off-by: kaldorn <[email protected]>
* Add name attribute to ServicePort Signed-off-by: Daniel Del Rio <[email protected]> * Format with gofmt Signed-off-by: Daniel Del Rio <[email protected]> * Update experiment test by adding port name Signed-off-by: Daniel Del Rio <[email protected]> * Include port name only when given Signed-off-by: Daniel Del Rio <[email protected]> * Implement separate e2e tests for single unnamed port and two named ports Signed-off-by: Daniel Del Rio <[email protected]> * Remove port name in experiment_test.go Signed-off-by: Daniel Del Rio <[email protected]> * Replace Sleep in new multiport service experiment Signed-off-by: Daniel Del Rio <[email protected]> --------- Signed-off-by: Daniel Del Rio <[email protected]>
We encountered this error when we tried to run an Experiment for a service with multiple named ports:
Argo Rollouts currently only copies the port number and protocol from the Rollout to the service it creates during experiments, but not the name. This PR addresses this issue by also including the port name when copying.
Relates to: #2397
fixes: #2599
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.