Skip to content

Commit

Permalink
feat: add resource limit and request for csiResizer
Browse files Browse the repository at this point in the history
adding Container Resource Request and limit
for the csiResizer container.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
  • Loading branch information
Madhu-1 committed Apr 20, 2022
1 parent 4bb8d1d commit 56a3568
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ var (
TopolvmCsiProvisionerCPURequest = "100m"
TopolvmCsiProvisionerCPULimit = "100m"

TopolvmCsiResizerMemRequest = "100Mi"
TopolvmCsiResizerMemLimit = "100Mi"
TopolvmCsiResizerCPURequest = "100m"
TopolvmCsiResizerCPULimit = "100m"

// CSI Provisioner requires below environment values to make use of CSIStorageCapacity
PodNameEnv = "POD_NAME"
NameSpaceEnv = "NAMESPACE"
Expand Down
12 changes: 12 additions & 0 deletions controllers/topolvm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,22 @@ func getCsiResizerContainer() *corev1.Container {
{Name: "socket-dir", MountPath: filepath.Dir(DefaultCSISocket)},
}

resourceRequirements := corev1.ResourceRequirements{
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse(TopolvmCsiResizerCPULimit),
corev1.ResourceMemory: resource.MustParse(TopolvmCsiResizerMemLimit),
},
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse(TopolvmCsiResizerCPURequest),
corev1.ResourceMemory: resource.MustParse(TopolvmCsiResizerMemRequest),
},
}

csiResizer := &corev1.Container{
Name: CsiResizerContainerName,
Image: CsiResizerImage,
Args: args,
Resources: resourceRequirements,
VolumeMounts: volumeMounts,
}
return csiResizer
Expand Down

0 comments on commit 56a3568

Please sign in to comment.