Skip to content

Commit 4eedfa2

Browse files
committed
Drop MaxDurationSeconds from the RevisionSpec
We added MaxDurationSeconds (#12322) because the behaviour of RevisionSpec.Timeout changed from total duration to time to first byte. In hindsight changing the behaviour of Timeout was a mistake since it goes against the original specification. Thus we're going to create a path for migration and the first part is to remove MaxDurationSeconds from the RevisionSpec.
1 parent 7ab3a5f commit 4eedfa2

File tree

11 files changed

+5
-279
lines changed

11 files changed

+5
-279
lines changed

config/core/300-resources/configuration.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,6 @@ spec:
474474
name:
475475
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
476476
type: string
477-
maxDurationSeconds:
478-
description: MaxDurationSeconds is the maximum duration in seconds a request will be allowed to stay open.
479-
type: integer
480-
format: int64
481477
serviceAccountName:
482478
description: 'ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/'
483479
type: string

config/core/300-resources/revision.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,6 @@ spec:
453453
name:
454454
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
455455
type: string
456-
maxDurationSeconds:
457-
description: MaxDurationSeconds is the maximum duration in seconds a request will be allowed to stay open.
458-
type: integer
459-
format: int64
460456
serviceAccountName:
461457
description: 'ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/'
462458
type: string

config/core/300-resources/service.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,6 @@ spec:
478478
name:
479479
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
480480
type: string
481-
maxDurationSeconds:
482-
description: MaxDurationSeconds is the maximum duration in seconds a request will be allowed to stay open.
483-
type: integer
484-
format: int64
485481
serviceAccountName:
486482
description: 'ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/'
487483
type: string

docs/serving-api.md

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -920,19 +920,6 @@ layer will wait for a request delivered to a container to begin replying
920920
(send network traffic). If unspecified, a system default will be provided.</p>
921921
</td>
922922
</tr>
923-
<tr>
924-
<td>
925-
<code>maxDurationSeconds</code><br/>
926-
<em>
927-
int64
928-
</em>
929-
</td>
930-
<td>
931-
<em>(Optional)</em>
932-
<p>MaxDurationSeconds is the maximum duration in seconds a request will be allowed
933-
to stay open.</p>
934-
</td>
935-
</tr>
936923
</table>
937924
</td>
938925
</tr>
@@ -1395,19 +1382,6 @@ layer will wait for a request delivered to a container to begin replying
13951382
(send network traffic). If unspecified, a system default will be provided.</p>
13961383
</td>
13971384
</tr>
1398-
<tr>
1399-
<td>
1400-
<code>maxDurationSeconds</code><br/>
1401-
<em>
1402-
int64
1403-
</em>
1404-
</td>
1405-
<td>
1406-
<em>(Optional)</em>
1407-
<p>MaxDurationSeconds is the maximum duration in seconds a request will be allowed
1408-
to stay open.</p>
1409-
</td>
1410-
</tr>
14111385
</tbody>
14121386
</table>
14131387
<h3 id="serving.knative.dev/v1.RevisionStatus">RevisionStatus
@@ -1608,19 +1582,6 @@ layer will wait for a request delivered to a container to begin replying
16081582
(send network traffic). If unspecified, a system default will be provided.</p>
16091583
</td>
16101584
</tr>
1611-
<tr>
1612-
<td>
1613-
<code>maxDurationSeconds</code><br/>
1614-
<em>
1615-
int64
1616-
</em>
1617-
</td>
1618-
<td>
1619-
<em>(Optional)</em>
1620-
<p>MaxDurationSeconds is the maximum duration in seconds a request will be allowed
1621-
to stay open.</p>
1622-
</td>
1623-
</tr>
16241585
</table>
16251586
</td>
16261587
</tr>

pkg/apis/serving/v1/revision_types.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ type RevisionSpec struct {
8888
// (send network traffic). If unspecified, a system default will be provided.
8989
// +optional
9090
TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"`
91-
92-
// MaxDurationSeconds is the maximum duration in seconds a request will be allowed
93-
// to stay open.
94-
// +optional
95-
MaxDurationSeconds *int64 `json:"maxDurationSeconds,omitempty"`
9691
}
9792

9893
const (

pkg/apis/serving/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/reconciler/revision/resources/deploy_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ var (
109109
}, {
110110
Name: "REVISION_TIMEOUT_SECONDS",
111111
Value: "45",
112-
}, {
113-
Name: "MAX_DURATION_SECONDS",
114-
Value: "100",
115112
}, {
116113
Name: "SERVING_POD",
117114
ValueFrom: &corev1.EnvVarSource{
@@ -266,8 +263,7 @@ func defaultRevision() *v1.Revision {
266263
UID: "1234",
267264
},
268265
Spec: v1.RevisionSpec{
269-
TimeoutSeconds: ptr.Int64(45),
270-
MaxDurationSeconds: ptr.Int64(100),
266+
TimeoutSeconds: ptr.Int64(45),
271267
},
272268
}
273269
}
@@ -419,8 +415,7 @@ func withContainers(containers []corev1.Container) RevisionOption {
419415
PodSpec: corev1.PodSpec{
420416
Containers: containers,
421417
},
422-
TimeoutSeconds: ptr.Int64(45),
423-
MaxDurationSeconds: ptr.Int64(100),
418+
TimeoutSeconds: ptr.Int64(45),
424419
}
425420
}
426421
}

pkg/reconciler/revision/resources/queue.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,6 @@ func makeQueueContainer(rev *v1.Revision, cfg *config.Config) (*corev1.Container
193193
if rev.Spec.TimeoutSeconds != nil {
194194
ts = *rev.Spec.TimeoutSeconds
195195
}
196-
maxDurationTS := int64(0)
197-
if rev.Spec.MaxDurationSeconds != nil {
198-
maxDurationTS = *rev.Spec.MaxDurationSeconds
199-
}
200196
ports := queueNonServingPorts
201197
if cfg.Observability.EnableProfiling {
202198
ports = append(ports, profilingPort)
@@ -271,9 +267,6 @@ func makeQueueContainer(rev *v1.Revision, cfg *config.Config) (*corev1.Container
271267
}, {
272268
Name: "REVISION_TIMEOUT_SECONDS",
273269
Value: strconv.Itoa(int(ts)),
274-
}, {
275-
Name: "MAX_DURATION_SECONDS",
276-
Value: strconv.Itoa(int(maxDurationTS)),
277270
}, {
278271
Name: "SERVING_POD",
279272
ValueFrom: &corev1.EnvVarSource{

pkg/reconciler/revision/resources/queue_test.go

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -254,19 +254,6 @@ func TestMakeQueueContainer(t *testing.T) {
254254
"REVISION_TIMEOUT_SECONDS": "99",
255255
})
256256
}),
257-
}, {
258-
name: "custom maxDurationSeconds",
259-
rev: revision("bar", "foo",
260-
withContainers(containers),
261-
func(revision *v1.Revision) {
262-
revision.Spec.MaxDurationSeconds = ptr.Int64(99)
263-
},
264-
),
265-
want: queueContainer(func(c *corev1.Container) {
266-
c.Env = env(map[string]string{
267-
"MAX_DURATION_SECONDS": "99",
268-
})
269-
}),
270257
}, {
271258
name: "default resource config",
272259
rev: revision("bar", "foo",
@@ -692,8 +679,7 @@ func TestTCPProbeGeneration(t *testing.T) {
692679
SuccessThreshold: 3,
693680
},
694681
rev: v1.RevisionSpec{
695-
TimeoutSeconds: ptr.Int64(45),
696-
MaxDurationSeconds: ptr.Int64(100),
682+
TimeoutSeconds: ptr.Int64(45),
697683
PodSpec: corev1.PodSpec{
698684
Containers: []corev1.Container{{
699685
Name: servingContainerName,
@@ -733,8 +719,7 @@ func TestTCPProbeGeneration(t *testing.T) {
733719
}, {
734720
name: "tcp defaults",
735721
rev: v1.RevisionSpec{
736-
TimeoutSeconds: ptr.Int64(45),
737-
MaxDurationSeconds: ptr.Int64(100),
722+
TimeoutSeconds: ptr.Int64(45),
738723
PodSpec: corev1.PodSpec{
739724
Containers: []corev1.Container{{
740725
Name: servingContainerName,
@@ -790,8 +775,7 @@ func TestTCPProbeGeneration(t *testing.T) {
790775
InitialDelaySeconds: 3,
791776
},
792777
rev: v1.RevisionSpec{
793-
TimeoutSeconds: ptr.Int64(45),
794-
MaxDurationSeconds: ptr.Int64(100),
778+
TimeoutSeconds: ptr.Int64(45),
795779
PodSpec: corev1.PodSpec{
796780
Containers: []corev1.Container{{
797781
Name: servingContainerName,
@@ -872,7 +856,6 @@ var defaultEnv = map[string]string{
872856
"METRICS_COLLECTOR_ADDRESS": "",
873857
"QUEUE_SERVING_PORT": "8012",
874858
"REVISION_TIMEOUT_SECONDS": "45",
875-
"MAX_DURATION_SECONDS": "100",
876859
"SERVING_CONFIGURATION": "",
877860
"SERVING_ENABLE_PROBE_REQUEST_LOG": "false",
878861
"SERVING_ENABLE_REQUEST_LOG": "false",

pkg/testing/v1/service.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,6 @@ func WithRevisionTimeoutSeconds(revisionTimeoutSeconds int64) ServiceOption {
182182
}
183183
}
184184

185-
// WithMaxDurationSeconds sets revision max duration timeout
186-
func WithMaxDurationSeconds(maxDurationSeconds int64) ServiceOption {
187-
return func(service *v1.Service) {
188-
service.Spec.Template.Spec.MaxDurationSeconds = ptr.Int64(maxDurationSeconds)
189-
}
190-
}
191-
192185
// WithServiceAccountName sets revision service account name
193186
func WithServiceAccountName(serviceAccountName string) ServiceOption {
194187
return func(service *v1.Service) {

0 commit comments

Comments
 (0)