-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Probe port different than container port #12606
Conversation
Welcome @izabelacg! It looks like this is your first PR to knative/serving 🎉 |
Hi @izabelacg. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
This PR is related to #8471 |
I worked with @izabelacg on this PR, so would you folks mind reviewing @dprotaso @psschwei |
/retest |
kicked off the GithubAction workflows |
Codecov Report
@@ Coverage Diff @@
## main #12606 +/- ##
==========================================
- Coverage 87.48% 87.28% -0.21%
==========================================
Files 195 196 +1
Lines 9718 9744 +26
==========================================
+ Hits 8502 8505 +3
- Misses 931 953 +22
- Partials 285 286 +1
Continue to review full report at Codecov.
|
why aren't the actions triggered automatically? and do you need special permissions to kick it off? |
@carlisia would you mind reviewing as well? |
/retest |
PRs from non-org members don't automatically kick off the actions for security reasons - ie. bitcoin miners I created an issue for |
/retest |
test/e2e/readinessport_test.go
Outdated
v1test "knative.dev/serving/test/v1" | ||
) | ||
|
||
func TestReadinessPort(t *testing.T) { |
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.
func TestReadinessPort(t *testing.T) { | |
func TestReadinessAlternatePort(t *testing.T) { |
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.
this was reverted
if container == nil { | ||
return fmt.Sprintf(testProbeJSONTemplate, v1.DefaultUserPort) | ||
} | ||
|
||
if container.ReadinessProbe.TCPSocket != nil && container.ReadinessProbe.TCPSocket.Port != intstr.FromInt(int(0)) { | ||
return fmt.Sprintf(testProbeJSONTemplate, container.ReadinessProbe.TCPSocket.Port.IntVal) | ||
} | ||
if container.ReadinessProbe.HTTPGet != nil && container.ReadinessProbe.HTTPGet.Port != intstr.FromInt(int(0)) { | ||
return fmt.Sprintf(testProbeJSONTemplate, container.ReadinessProbe.HTTPGet.Port.IntVal) | ||
} | ||
if ports := container.Ports; len(ports) > 0 && ports[0].ContainerPort != 0 { | ||
return fmt.Sprintf(testProbeJSONTemplate, ports[0].ContainerPort) | ||
} |
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.
nit: I'd probably just make a switch
statement so this reads a bit easier.
I was scanning to see if the template changes under any condition and it doesn't
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 what would you switch on, the if condition is checking different fields, can you clarify please?
/retest |
@izabelacg the failures are legit and not flakey |
probeServer.HandleFunc("/", handleHealthz) | ||
|
||
go func() { | ||
http.ListenAndServe(":"+strconv.Itoa(healthcheckPort), probeServer) |
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.
if the health check port isn't set we want it on the mainServer
That's probably the cause of the failures
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.
Or you could add the handleHealthz
handler to both servers to keep things simple
http.ListenAndServe(":8080", mainServer) | ||
}() | ||
|
||
<-finish |
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 can drop the use of the channel and just call http.ListenAndServe
to block. Invoking that in a go routine isn't needed
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 think the go func is required cause you have two ListenAndServe, which doesn't work on the same thread
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.
If you invoke one ListenAndServe
in a go routine and the other on the main go routine you don't need the finish
channel
I resolved some of the earlier comments - there's one or two outstanding |
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! I only have a couple super minor comments.
pkg/apis/serving/k8s_validation.go
Outdated
@@ -1,5 +1,5 @@ | |||
/* | |||
Copyright 2019 The Knative Authors | |||
Copyright 2022 The Knative Authors |
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.
we don't need to modify the copyright of existing files - please undo
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.
oh sorry, so basically only test/e2e/readinessport_test.go needs change on the copyright. Will revert changes
Updated the boilerplate year checks here: #12699 |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, izabelacg 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 |
Fixes #8288
Proposed Changes
Release Note