From c907589a44af6805e21ef54efa0bc45659a93291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Th=C3=B6mmes?= Date: Mon, 22 Mar 2021 19:04:54 +0100 Subject: [PATCH] Default PeriodSeconds of the readiness probe to 1 if unset (#10992) --- pkg/reconciler/revision/resources/deploy_test.go | 1 + pkg/reconciler/revision/resources/queue.go | 11 +++++++++-- pkg/reconciler/revision/resources/queue_test.go | 5 +---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/reconciler/revision/resources/deploy_test.go b/pkg/reconciler/revision/resources/deploy_test.go index c6408e2b9cd7..70a32cfdfdc9 100644 --- a/pkg/reconciler/revision/resources/deploy_test.go +++ b/pkg/reconciler/revision/resources/deploy_test.go @@ -98,6 +98,7 @@ var ( }}, }, }, + PeriodSeconds: 1, }, SecurityContext: queueSecurityContext, Env: []corev1.EnvVar{{ diff --git a/pkg/reconciler/revision/resources/queue.go b/pkg/reconciler/revision/resources/queue.go index c355fee9ee40..5c215b804fc0 100644 --- a/pkg/reconciler/revision/resources/queue.go +++ b/pkg/reconciler/revision/resources/queue.go @@ -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{ @@ -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, diff --git a/pkg/reconciler/revision/resources/queue_test.go b/pkg/reconciler/revision/resources/queue_test.go index 883b7c83db71..236c41e9c9f8 100644 --- a/pkg/reconciler/revision/resources/queue_test.go +++ b/pkg/reconciler/revision/resources/queue_test.go @@ -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, }