-
Notifications
You must be signed in to change notification settings - Fork 2k
Validate rewrite annotation #2734
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2734 +/- ##
=======================================
Coverage 53.54% 53.55%
=======================================
Files 52 52
Lines 14764 14782 +18
=======================================
+ Hits 7905 7916 +11
- Misses 6597 6601 +4
- Partials 262 265 +3
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
71ac774
to
74bce18
Compare
internal/configs/parsing_helpers.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change to wording of this to be 'is not a valid'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
internal/configs/parsing_helpers.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding 10BC0 this comment
The reason will be displayed to describe this comment to others. Learn more.
'P' should be upper case for the word 'path' here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving as it is after discussion
internal/k8s/validation_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to update this expected error message if you make the update from my first comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
As refactoring touches files that use fmt.Errorf()
it may be worth to consider going a step further and implement sentinel errors. This would allow to leverage error handling and wrapping introduced in Go 1.13:
errors.Is(err, errType)
errors.As(err, &errType)
instead of comparing strings in unit tests.
Just food for thought...
92a5053
to
c7577fe
Compare
Proposed changes
Validate rewrite annotation to ensure (1) "serviceName" and "rewrite" present, (2) serviceName value in "spec", and (3) rewrite paths start with "/" and not include any whitespace character, "{", "}" or "$".
Checklist
Before creating a PR, run through this checklist and mark each as complete.