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

Add startup probe support to Knative Service #15309

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ReToCode
Copy link
Member

@ReToCode ReToCode commented Jun 6, 2024

Fixes #10037

Context

see feature document: https://docs.google.com/document/d/1TmimPy7qNLtc5IHVFKEme8X-NiIUBtVgR44GlaTqoWs/edit?usp=sharing

Proposed Changes

  • Adds startup probe support to Knative Service
  • Startup Probes disable the Knative's probe optimisation, same as exec probes do, as they are executed on the user-container by the Kubelet
  • The ProgressDeadlineSeconds is dynamically increased to the maximum duration a startup probe could take (worst case) to make sure the pod is not scaled to zero before the startup probes succeeded or failed.

Release Note

Knative Service now supports setting startup probes in the spec. Please note that this increases the cold-start time of your service (more info in docs).

@knative-prow knative-prow bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 6, 2024
@knative-prow knative-prow bot requested review from dprotaso and skonto June 6, 2024 12:04
@ReToCode
Copy link
Member Author

ReToCode commented Jun 6, 2024

/assign @skonto
/assign @dprotaso
/assign @izabelacg

More info in the links above.

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.76%. Comparing base (09b4cd3) to head (0888fb9).

Files Patch % Lines
pkg/activator/net/revision_backends.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15309      +/-   ##
==========================================
- Coverage   84.79%   84.76%   -0.03%     
==========================================
  Files         218      218              
  Lines       13504    13519      +15     
==========================================
+ Hits        11451    11460       +9     
- Misses       1687     1691       +4     
- Partials      366      368       +2     

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

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 6, 2024
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 7, 2024
Copy link

knative-prow bot commented Jun 7, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ReToCode
Once this PR has been reviewed and has the lgtm label, please ask for approval from dprotaso. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@skonto
Copy link
Contributor

skonto commented Jun 19, 2024

@dprotaso gentle ping.

Comment on lines +373 to +390
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
}
}
}

Copy link
Member

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.

Copy link
Contributor

@skonto skonto Jun 20, 2024

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). 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support startupProbe in webhook
5 participants