Skip to content

Commit

Permalink
Configure deployments to have no own revisionHistoryLimit
Browse files Browse the repository at this point in the history
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.

Co-authored-by: Subhasree Das <[email protected]>
Signed-off-by: Sascha Schwarze <[email protected]>
  • Loading branch information
SaschaSchwarze0 and subha-91 committed Jan 16, 2025
1 parent c3f2bfe commit 280b048
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions pkg/reconciler/revision/resources/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ func MakeDeployment(rev *v1.Revision, cfg *config.Config) (*appsv1.Deployment, e
Replicas: ptr.Int32(replicaCount),
Selector: makeSelector(rev),
ProgressDeadlineSeconds: ptr.Int32(progressDeadline),
RevisionHistoryLimit: ptr.Int32(0),
Strategy: appsv1.DeploymentStrategy{
Type: appsv1.RollingUpdateDeploymentStrategyType,
RollingUpdate: &appsv1.RollingUpdateDeployment{
Expand Down
7 changes: 2 additions & 5 deletions pkg/reconciler/revision/resources/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ var (
}

defaultPodSpec = &corev1.PodSpec{
TerminationGracePeriodSeconds: refInt64(45),
TerminationGracePeriodSeconds: ptr.Int64(45),
EnableServiceLinks: ptr.Bool(false),
}

Expand Down Expand Up @@ -259,6 +259,7 @@ var (
},
},
ProgressDeadlineSeconds: ptr.Int32(0),
RevisionHistoryLimit: ptr.Int32(0),
Strategy: appsv1.DeploymentStrategy{
Type: appsv1.RollingUpdateDeploymentStrategyType,
RollingUpdate: &appsv1.RollingUpdateDeployment{
Expand Down Expand Up @@ -310,10 +311,6 @@ func defaultRevision() *v1.Revision {
}
}

func refInt64(num int64) *int64 {
return &num
}

type (
containerOption func(*corev1.Container)
podSpecOption func(*corev1.PodSpec)
Expand Down

0 comments on commit 280b048

Please sign in to comment.