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

feat(mesh catalog): Return list of services for a given service account #1553

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

ksubrmnn
Copy link
Contributor

Please describe the motivation for this PR and provide enough
information so that others can review it.

Returns a list of services instead of a single service for a given service account

Please mark with X for applicable areas.

  • New Functionality [X]
  • Documentation [ ]
  • Install [ ]
  • Control Plane [ ]
  • CLI Tool [ ]
  • Certificate Management [ ]
  • Networking [X]
  • Metrics [ ]
  • SMI Policy [ ]
  • Security [ ]
  • Tests / CI System [ ]
  • Other [ ]

Please answer the following questions with yes/no.

  • Does this change contain code from or inspired by another project? If so, did you notify the maintainers and provide attribution?

No

@ksubrmnn ksubrmnn linked an issue Aug 17, 2020 that may be closed by this pull request
func (mc *MeshCatalog) GetServiceForServiceAccount(sa service.K8sServiceAccount) (service.MeshService, error) {
// GetServicesForServiceAccount returns a list of services corresponding to a service account
func (mc *MeshCatalog) GetServicesForServiceAccount(sa service.K8sServiceAccount) ([]service.MeshService, error) {
services := []service.MeshService{}
for _, provider := range mc.endpointsProviders {
// TODO (#88) : remove this provider check once we have figured out the service account story for azure vms
if provider.GetID() != constants.AzureProviderName {
log.Trace().Msgf("[%s] Looking for Services for Name=%s", provider.GetID(), sa)
service, err := provider.GetServiceForServiceAccount(sa)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will refactor provider functions (if needed) when Shashank merges his change

Copy link
Member

Choose a reason for hiding this comment

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

Thank you!

@ksubrmnn ksubrmnn marked this pull request as ready for review August 17, 2020 20:51
@ksubrmnn ksubrmnn requested a review from a team as a code owner August 17, 2020 20:51
if destErr != nil {
log.Error().Msgf("TrafficTarget %s/%s could not get destination services for service account %s", trafficTargets.Namespace, trafficTargets.Name, dstNamespacedServiceAcc.String())
return nil, destErr
}
destService := destServiceList[0]
Copy link
Member

Choose a reason for hiding this comment

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

would be good to create an issue and reference it wherever these assumptions are being made.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated issue #1550

func (mc *MeshCatalog) GetServiceForServiceAccount(sa service.K8sServiceAccount) (service.MeshService, error) {
// GetServicesForServiceAccount returns a list of services corresponding to a service account
func (mc *MeshCatalog) GetServicesForServiceAccount(sa service.K8sServiceAccount) ([]service.MeshService, error) {
services := []service.MeshService{}
for _, provider := range mc.endpointsProviders {
// TODO (#88) : remove this provider check once we have figured out the service account story for azure vms
if provider.GetID() != constants.AzureProviderName {
log.Trace().Msgf("[%s] Looking for Services for Name=%s", provider.GetID(), sa)
service, err := provider.GetServiceForServiceAccount(sa)
Copy link
Member

Choose a reason for hiding this comment

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

Thank you!

Copy link
Contributor

@draychev draychev left a comment

Choose a reason for hiding this comment

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

This is great!
Thank you @ksubrmnn

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants