Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

ref: method renaming for cataloger endpoint methods #3744

Merged

Conversation

allenlsy
Copy link
Contributor

@allenlsy allenlsy commented Jul 8, 2021

Signed-off-by: Allen Leigh [email protected]

Description:

This PR aims to resolve issue #3190 .

It mainly drops the word allowed from cataloger endpoints methods.

Affected area:

Functional Area
New Functionality [ ]
Documentation [ ]
Install [ ]
CLI Tool [ ]
Certificate Management [ ]
Control Plane [ ]
Ingress [ ]
Egress [ ]
Networking [ ]
Observability [ ]
SMI Policy [ ]
Sidecar Injection [ ]
Security [ ]
Upgrade [ ]
Tests [ ]
CI System [ ]
Demo [ ]
Performance [ ]
Other [X]

Please answer the following questions with yes/no.

  1. Does this change contain code from or inspired by another project?
    • Did you notify the maintainers and provide attribution?

No

  1. Is this a breaking change?

No

@allenlsy allenlsy requested a review from a team as a code owner July 8, 2021 16:58
for _, ep := range mc.listEndpointsForServiceIdentity(destSvcIdentity) {
epIPStr := ep.IP.String()
// check if endpoint IP is allowed
if _, ok := outboundEndpointsSet[epIPStr]; ok {
// add all allowed endpoints on the pod to result list
// TODO(allenlsy): only allow endpoint with matching port
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Current implementation is correct. Thus it's no longer a TODO

@allenlsy allenlsy marked this pull request as draft July 8, 2021 17:04
Copy link
Member

@shashankram shashankram left a comment

Choose a reason for hiding this comment

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

The reason the functions have Allowed in the name is because it filters the endpoints based on the policies, where some endpoints are disallowed and the rest allowed. There are 2 options to resolve any ambiguity:

  1. Keep the function names as before
  2. Rename the function names, and update all comments to make it explicit that only a subset of endpoints corresponding to the service identity will be returned by these functions

@allenlsy
Copy link
Contributor Author

allenlsy commented Jul 8, 2021

(Removed)

@shashankram
Copy link
Member

@shashankram Keeping the function names is preferred.

You mean keeping the previous function names or the changes in this PR?

@allenlsy
Copy link
Contributor Author

allenlsy commented Jul 8, 2021

(Removed)

@allenlsy allenlsy force-pushed the cataloger-list-endpoints-ref branch from 715a29e to 67af702 Compare July 8, 2021 20:14
@@ -52,7 +52,6 @@ func (mc *MeshCatalog) ListEndpointsForServiceIdentity(downstreamIdentity identi
ipStr := ep.IP.String()
outboundEndpointsSet[ipStr] = append(outboundEndpointsSet[ipStr], ep)
}
log.Info().Msgf("outbound endpoints: %v", outboundEndpointsSet)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was added by mistake initially. It was used for debugging.

@allenlsy allenlsy marked this pull request as ready for review July 8, 2021 20:17
@allenlsy allenlsy requested a review from shashankram July 8, 2021 20:18
@@ -38,8 +38,8 @@ func (mc *MeshCatalog) GetResolvableServiceEndpoints(svc service.MeshService) ([
return endpoints, nil
}

// ListEndpointsForServiceIdentity returns only those endpoints for a allowed outbound service accounts
// for the given downstream identity
// ListEndpointsForServiceIdentity returns a list of endpoints that belongs to an upstream service accounts
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// ListEndpointsForServiceIdentity returns a list of endpoints that belongs to an upstream service accounts
// ListEndpointsForServiceIdentity returns a list of endpoints that belongs to an upstream service account

@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2021

Codecov Report

Merging #3744 (cdae897) into main (1f174c9) will increase coverage by 0.01%.
The diff coverage is 18.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3744      +/-   ##
==========================================
+ Coverage   69.54%   69.55%   +0.01%     
==========================================
  Files         185      185              
  Lines        9035     9033       -2     
==========================================
  Hits         6283     6283              
+ Misses       2703     2701       -2     
  Partials       49       49              
Flag Coverage Δ
unittests 69.55% <18.18%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/catalog/mock_catalog_generated.go 0.00% <0.00%> (ø)
pkg/catalog/traffictarget.go 88.46% <ø> (ø)
pkg/envoy/cds/response.go 82.45% <ø> (ø)
pkg/envoy/eds/response.go 42.85% <ø> (ø)
pkg/catalog/endpoint.go 70.00% <100.00%> (-1.43%) ⬇️
pkg/catalog/outbound_traffic_policies.go 83.06% <100.00%> (ø)
pkg/envoy/ads/secrets.go 88.88% <100.00%> (ø)
pkg/envoy/sds/response.go 89.09% <100.00%> (ø)
...icate/providers/certmanager/certificate_manager.go 84.37% <0.00%> (-0.79%) ⬇️
pkg/providers/kube/client.go 62.02% <0.00%> (+0.63%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f174c9...cdae897. Read the comment docs.

Copy link
Member

@shashankram shashankram left a comment

Choose a reason for hiding this comment

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

Could you update the PR and commit title and description to reflect the fact that this PR isn't renaming the functions anymore?

@allenlsy allenlsy force-pushed the cataloger-list-endpoints-ref branch from 67af702 to 807eed9 Compare July 8, 2021 20:55
@allenlsy allenlsy force-pushed the cataloger-list-endpoints-ref branch from 807eed9 to cdae897 Compare July 8, 2021 21:00
@allenlsy
Copy link
Contributor Author

allenlsy commented Jul 8, 2021

The final choice is to go with dropping the allowed wording in method names, and add comments to the method usage to indicate that the returned objects is only the allowed portion of the required resources.

@allenlsy allenlsy requested a review from shashankram July 8, 2021 21:38
@allenlsy allenlsy merged commit 34d92f0 into openservicemesh:main Jul 8, 2021
@allenlsy allenlsy deleted the cataloger-list-endpoints-ref branch July 12, 2021 18:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants