Skip to content

Commit ae7cb2d

Browse files
committed
put resource limitations back in in
Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>
1 parent 9ea88f5 commit ae7cb2d

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

controllers/statefulset.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,29 @@ func (r *IpfsClusterReconciler) statefulSet(m *clusterv1alpha1.IpfsCluster,
7373
// biggest node we would allocate would request a minimum allocation of 16G of RAM and 12 cores
7474
// and would permit usage up to twice this size
7575

76-
// ipfsStoragei64, _ := m.Spec.IpfsStorage.AsInt64()
77-
// ipfsStorageTB := ipfsStoragei64 / 1024 / 1024 / 1024 / 1024
78-
// ipfsMilliCoresMin := 4000 + (500 * ipfsStorageTB)
79-
// ipfsRAMGBMin := ipfsStorageTB
80-
// if ipfsRAMGBMin < 2 {
81-
// ipfsRAMGBMin = 2
82-
// }
76+
ipfsStoragei64, _ := m.Spec.IpfsStorage.AsInt64()
77+
ipfsStorageTB := ipfsStoragei64 / 1024 / 1024 / 1024 / 1024
78+
ipfsMilliCoresMin := 4000 + (500 * ipfsStorageTB)
79+
ipfsRAMGBMin := ipfsStorageTB
80+
if ipfsRAMGBMin < 2 {
81+
ipfsRAMGBMin = 2
82+
}
8383

84-
// ipfsRAMMinQuantity := resource.NewScaledQuantity(ipfsRAMGBMin, resource.Giga)
85-
// ipfsRAMMaxQuantity := resource.NewScaledQuantity(2*ipfsRAMGBMin, resource.Giga)
86-
// ipfsCoresMinQuantity := resource.NewScaledQuantity(ipfsMilliCoresMin, resource.Milli)
87-
// ipfsCoresMaxQuantity := resource.NewScaledQuantity(2*ipfsMilliCoresMin, resource.Milli)
84+
ipfsRAMMinQuantity := resource.NewScaledQuantity(ipfsRAMGBMin, resource.Giga)
85+
ipfsRAMMaxQuantity := resource.NewScaledQuantity(2*ipfsRAMGBMin, resource.Giga)
86+
ipfsCoresMinQuantity := resource.NewScaledQuantity(ipfsMilliCoresMin, resource.Milli)
87+
ipfsCoresMaxQuantity := resource.NewScaledQuantity(2*ipfsMilliCoresMin, resource.Milli)
8888

89-
// ipfsResources := corev1.ResourceRequirements{
90-
// Requests: corev1.ResourceList{
91-
// corev1.ResourceMemory: *ipfsRAMMinQuantity,
92-
// corev1.ResourceCPU: *ipfsCoresMinQuantity,
93-
// },
94-
// Limits: corev1.ResourceList{
95-
// corev1.ResourceMemory: *ipfsRAMMaxQuantity,
96-
// corev1.ResourceCPU: *ipfsCoresMaxQuantity,
97-
// },
98-
// }
89+
ipfsResources := corev1.ResourceRequirements{
90+
Requests: corev1.ResourceList{
91+
corev1.ResourceMemory: *ipfsRAMMinQuantity,
92+
corev1.ResourceCPU: *ipfsCoresMinQuantity,
93+
},
94+
Limits: corev1.ResourceList{
95+
corev1.ResourceMemory: *ipfsRAMMaxQuantity,
96+
corev1.ResourceCPU: *ipfsCoresMaxQuantity,
97+
},
98+
}
9999

100100
expected := &appsv1.StatefulSet{
101101
ObjectMeta: metav1.ObjectMeta{
@@ -195,7 +195,7 @@ func (r *IpfsClusterReconciler) statefulSet(m *clusterv1alpha1.IpfsCluster,
195195
MountPath: ipfsMountPath,
196196
},
197197
},
198-
Resources: corev1.ResourceRequirements{},
198+
Resources: ipfsResources,
199199
},
200200
{
201201
Name: "ipfs-cluster",

0 commit comments

Comments
 (0)