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

Split HTTPGetAction.Path into path and query #14273

Merged
merged 4 commits into from
Aug 30, 2023

Conversation

nak3
Copy link
Contributor

@nak3 nak3 commented Aug 16, 2023

Fixes #14267

corev1.HTTPGetAction has Path which allows path and query like /mypath?foo=bar.
However, Golang's url.URL needs to split it into Path and RawQuery otherwise url.String() encodes ? into %3F like #14267.

Hence this patch fix it by split corev1.HTTPGetAction.Path into Path and RawQuery.

Release Note

ReadinessProbe with path contains a query string is supported now.

@knative-prow knative-prow bot requested review from kauana and KauzClay August 16, 2023 13:27
@knative-prow knative-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. area/autoscale area/networking labels Aug 16, 2023
@knative-prow
Copy link

knative-prow bot commented Aug 16, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nak3

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 16, 2023
@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Patch coverage: 30.00% and project coverage change: -0.04% ⚠️

Comparison is base (becea87) 86.25% compared to head (885efc3) 86.21%.
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14273      +/-   ##
==========================================
- Coverage   86.25%   86.21%   -0.04%     
==========================================
  Files         199      199              
  Lines       14811    14813       +2     
==========================================
- Hits        12775    12771       -4     
- Misses       1734     1739       +5     
- Partials      302      303       +1     
Files Changed Coverage Δ
pkg/queue/health/probe.go 49.16% <30.00%> (-4.23%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@dprotaso dprotaso left a comment

Choose a reason for hiding this comment

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

Should we add an e2e test?

pkg/queue/health/probe.go Outdated Show resolved Hide resolved
@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/test-and-release It flags unit/e2e/conformance/perf test issues for product features and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 17, 2023
@nak3
Copy link
Contributor Author

nak3 commented Aug 17, 2023

Sure, added the e2e test.

Path: config.Path,
}
func getURL(config HTTPProbeConfigOptions) (*url.URL, error) {
return url.Parse(string(config.Scheme) + "://" + net.JoinHostPort(config.Host, config.Port.String()) + config.Path)
Copy link
Contributor

@skonto skonto Aug 28, 2023

Choose a reason for hiding this comment

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

Just for clarification, given the path /mypath?foo=bar this is equivalent to constructing a URL with:

		Path:    "/mypath",
		RawQuery: "foo=bar",

u.String() method indeed uses an escaped path only so it does not seem to have a way to avoid it. Also I think this is the proper way to do it as we want some parsing to happen instead of manually creating the URL.
As a side note, if the path has a special char it will be escaped which is legitimate wrt probes.

@skonto
Copy link
Contributor

skonto commented Aug 28, 2023

/lgtm

/hold for @dprotaso

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 28, 2023
@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Aug 28, 2023
@dprotaso
Copy link
Member

/hold cancel

thanks @nak3 🎉

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 30, 2023
@knative-prow knative-prow bot merged commit 358ec13 into knative:main Aug 30, 2023
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/autoscale area/networking area/test-and-release It flags unit/e2e/conformance/perf test issues for product features lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Readiness probes fail if the path contains a querystring
3 participants