Skip to content

Commit

Permalink
fix(mount): add default emptydir size
Browse files Browse the repository at this point in the history
Closes #5752
  • Loading branch information
squakez committed Sep 5, 2024
1 parent 03ed0d6 commit 1636588
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/trait/trait_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

serving "knative.dev/serving/pkg/apis/serving/v1"
Expand Down Expand Up @@ -595,7 +596,13 @@ func getVolume(volName, storageType, storageName, filterKey, filterValue string)
ClaimName: storageName,
}
case emptyDirStorageType:
volume.VolumeSource.EmptyDir = &corev1.EmptyDirVolumeSource{}
size, err := resource.ParseQuantity("1Gi")
if err != nil {
log.WithValues("Function", "trait.getVolume").Errorf(err, "could not parse empty dir quantity, skipping")
}
volume.VolumeSource.EmptyDir = &corev1.EmptyDirVolumeSource{
SizeLimit: &size,
}
}

return &volume
Expand Down

0 comments on commit 1636588

Please sign in to comment.