Repository: knative-sandbox/eventing-rabbitmq (go)

Issue:
Eventing-RabbitMQ sets high CPU requests for dispatchers and is not configurable
Hi folks,
was unsure whether to classify this as bug or feature requests. Sits somewhere in the middle imho...

**Describe the bug**
I just updated to eventing-rabbitMQ 1.5 and needed to downgrade again to 1.4 because suddenly the dispatcher instances request 300mCPU, which is way too much for our dev cluster (and prod as well).

 **Expected behavior**
CPU requests are configurable.

 **To Reproduce**
Install with default configuration.

 **Knative release version**
1.5

 **Additional context**
I do understand the values come from a load test, and also do understand that those may be good defaults, but in the end we can't afford to pay that much for development instances that don't really need those requests. It would be really nice to be able to just set a low request and live with the performance impact then.
I'd really love to update to 1.5 as well because our default-broker looses connections to rabbitmq pretty reliably (we're running DEV on preemptible nodes and hit the problem about once a day ;) ) and there have been fixes for those issues on 1.5. It's a kind of a dilemma - upgrading is problematic for other reasons than not upgrading :D.

Cheers, and keep up the good work :-)!

Pull request description:
Decreasing dispatcher and adapter resource cpu requests
<!-- Thanks for sending a pull request! -->

# Changes

<!-- 
Describe your changes here- ideally you can get that description straight from
your descriptive commit message(s)! 

- :gift: Add new feature
- :bug: Fix bug
- :broom: Update or clean up current behavior
- :wastebasket: Remove feature or internal logic
-->

- Decreased Receive adapter and dispatcher resource cpu requests
<!--
In addition, categorize the changes you're making using the "/kind" Prow command, example:

/kind <kind>

Supported kinds are: api-change, bug, cleanup, deprecation, removal, documentation, enhancement, performance

-->
/kind bug

<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #813

<!-- Please include the 'why' behind your changes if no issue exists -->


Patch:
diff --git a/pkg/reconciler/broker/resources/dispatcher.go b/pkg/reconciler/broker/resources/dispatcher.go
index caabac92..0d9fbfb6 100644
--- a/pkg/reconciler/broker/resources/dispatcher.go
+++ b/pkg/reconciler/broker/resources/dispatcher.go
@@ -151,7 +151,7 @@ func MakeDispatcherDeployment(args *DispatcherArgs) *appsv1.Deployment {
 						// more info in this issue: https://github.com/knative-sandbox/eventing-rabbitmq/issues/703
 						Resources: corev1.ResourceRequirements{
 							Requests: corev1.ResourceList{
-								corev1.ResourceCPU:    resource.MustParse("300m"),
+								corev1.ResourceCPU:    resource.MustParse("50m"),
 								corev1.ResourceMemory: resource.MustParse("64Mi")},
 							Limits: corev1.ResourceList{
 								corev1.ResourceCPU:    resource.MustParse("4000m"),
diff --git a/pkg/reconciler/broker/resources/ingress.go b/pkg/reconciler/broker/resources/ingress.go
index 6d40b4f8..474bf26b 100644
--- a/pkg/reconciler/broker/resources/ingress.go
+++ b/pkg/reconciler/broker/resources/ingress.go
@@ -125,7 +125,7 @@ func MakeIngressDeployment(args *IngressArgs) *appsv1.Deployment {
 						// more info in this issue: https://github.com/knative-sandbox/eventing-rabbitmq/issues/703
 						Resources: corev1.ResourceRequirements{
 							Requests: corev1.ResourceList{
-								corev1.ResourceCPU:    resource.MustParse("150m"),
+								corev1.ResourceCPU:    resource.MustParse("50m"),
 								corev1.ResourceMemory: resource.MustParse("32Mi")},
 							Limits: corev1.ResourceList{
 								corev1.ResourceCPU:    resource.MustParse("1000m"),
diff --git a/pkg/reconciler/source/resources/receive_adapter.go b/pkg/reconciler/source/resources/receive_adapter.go
index b60b53b5..eeacd4e8 100644
--- a/pkg/reconciler/source/resources/receive_adapter.go
+++ b/pkg/reconciler/source/resources/receive_adapter.go
@@ -166,7 +166,7 @@ func MakeReceiveAdapter(args *ReceiveAdapterArgs) *v1.Deployment {
 							// more info in this issue: https://github.com/knative-sandbox/eventing-rabbitmq/issues/703
 							Resources: corev1.ResourceRequirements{
 								Requests: corev1.ResourceList{
-									corev1.ResourceCPU:    resource.MustParse("300m"),
+									corev1.ResourceCPU:    resource.MustParse("50m"),
 									corev1.ResourceMemory: resource.MustParse("64Mi")},
 								Limits: corev1.ResourceList{
 									corev1.ResourceCPU:    resource.MustParse("4000m"),
diff --git a/pkg/reconciler/trigger/resources/dispatcher.go b/pkg/reconciler/trigger/resources/dispatcher.go
index e1bac858..7479c701 100644
--- a/pkg/reconciler/trigger/resources/dispatcher.go
+++ b/pkg/reconciler/trigger/resources/dispatcher.go
@@ -96,7 +96,7 @@ func MakeDispatcherDeployment(args *DispatcherArgs) *appsv1.Deployment {
 		// more info in this issue: https://github.com/knative-sandbox/eventing-rabbitmq/issues/703
 		Resources: corev1.ResourceRequirements{
 			Requests: corev1.ResourceList{
-				corev1.ResourceCPU:    resource.MustParse("300m"),
+				corev1.ResourceCPU:    resource.MustParse("50m"),
 				corev1.ResourceMemory: resource.MustParse("64Mi")},
 			Limits: corev1.ResourceList{
 				corev1.ResourceCPU:    resource.MustParse("4000m"),


Test patch:
diff --git a/pkg/reconciler/broker/resources/dispatcher_test.go b/pkg/reconciler/broker/resources/dispatcher_test.go
index c98f4400..725ed97d 100644
--- a/pkg/reconciler/broker/resources/dispatcher_test.go
+++ b/pkg/reconciler/broker/resources/dispatcher_test.go
@@ -108,7 +108,7 @@ func TestMakeDispatcherDeployment(t *testing.T) {
 						Image: image,
 						Resources: corev1.ResourceRequirements{
 							Requests: corev1.ResourceList{
-								corev1.ResourceCPU:    resource.MustParse("300m"),
+								corev1.ResourceCPU:    resource.MustParse("50m"),
 								corev1.ResourceMemory: resource.MustParse("64Mi")},
 							Limits: corev1.ResourceList{
 								corev1.ResourceCPU:    resource.MustParse("4000m"),
diff --git a/pkg/reconciler/broker/resources/ingress_test.go b/pkg/reconciler/broker/resources/ingress_test.go
index c16bce3a..c96c85d8 100644
--- a/pkg/reconciler/broker/resources/ingress_test.go
+++ b/pkg/reconciler/broker/resources/ingress_test.go
@@ -85,7 +85,7 @@ func TestMakeIngressDeployment(t *testing.T) {
 						Name:  "ingress",
 						Resources: corev1.ResourceRequirements{
 							Requests: corev1.ResourceList{
-								corev1.ResourceCPU:    resource.MustParse("150m"),
+								corev1.ResourceCPU:    resource.MustParse("50m"),
 								corev1.ResourceMemory: resource.MustParse("32Mi")},
 							Limits: corev1.ResourceList{
 								corev1.ResourceCPU:    resource.MustParse("1000m"),
diff --git a/pkg/reconciler/source/resources/receive_adapter_test.go b/pkg/reconciler/source/resources/receive_adapter_test.go
index 2133affd..343ecee9 100644
--- a/pkg/reconciler/source/resources/receive_adapter_test.go
+++ b/pkg/reconciler/source/resources/receive_adapter_test.go
@@ -150,7 +150,7 @@ func TestMakeReceiveAdapter(t *testing.T) {
 									ImagePullPolicy: "IfNotPresent",
 									Resources: corev1.ResourceRequirements{
 										Requests: corev1.ResourceList{
-											corev1.ResourceCPU:    resource.MustParse("300m"),
+											corev1.ResourceCPU:    resource.MustParse("50m"),
 											corev1.ResourceMemory: resource.MustParse("64Mi")},
 										Limits: corev1.ResourceList{
 											corev1.ResourceCPU:    resource.MustParse("4000m"),
diff --git a/pkg/reconciler/trigger/resources/dispatcher_test.go b/pkg/reconciler/trigger/resources/dispatcher_test.go
index ea7c550a..513ea4b2 100644
--- a/pkg/reconciler/trigger/resources/dispatcher_test.go
+++ b/pkg/reconciler/trigger/resources/dispatcher_test.go
@@ -139,7 +139,7 @@ func deployment(opts ...func(*appsv1.Deployment)) *appsv1.Deployment {
 						Image: image,
 						Resources: corev1.ResourceRequirements{
 							Requests: corev1.ResourceList{
-								corev1.ResourceCPU:    resource.MustParse("300m"),
+								corev1.ResourceCPU:    resource.MustParse("50m"),
 								corev1.ResourceMemory: resource.MustParse("64Mi")},
 							Limits: corev1.ResourceList{
 								corev1.ResourceCPU:    resource.MustParse("4000m"),