Skip to content

Commit

Permalink
controller/registry: don't set memory limits for target (#3015)
Browse files Browse the repository at this point in the history
It's not allowed for core components to have memory limits, to ensure
that that source of crash-looping pods does not occur to the core
payload.

Signed-off-by: Steve Kuznetsov <[email protected]>
  • Loading branch information
stevekuznetsov authored Aug 21, 2023
1 parent a827c02 commit ff0baf4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 0 additions & 3 deletions pkg/controller/registry/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ func Pod(source *operatorsv1alpha1.CatalogSource, name string, img string, saNam
if pod.Spec.Containers[0].Resources.Limits == nil {
pod.Spec.Containers[0].Resources.Limits = map[corev1.ResourceName]resource.Quantity{}
}
double := *grpcPodConfig.MemoryTarget
double.Add(double.DeepCopy())
pod.Spec.Containers[0].Resources.Limits[corev1.ResourceMemory] = double

grpcPodConfig.MemoryTarget.Format = resource.BinarySI
pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, corev1.EnvVar{
Expand Down
6 changes: 2 additions & 4 deletions pkg/controller/registry/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestPodMemoryTarget(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-",
Namespace: "testns",
Labels: map[string]string{"olm.pod-spec-hash": "855b6c6cf6"},
Labels: map[string]string{"olm.pod-spec-hash": "5c6bb6945f"},
Annotations: map[string]string{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
},
Spec: corev1.PodSpec{
Expand Down Expand Up @@ -150,9 +150,7 @@ func TestPodMemoryTarget(t *testing.T) {
corev1.ResourceCPU: resource.MustParse("10m"),
corev1.ResourceMemory: resource.MustParse("5Mi"),
},
Limits: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("10Mi"),
},
Limits: corev1.ResourceList{},
},
SecurityContext: &corev1.SecurityContext{
ReadOnlyRootFilesystem: pointer.Bool(false),
Expand Down

0 comments on commit ff0baf4

Please sign in to comment.