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

fix: handle the case when the gateway suffix (in HA mode) ends up being a number #16

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

raman2805
Copy link
Contributor

Description

To get the instance id of the pod, we were first checking that the last token (split by -) is an integer or not, in which case we returned that. If not, we used the third to last token (to handle the case for gw ha pods) to get the index. However, this breaks down if the ha pods end up receiving a suffix which is an integer. This change fixes that issue.

@codecov
Copy link

codecov bot commented Apr 4, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +2.08 🎉

Comparison is base (154ff20) 76.38% compared to head (33e1356) 78.46%.

❗ Current head 33e1356 differs from pull request most recent head 7d5c04b. Consider uploading reports for the commit 7d5c04b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #16      +/-   ##
==========================================
+ Coverage   76.38%   78.46%   +2.08%     
==========================================
  Files          41       37       -4     
  Lines        2837     2721     -116     
==========================================
- Hits         2167     2135      -32     
+ Misses        564      486      -78     
+ Partials      106      100       -6     
Impacted Files Coverage Δ
config/misc.go 89.65% <100.00%> (+4.80%) ⬆️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

config/misc.go Outdated
Comment on lines 38 to 39
regexGwHa := regexp.MustCompile(`^.*-gw-ha-\d+-\w+-\w+$`)
regexGwNonHaOrProcessor := regexp.MustCompile(`^.*-\d+$`)
Copy link
Member

Choose a reason for hiding this comment

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

We can define those regexes as a global vars in the file, so we don't have to compile everytime GetInstanceID is called

@atzoum atzoum merged commit f6ee7d4 into main Apr 11, 2023
@atzoum atzoum deleted the fix.getInstanceID branch April 11, 2023 10:08
@github-actions github-actions bot mentioned this pull request Apr 11, 2023
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.

4 participants