Skip to content
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

287-format pod container port name #51

Merged
merged 6 commits into from
Jan 15, 2021

Conversation

yangcao77
Copy link
Collaborator

What does this PR do?

This PR formats the container port name to be <portNumber>-<protocol>, updated to use latest api repo and latest schema.

What issues does this PR fix or reference?

devfile/api#287

Is your PR tested? Consider putting some instruction how to test your changes

unit tested

Signed-off-by: Stephanie <[email protected]>
@yangcao77 yangcao77 force-pushed the 287-formatPodContainerPortName branch from f40a0a0 to 04e1965 Compare January 12, 2021 20:57
@yangcao77 yangcao77 requested a review from mmulholla January 12, 2021 21:10
@yangcao77
Copy link
Collaborator Author

@mmulholl Some of the generated random strings in api tests are not valid. I have to modify them to match the schema. Please help review the test code change, thanks!

@mmulholla
Copy link
Contributor

@yangcao77 Hi, the changes you made to the parser tests look good.

Copy link
Member

@maysunfaisal maysunfaisal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion for changing package alias to be less confusing between all these v1 and v2

@@ -4,8 +4,8 @@ import (
"reflect"
"testing"

v1 "github.com/devfile/api/pkg/apis/workspaces/v1alpha2"
"github.com/devfile/api/pkg/attributes"
v1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking if we should call these aliases devfileApiv2 🤔 it will be less confusing as well

Comment on lines 47 to 49
if _, exist := portMap[name]; exist {
continue
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if _, exist := portMap[name]; exist {
continue
}
if _, exist := portMap[name]; !exist {
portMap[name] = true
containerPorts = append(containerPorts, corev1.ContainerPort{
Name: name,
ContainerPort: portNumber,
Protocol: portProtocol,
})
}

would probably do this way but upto you

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -127,12 +128,14 @@ func TestConvertPorts(t *testing.T) {
},
want: []corev1.ContainerPort{
{
Name: endpointsNames[0],
Name: "8080-tcp",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed, can you update teh test case name, it seems wrong

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Signed-off-by: Stephanie <[email protected]>
Copy link
Member

@maysunfaisal maysunfaisal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maysunfaisal, 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:
  • OWNERS [maysunfaisal,yangcao77]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants