-
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
Add startup probe support to Knative Service #15309
Conversation
/assign @skonto More info in the links above. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15309 +/- ##
==========================================
+ Coverage 84.56% 84.61% +0.05%
==========================================
Files 219 219
Lines 13584 13587 +3
==========================================
+ Hits 11487 11497 +10
+ Misses 1727 1724 -3
+ Partials 370 366 -4 ☔ View full report in Codecov by Sentry. |
@dprotaso gentle ping. |
startupProbeMaxDuration := int32(0) | ||
for _, container := range podSpec.Containers { | ||
if container.StartupProbe != nil { | ||
maxSuccessDuration := container.StartupProbe.PeriodSeconds * | ||
container.StartupProbe.SuccessThreshold * | ||
container.StartupProbe.TimeoutSeconds | ||
|
||
maxFailDuration := container.StartupProbe.PeriodSeconds * | ||
container.StartupProbe.FailureThreshold * | ||
container.StartupProbe.TimeoutSeconds | ||
|
||
maxDuration := max(maxSuccessDuration, maxFailDuration) | ||
if maxDuration > startupProbeMaxDuration { | ||
startupProbeMaxDuration = container.StartupProbe.InitialDelaySeconds + maxDuration | ||
} | ||
} | ||
} | ||
|
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'm sorta inclined to think that the progressdeadline encapsulates all the (startup time + ready time).
So I'm thinking of not adding this extra time here just because there's a startup probe.
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.
Probably we can omit that and keep the K8s UX. It seems that the only validation that happens at the K8s side for progressdeadline is about MinReadySeconds
, https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/apps/validation/validation.go#L592. I am wondering how that field affects our stuff in case would want to set it (right now it is not exposed). 🤔
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.
Hm I think we can, just means a user has to be aware of it and set that field himself accordingly. As startup probes are potentially used for slow-starting things the increase is quite necessary. Otherwise we will never see the pod starting up. Im fine with both ways.
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 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, ReToCode 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 |
A follow question I have is - what happens when a user container restarts and it has a startup probe? |
I think K8s runs the startup probe on every container creating (including a restarting one): kubernetes/kubernetes#102230 |
* Add startup probe to CRDs * Allow startup probes in Knative Services * Increase ProgressDeadlineSeconds when startup probe is present * Remove ProgressDeadlineSeconds increase when startup probe is present (cherry picked from commit ac7f585)
* Add startup probe support to Knative Service (knative#15309) * Add startup probe to CRDs * Allow startup probes in Knative Services * Increase ProgressDeadlineSeconds when startup probe is present * Remove ProgressDeadlineSeconds increase when startup probe is present (cherry picked from commit ac7f585) * Run make generated files
I guess to confirm does Knative behave correctly with your changes? |
I think it looks good: https://github.com/ReToCode/knative-multicontainer-probing/blob/main/TESTING_STARTUP_PROBES.md#testing-startup-probe-with-liveness-failures
After the user-container is restarted, the startup probe is executed again. |
Fixes #10037
Context
see feature document: https://docs.google.com/document/d/1TmimPy7qNLtc5IHVFKEme8X-NiIUBtVgR44GlaTqoWs/edit?usp=sharing
Proposed Changes
Release Note