Skip to content

Commit

Permalink
Default PeriodSeconds of the readiness probe to 1 if unset (knative#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
markusthoemmes committed Apr 7, 2021
1 parent 9bba069 commit c907589
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions pkg/reconciler/revision/resources/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ var (
}},
},
},
PeriodSeconds: 1,
},
SecurityContext: queueSecurityContext,
Env: []corev1.EnvVar{{
Expand Down
11 changes: 9 additions & 2 deletions pkg/reconciler/revision/resources/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ func makeQueueContainer(rev *v1.Revision, cfg *config.Config) (*corev1.Container

// After startup we'll directly use the same http health check endpoint the
// execprobe would have used (which will then check the user container).
// Unlike the StartupProbe, we don't need to override any of the
// timeouts/periods/thresholds here.
// Unlike the StartupProbe, we don't need to override any of the other settings
// except period here. See below.
httpProbe := container.ReadinessProbe.DeepCopy()
httpProbe.Handler = corev1.Handler{
HTTPGet: &corev1.HTTPGetAction{
Expand All @@ -263,6 +263,13 @@ func makeQueueContainer(rev *v1.Revision, cfg *config.Config) (*corev1.Container
},
}

// Default PeriodSeconds to 1 if not set to make for the quickest possible startup
// time.
// TODO(#10973): Remove this once we're on K8s 1.21
if httpProbe.PeriodSeconds == 0 {
httpProbe.PeriodSeconds = 1
}

return &corev1.Container{
Name: QueueContainerName,
Image: cfg.Deployment.QueueSidecarImage,
Expand Down
5 changes: 1 addition & 4 deletions pkg/reconciler/revision/resources/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,10 +735,7 @@ func TestTCPProbeGeneration(t *testing.T) {
}},
},
},
// The ReadinessProbe does not override the user's probe parameters.
// (The aggressive probing will have happened on startup, now
// we can probe at the user-requested/default interval).
PeriodSeconds: 0,
PeriodSeconds: 1,
TimeoutSeconds: 0,
SuccessThreshold: 3,
}
Expand Down

0 comments on commit c907589

Please # to comment.