-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use hostIP for container-freezer #12162
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 #12162 +/- ##
==========================================
+ Coverage 87.41% 87.44% +0.02%
==========================================
Files 196 196
Lines 9601 9615 +14
==========================================
+ Hits 8393 8408 +15
Misses 930 930
+ Partials 278 277 -1
Continue to review full report at Codecov.
|
pkg/queue/concurrency_state.go
Outdated
// setEndpoint swaps $HOST_IP into the user-provided endpoint if necessary, | ||
// otherwise it returns the user-provided endpoint with no changes. | ||
func (c *ConcurrencyEndpoint) setEndpoint(e string) error { | ||
r := regexp.MustCompile("(http://|https://)?\\$HOST_IP:\\d\\d\\d\\d") |
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.
os.Expand might be a nicer way of doing this
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.
a LOT nicer :)
@@ -114,7 +114,7 @@ type ConcurrencyEndpoint struct { | |||
|
|||
func NewConcurrencyEndpoint(e, m string) ConcurrencyEndpoint { | |||
c := ConcurrencyEndpoint{ | |||
endpoint: e, | |||
endpoint: os.ExpandEnv(e), | |||
mountPath: m, |
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.
Do we want to expand the whole env here, or just HOST_IP? (os.Expand will let us be more specific, I'm being paranoid about security of parroting any env var)
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.
no, that's a fair point. let me fix that
pkg/queue/concurrency_state.go
Outdated
func NewConcurrencyEndpoint(e, m string) ConcurrencyEndpoint { | ||
c := ConcurrencyEndpoint{ | ||
endpoint: e, | ||
endpoint: os.Expand(e, mapper), |
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.
but of a nit but we don't really need the switch so I think this could be:
endpoint: os.Expand(e, mapper), | |
endpoint: os.Expand(e, func(s string) string { | |
if s == "HOST_IP" { return os.Getenv("HOST_IP") } | |
return "$" + s | |
}), |
45696dd
to
54bfa49
Compare
Prow unit tests passed but GH action one failed (and nothing was changed in failed test: |
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: julz, psschwei The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Proposed Changes
concurrency-state-endpoint
take ahttp://$HOST_IP:<port>
endpoint value and swap in the actual host IP valueRelease Note
/assign @julz @markusthoemmes