Skip to content

Conversation

@mikhail-aws
Copy link
Contributor

@mikhail-aws mikhail-aws commented Dec 8, 2023

Note:

Address bug for RAM sharing scenario with ServiceNetwork. Currently FindServiceNetwork will not find shared SNs, but if find will fail on fetching Tags. It's not possible to fetch tags for external resources.

Important changes in vpclattice.go

New algorithm will do:

  • List all SN
  • Filter by Name match
  • Filter by ID match. I use ID as fallback strategy. If there multiple SN with same name (which is possible with RAM sharing, but not in same account). Operator can create GW with SN-ID as a name to disambiguate naming.

Added unit tests.
Manually tested with shared SN scenarios.

New error log example:

reconcile error	{"name": "share-to-mhlbrz", "message": "multiple SN found by name, cannot disambiguate: [name=share-to-mhlbrz, id=sn-09ee4f73b2985af2b name=share-to-mhlbrz, id=sn-08542bb99cb2f3bae]"}

Related #565

ListServiceNetworkVpcAssociationsAsList(ctx context.Context, input *vpclattice.ListServiceNetworkVpcAssociationsInput) ([]*vpclattice.ServiceNetworkVpcAssociationSummary, error)
ListServiceNetworkServiceAssociationsAsList(ctx context.Context, input *vpclattice.ListServiceNetworkServiceAssociationsInput) ([]*vpclattice.ServiceNetworkServiceAssociationSummary, error)
FindServiceNetwork(ctx context.Context, name string, accountId string) (*ServiceNetworkInfo, error)
FindServiceNetwork(ctx context.Context, name string) (*ServiceNetworkInfo, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to change name to nameOrId string in interface?

})
idMatch := utils.SliceFilter(allSn, func(snSum *vpclattice.ServiceNetworkSummary) bool {
return aws.StringValue(snSum.Id) == nameOrId
})
Copy link
Contributor

Choose a reason for hiding this comment

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

For the discussion in slack, filter by name then id make sense. We could also add another filter by ARN, i.e. change function name to
FindServiceNetwork(ctx context.Context, nameOrIdOrArn string) and add a arnMatch=

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would drop ID and use ARN only

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ARN is not a valid name for Gateway, "/" if not allowed

@mikhail-aws mikhail-aws removed the request for review from erikfuller December 11, 2023 23:03
@mikhail-aws mikhail-aws changed the title change FindServiceNetwork algo, use name and id match change FindServiceNetwork algo, use name and arn match Dec 12, 2023
@mikhail-aws mikhail-aws changed the title change FindServiceNetwork algo, use name and arn match change FindServiceNetwork algo, use name and id match Dec 12, 2023
@mikhail-aws mikhail-aws merged commit 99c4255 into aws:main Dec 12, 2023
@mikhail-aws mikhail-aws deleted the shared-sn branch December 15, 2023 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants