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

set service provider tags to be case insensitive #1477

Conversation

chadpatel
Copy link
Contributor

Description of the issue

The application, app and service service name provider ec2 tags are currently case sensitive, there are also bugs in exactness in how these are being compared due to excessive use of strings.Contains

Description of changes

Update InstanceTags to return a []string with the tag keys instead of the raw newline delimited list. This is a more friendly API to reason about. We can then convert it to a map with lowercase keys that we use for comparison.

I also fixed the asg lookup to also be an exact match instead. These matches are relatively efficient as I am converting the arrays to maps for O(1) lookups instead of having to repeatedly loop through the whole strings using Contains or slices.Contains

Related to: #1474

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Unit tests updated

Requirements

Before commit the code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

@chadpatel chadpatel requested a review from a team as a code owner December 19, 2024 20:56
Copy link
Contributor

@lisguo lisguo left a comment

Choose a reason for hiding this comment

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

lgtm with nit


// This will check whether the tags contains SERVICE, APPLICATION, APP, in that order (case insensitive)
lowerTagKeys := toLowerKeyMap(tagKeys)
for _, potentialServiceNameKey := range priorityMap {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I know it's not your code but priorityMap isn't a map, it's a list. Should be priorityList or something

@lisguo lisguo self-requested a review December 19, 2024 21:37
@lisguo
Copy link
Contributor

lisguo commented Dec 19, 2024

seems pr build failing

@chadpatel chadpatel marked this pull request as draft December 19, 2024 22:21
@chadpatel
Copy link
Contributor Author

Replaced with #1478

@chadpatel chadpatel closed this Dec 23, 2024
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