Skip to content

Commit

Permalink
Remove ProgressDeadlineSeconds increase when startup probe is present
Browse files Browse the repository at this point in the history
  • Loading branch information
ReToCode committed Jul 8, 2024
1 parent 9af692f commit be536f3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 94 deletions.
20 changes: 1 addition & 19 deletions pkg/reconciler/revision/resources/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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{
Expand Down
75 changes: 0 additions & 75 deletions pkg/reconciler/revision/resources/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit be536f3

Please sign in to comment.