From be536f39eb24f50db683c2025a2b5451cebaf2b7 Mon Sep 17 00:00:00 2001 From: Reto Lehmann Date: Mon, 8 Jul 2024 07:39:07 +0200 Subject: [PATCH] Remove ProgressDeadlineSeconds increase when startup probe is present --- pkg/reconciler/revision/resources/deploy.go | 20 +---- .../revision/resources/deploy_test.go | 75 ------------------- 2 files changed, 1 insertion(+), 94 deletions(-) diff --git a/pkg/reconciler/revision/resources/deploy.go b/pkg/reconciler/revision/resources/deploy.go index cab4da949759..f62c5514f2d3 100644 --- a/pkg/reconciler/revision/resources/deploy.go +++ b/pkg/reconciler/revision/resources/deploy.go @@ -373,24 +373,6 @@ func MakeDeployment(rev *v1.Revision, cfg *config.Config) (*appsv1.Deployment, e progressDeadline = int32(pd.Seconds()) } - 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 - } - } - } - labels := makeLabels(rev) anns := makeAnnotations(rev) @@ -407,7 +389,7 @@ func MakeDeployment(rev *v1.Revision, cfg *config.Config) (*appsv1.Deployment, e Spec: appsv1.DeploymentSpec{ Replicas: ptr.Int32(replicaCount), Selector: makeSelector(rev), - ProgressDeadlineSeconds: ptr.Int32(progressDeadline + startupProbeMaxDuration), + ProgressDeadlineSeconds: ptr.Int32(progressDeadline), Strategy: appsv1.DeploymentStrategy{ Type: appsv1.RollingUpdateDeploymentStrategyType, RollingUpdate: &appsv1.RollingUpdateDeployment{ diff --git a/pkg/reconciler/revision/resources/deploy_test.go b/pkg/reconciler/revision/resources/deploy_test.go index d727bf0147dc..a74e1f94d95e 100644 --- a/pkg/reconciler/revision/resources/deploy_test.go +++ b/pkg/reconciler/revision/resources/deploy_test.go @@ -1851,81 +1851,6 @@ func TestMakeDeployment(t *testing.T) { deploy.Annotations = map[string]string{serving.ProgressDeadlineAnnotationKey: "42s"} deploy.Spec.Template.Annotations = map[string]string{serving.ProgressDeadlineAnnotationKey: "42s"} }), - }, { - name: "with progress-deadline increase from single startup probe", - dc: deployment.Config{ - ProgressDeadline: 42 * time.Second, - }, - rev: revision("bar", "foo", - withContainers([]corev1.Container{{ - Name: servingContainerName, - Image: "ubuntu", - ReadinessProbe: withTCPReadinessProbe(12345), - StartupProbe: &corev1.Probe{ - InitialDelaySeconds: 10, - TimeoutSeconds: 30, - PeriodSeconds: 5, - SuccessThreshold: 1, - FailureThreshold: 3, - ProbeHandler: corev1.ProbeHandler{ - HTTPGet: &corev1.HTTPGetAction{ - Path: "/", - }, - }, - }, - }}), - WithContainerStatuses([]v1.ContainerStatus{{ - ImageDigest: "busybox@sha256:deadbeef", - }}), withoutLabels), - want: appsv1deployment(func(deploy *appsv1.Deployment) { - deploy.Spec.ProgressDeadlineSeconds = ptr.Int32(42 + 10 + (5 * 3 * 30)) - }), - }, { - name: "with progress-deadline increase from multiple startup probes", - dc: deployment.Config{ - ProgressDeadline: 42 * time.Second, - }, - rev: revision("bar", "foo", - withContainers([]corev1.Container{{ - Name: servingContainerName, - Image: "ubuntu", - ReadinessProbe: withTCPReadinessProbe(12345), - StartupProbe: &corev1.Probe{ - InitialDelaySeconds: 10, - TimeoutSeconds: 30, - PeriodSeconds: 5, - SuccessThreshold: 1, - FailureThreshold: 3, - ProbeHandler: corev1.ProbeHandler{ - HTTPGet: &corev1.HTTPGetAction{ - Path: "/", - }, - }, - }, - }, { - Name: servingContainerName + "-2", - Image: "sidecar", - StartupProbe: &corev1.Probe{ - InitialDelaySeconds: 10, - TimeoutSeconds: 30, - PeriodSeconds: 5, - SuccessThreshold: 5, - FailureThreshold: 3, - ProbeHandler: corev1.ProbeHandler{ - HTTPGet: &corev1.HTTPGetAction{ - Path: "/", - }, - }, - }, - }}), - WithContainerStatuses([]v1.ContainerStatus{{ - ImageDigest: "busybox@sha256:deadbeef", - }, { - ImageDigest: "busybox@sha256:deadbeef", - }}), withoutLabels), - want: appsv1deployment(func(deploy *appsv1.Deployment) { - deploy.Spec.ProgressDeadlineSeconds = ptr.Int32(42 + 10 + (5 * 5 * 30)) - }), }, { name: "cluster initial scale", acMutator: func(ac *autoscalerconfig.Config) {