Skip to content

Commit

Permalink
handle type change
Browse files Browse the repository at this point in the history
  • Loading branch information
vimystic committed Dec 3, 2024
1 parent bca58c9 commit 1ee6458
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions internal/fullnode/pvc_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ func pvcResources(
name string,
dataSource *dataSource,
existingSize resource.Quantity,
) corev1.ResourceRequirements {
var reqs = crd.Spec.VolumeClaimTemplate.Resources.DeepCopy()
) corev1.VolumeResourceRequirements {
reqs := crd.Spec.VolumeClaimTemplate.Resources.DeepCopy()

if dataSource != nil {
reqs.Requests[corev1.ResourceStorage] = dataSource.size
return *reqs
return corev1.VolumeResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: dataSource.size,
},
}
}

if autoScale := crd.Status.SelfHealing.PVCAutoScale; autoScale != nil {
Expand All @@ -127,5 +130,8 @@ func pvcResources(
reqs.Requests[corev1.ResourceStorage] = existingSize
}

return *reqs
return corev1.VolumeResourceRequirements{
Requests: reqs.Requests,
Limits: reqs.Limits,
}
}
2 changes: 1 addition & 1 deletion internal/statefuljob/pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func BuildPVCs(crd *cosmosalpha.StatefulJob, vs *snapshotv1.VolumeSnapshot) ([]*
Kind: vs.Kind,
Name: vs.Name,
},
Resources: corev1.ResourceRequirements{
Resources: corev1.VolumeResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceStorage: storage},
},
},
Expand Down

0 comments on commit 1ee6458

Please sign in to comment.