Skip to content

Commit c408385

Browse files
Configure deployments to have no own revisionHistoryLimit
The revision history limit of a deployment are its replicasets. As Knative has its own concept of revisions and the way a deployment looks like for revision is defined by the revision, there is no reason to maintain a history of replicasets. Multiple replicasets can exist if Knative configuration is updated (config-deployment) or if Knative itself is updated (and the queue-proxy image changes). Having no revisionHistoryLimit on the Deployment saves a lot of space in the Kubernetes database. Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com>
1 parent c3f2bfe commit c408385

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pkg/reconciler/revision/resources/deploy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ func MakeDeployment(rev *v1.Revision, cfg *config.Config) (*appsv1.Deployment, e
388388
Replicas: ptr.Int32(replicaCount),
389389
Selector: makeSelector(rev),
390390
ProgressDeadlineSeconds: ptr.Int32(progressDeadline),
391+
RevisionHistoryLimit: ptr.Int32(0),
391392
Strategy: appsv1.DeploymentStrategy{
392393
Type: appsv1.RollingUpdateDeploymentStrategyType,
393394
RollingUpdate: &appsv1.RollingUpdateDeployment{

pkg/reconciler/revision/resources/deploy_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ var (
202202
}
203203

204204
defaultPodSpec = &corev1.PodSpec{
205-
TerminationGracePeriodSeconds: refInt64(45),
205+
TerminationGracePeriodSeconds: ptr.Int64(45),
206206
EnableServiceLinks: ptr.Bool(false),
207207
}
208208

@@ -259,6 +259,7 @@ var (
259259
},
260260
},
261261
ProgressDeadlineSeconds: ptr.Int32(0),
262+
RevisionHistoryLimit: ptr.Int32(0),
262263
Strategy: appsv1.DeploymentStrategy{
263264
Type: appsv1.RollingUpdateDeploymentStrategyType,
264265
RollingUpdate: &appsv1.RollingUpdateDeployment{
@@ -310,10 +311,6 @@ func defaultRevision() *v1.Revision {
310311
}
311312
}
312313

313-
func refInt64(num int64) *int64 {
314-
return &num
315-
}
316-
317314
type (
318315
containerOption func(*corev1.Container)
319316
podSpecOption func(*corev1.PodSpec)

0 commit comments

Comments
 (0)