Skip to content

[WIP] Port spec changes#1934

Closed
vadimeisenbergibm wants to merge 3 commits intoistio:masterfrom
vadimeisenbergibm:port_spec3
Closed

[WIP] Port spec changes#1934
vadimeisenbergibm wants to merge 3 commits intoistio:masterfrom
vadimeisenbergibm:port_spec3

Conversation

@vadimeisenbergibm
Copy link
Copy Markdown
Contributor

@vadimeisenbergibm vadimeisenbergibm commented Nov 30, 2017

What this PR does / why we need it:

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Release note:

@istio-testing
Copy link
Copy Markdown
Collaborator

@vadimeisenbergibm: Adding do-not-merge/release-note-label-needed because the release note process has not been followed.

Details

One of the following labels is required "release-note", "release-note-action-required", or "release-note-none".
Please see: https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md#write-release-notes-if-needed.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@istio-merge-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
We suggest the following additional approver: kyessenov

Assign the PR to them by writing /assign @kyessenov in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

if err := ValidatePort(int(port.GetNumber())); err != nil {
return err
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You need a conversion function here, to convert the Port spec into our internal Port struct in the service model. That would allow you to reuse code in proxy/envoy/

portNumber := int(port.GetNumber())
modelPort := &model.Port{Name: fmt.Sprintf("external-%v-%d", protocol, portNumber),
Port: portNumber, Protocol: protocol}
httpConfig := httpConfigs.EnsurePort(portNumber)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See my earlier comment. We have a Port struct in the service model. Just convert the Port (proto) to that struct. That would eliminate these changes. you could even hoist the port name construction (external-x-y) into that conversion function..

@ijsnellf thoughts? I leave it to you guys

@rshriram
Copy link
Copy Markdown
Member

closing as per discussion in istio/api

@rshriram rshriram closed this Nov 30, 2017
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.

5 participants