From 02f8e6c5d9c23ed809d06b3c809ebddc5e0f8e94 Mon Sep 17 00:00:00 2001 From: Hisar Balik Date: Mon, 16 Dec 2024 11:07:01 +0100 Subject: [PATCH] fix: Remove CPU Limits from all resources (#1677) --- config/manager/manager.yaml | 1 - controllers/telemetry/logpipeline_controller.go | 2 -- internal/resources/fluentbit/resources.go | 3 --- internal/resources/fluentbit/resources_test.go | 2 -- internal/resources/otelcollector/agent.go | 4 ---- internal/resources/otelcollector/gateway.go | 17 ----------------- .../otelcollector/testdata/log-gateway.yaml | 1 - .../otelcollector/testdata/metric-agent.yaml | 1 - .../testdata/metric-gateway-istio.yaml | 1 - .../otelcollector/testdata/metric-gateway.yaml | 1 - .../otelcollector/testdata/trace-gateway.yaml | 1 - internal/resources/selfmonitor/resources.go | 2 -- .../resources/selfmonitor/resources_test.go | 1 - 13 files changed, 37 deletions(-) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 794701120..d0f6ed3d4 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -58,7 +58,6 @@ spec: periodSeconds: 10 resources: limits: - cpu: 300m memory: 384Mi requests: cpu: 5m diff --git a/controllers/telemetry/logpipeline_controller.go b/controllers/telemetry/logpipeline_controller.go index c366a9346..50930ef3d 100644 --- a/controllers/telemetry/logpipeline_controller.go +++ b/controllers/telemetry/logpipeline_controller.go @@ -64,7 +64,6 @@ const ( var ( // FluentBit - fbCPULimit = resource.MustParse("1") fbMemoryLimit = resource.MustParse("1Gi") fbCPURequest = resource.MustParse("100m") fbMemoryRequest = resource.MustParse("50Mi") @@ -168,7 +167,6 @@ func configureFluentBitReconciler(client client.Client, config LogPipelineContro FluentBitImage: config.FluentBitImage, ExporterImage: config.ExporterImage, PriorityClassName: config.FluentBitPriorityClassName, - CPULimit: fbCPULimit, MemoryLimit: fbMemoryLimit, CPURequest: fbCPURequest, MemoryRequest: fbMemoryRequest, diff --git a/internal/resources/fluentbit/resources.go b/internal/resources/fluentbit/resources.go index 3867e5967..b3806f083 100644 --- a/internal/resources/fluentbit/resources.go +++ b/internal/resources/fluentbit/resources.go @@ -26,7 +26,6 @@ type DaemonSetConfig struct { FluentBitConfigPrepperImage string ExporterImage string PriorityClassName string - CPULimit resource.Quantity MemoryLimit resource.Quantity CPURequest resource.Quantity MemoryRequest resource.Quantity @@ -39,7 +38,6 @@ func MakeDaemonSet(name types.NamespacedName, checksum string, dsConfig DaemonSe corev1.ResourceMemory: dsConfig.MemoryRequest, }, Limits: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceCPU: dsConfig.CPULimit, corev1.ResourceMemory: dsConfig.MemoryLimit, }, } @@ -51,7 +49,6 @@ func MakeDaemonSet(name types.NamespacedName, checksum string, dsConfig DaemonSe corev1.ResourceMemory: resource.MustParse("5Mi"), }, Limits: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceCPU: resource.MustParse("100m"), corev1.ResourceMemory: resource.MustParse("50Mi"), }, } diff --git a/internal/resources/fluentbit/resources_test.go b/internal/resources/fluentbit/resources_test.go index b9963941f..481e60df9 100644 --- a/internal/resources/fluentbit/resources_test.go +++ b/internal/resources/fluentbit/resources_test.go @@ -19,7 +19,6 @@ func TestMakeDaemonSet(t *testing.T) { FluentBitConfigPrepperImage: "foo-configprepper", ExporterImage: "foo-exporter", PriorityClassName: "foo-prio-class", - CPULimit: resource.MustParse(".25"), MemoryLimit: resource.MustParse("400Mi"), CPURequest: resource.MustParse(".1"), MemoryRequest: resource.MustParse("100Mi"), @@ -55,7 +54,6 @@ func TestMakeDaemonSet(t *testing.T) { resources := daemonSet.Spec.Template.Spec.Containers[0].Resources require.Equal(t, ds.CPURequest, *resources.Requests.Cpu(), "cpu requests should be defined") require.Equal(t, ds.MemoryRequest, *resources.Requests.Memory(), "memory requests should be defined") - require.Equal(t, ds.CPULimit, *resources.Limits.Cpu(), "cpu limit should be defined") require.Equal(t, ds.MemoryLimit, *resources.Limits.Memory(), "memory limit should be defined") containerSecurityContext := daemonSet.Spec.Template.Spec.Containers[0].SecurityContext diff --git a/internal/resources/otelcollector/agent.go b/internal/resources/otelcollector/agent.go index 9a1f0b2b4..3d3e65f67 100644 --- a/internal/resources/otelcollector/agent.go +++ b/internal/resources/otelcollector/agent.go @@ -30,7 +30,6 @@ const ( ) var ( - metricAgentCPULimit = resource.MustParse("1") metricAgentMemoryLimit = resource.MustParse("1200Mi") metricAgentCPURequest = resource.MustParse("15m") metricAgentMemoryRequest = resource.MustParse("50Mi") @@ -49,7 +48,6 @@ func NewMetricAgentApplierDeleter(image, namespace, priorityClassName string) *A namespace: namespace, priorityClassName: priorityClassName, rbac: makeMetricAgentRBAC(namespace), - cpuLimit: metricAgentCPULimit, memoryLimit: metricAgentMemoryLimit, cpuRequest: metricAgentCPURequest, memoryRequest: metricAgentMemoryRequest, @@ -64,7 +62,6 @@ type AgentApplierDeleter struct { priorityClassName string rbac rbac - cpuLimit resource.Quantity memoryLimit resource.Quantity cpuRequest resource.Quantity memoryRequest resource.Quantity @@ -181,7 +178,6 @@ func (aad *AgentApplierDeleter) makeAgentDaemonSet(configChecksum string) *appsv func (aad *AgentApplierDeleter) makeAgentResourceRequirements() corev1.ResourceRequirements { return corev1.ResourceRequirements{ Limits: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceCPU: aad.cpuLimit, corev1.ResourceMemory: aad.memoryLimit, }, Requests: map[corev1.ResourceName]resource.Quantity{ diff --git a/internal/resources/otelcollector/gateway.go b/internal/resources/otelcollector/gateway.go index a280714f5..66324f268 100644 --- a/internal/resources/otelcollector/gateway.go +++ b/internal/resources/otelcollector/gateway.go @@ -47,8 +47,6 @@ const ( var ( // TODO(skhalash): the resource requirements are copy-pasted from the trace gateway and need to be adjusted - logGatewayBaseCPULimit = resource.MustParse("700m") - logGatewayDynamicCPULimit = resource.MustParse("500m") logGatewayBaseMemoryLimit = resource.MustParse("500Mi") logGatewayDynamicMemoryLimit = resource.MustParse("1500Mi") logGatewayBaseCPURequest = resource.MustParse("100m") @@ -56,8 +54,6 @@ var ( logGatewayBaseMemoryRequest = resource.MustParse("32Mi") logGatewayDynamicMemoryRequest = resource.MustParse("0") - metricGatewayBaseCPULimit = resource.MustParse("900m") - metricGatewayDynamicCPULimit = resource.MustParse("100m") metricGatewayBaseMemoryLimit = resource.MustParse("512Mi") metricGatewayDynamicMemoryLimit = resource.MustParse("512Mi") metricGatewayBaseCPURequest = resource.MustParse("25m") @@ -65,8 +61,6 @@ var ( metricGatewayBaseMemoryRequest = resource.MustParse("32Mi") metricGatewayDynamicMemoryRequest = resource.MustParse("0") - traceGatewayBaseCPULimit = resource.MustParse("700m") - traceGatewayDynamicCPULimit = resource.MustParse("500m") traceGatewayBaseMemoryLimit = resource.MustParse("500Mi") traceGatewayDynamicMemoryLimit = resource.MustParse("1500Mi") traceGatewayBaseCPURequest = resource.MustParse("100m") @@ -90,8 +84,6 @@ func NewLogGatewayApplierDeleter(image, namespace, priorityClassName string) *Ga otlpServiceName: LogOTLPServiceName, priorityClassName: priorityClassName, rbac: makeLogGatewayRBAC(namespace), - baseCPULimit: logGatewayBaseCPULimit, - dynamicCPULimit: logGatewayDynamicCPULimit, baseMemoryLimit: logGatewayBaseMemoryLimit, dynamicMemoryLimit: logGatewayDynamicMemoryLimit, baseCPURequest: logGatewayBaseCPURequest, @@ -116,8 +108,6 @@ func NewMetricGatewayApplierDeleter(image, namespace, priorityClassName string) otlpServiceName: MetricOTLPServiceName, priorityClassName: priorityClassName, rbac: makeMetricGatewayRBAC(namespace), - baseCPULimit: metricGatewayBaseCPULimit, - dynamicCPULimit: metricGatewayDynamicCPULimit, baseMemoryLimit: metricGatewayBaseMemoryLimit, dynamicMemoryLimit: metricGatewayDynamicMemoryLimit, baseCPURequest: metricGatewayBaseCPURequest, @@ -142,8 +132,6 @@ func NewTraceGatewayApplierDeleter(image, namespace, priorityClassName string) * otlpServiceName: TraceOTLPServiceName, priorityClassName: priorityClassName, rbac: makeTraceGatewayRBAC(namespace), - baseCPULimit: traceGatewayBaseCPULimit, - dynamicCPULimit: traceGatewayDynamicCPULimit, baseMemoryLimit: traceGatewayBaseMemoryLimit, dynamicMemoryLimit: traceGatewayDynamicMemoryLimit, baseCPURequest: traceGatewayBaseCPURequest, @@ -162,8 +150,6 @@ type GatewayApplierDeleter struct { priorityClassName string rbac rbac - baseCPULimit resource.Quantity - dynamicCPULimit resource.Quantity baseMemoryLimit resource.Quantity dynamicMemoryLimit resource.Quantity baseCPURequest resource.Quantity @@ -314,13 +300,11 @@ func (gad *GatewayApplierDeleter) makeGatewayResourceRequirements(opts GatewayAp memoryRequest := gad.baseMemoryRequest.DeepCopy() memoryLimit := gad.baseMemoryLimit.DeepCopy() cpuRequest := gad.baseCPURequest.DeepCopy() - cpuLimit := gad.baseCPULimit.DeepCopy() for range opts.ResourceRequirementsMultiplier { memoryRequest.Add(gad.dynamicMemoryRequest) memoryLimit.Add(gad.dynamicMemoryLimit) cpuRequest.Add(gad.dynamicCPURequest) - cpuLimit.Add(gad.dynamicCPULimit) } resources := corev1.ResourceRequirements{ @@ -329,7 +313,6 @@ func (gad *GatewayApplierDeleter) makeGatewayResourceRequirements(opts GatewayAp corev1.ResourceMemory: memoryRequest, }, Limits: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceCPU: cpuLimit, corev1.ResourceMemory: memoryLimit, }, } diff --git a/internal/resources/otelcollector/testdata/log-gateway.yaml b/internal/resources/otelcollector/testdata/log-gateway.yaml index 1c983cf47..4fe553d82 100644 --- a/internal/resources/otelcollector/testdata/log-gateway.yaml +++ b/internal/resources/otelcollector/testdata/log-gateway.yaml @@ -150,7 +150,6 @@ spec: port: 13133 resources: limits: - cpu: 700m memory: 500Mi requests: cpu: 100m diff --git a/internal/resources/otelcollector/testdata/metric-agent.yaml b/internal/resources/otelcollector/testdata/metric-agent.yaml index dbd43e013..21f3d27b3 100644 --- a/internal/resources/otelcollector/testdata/metric-agent.yaml +++ b/internal/resources/otelcollector/testdata/metric-agent.yaml @@ -105,7 +105,6 @@ spec: port: 13133 resources: limits: - cpu: "1" memory: 1200Mi requests: cpu: 15m diff --git a/internal/resources/otelcollector/testdata/metric-gateway-istio.yaml b/internal/resources/otelcollector/testdata/metric-gateway-istio.yaml index 2ed5ab74d..1c2067bca 100644 --- a/internal/resources/otelcollector/testdata/metric-gateway-istio.yaml +++ b/internal/resources/otelcollector/testdata/metric-gateway-istio.yaml @@ -152,7 +152,6 @@ spec: port: 13133 resources: limits: - cpu: 900m memory: 512Mi requests: cpu: 25m diff --git a/internal/resources/otelcollector/testdata/metric-gateway.yaml b/internal/resources/otelcollector/testdata/metric-gateway.yaml index 9b51a946c..fd11fb627 100644 --- a/internal/resources/otelcollector/testdata/metric-gateway.yaml +++ b/internal/resources/otelcollector/testdata/metric-gateway.yaml @@ -150,7 +150,6 @@ spec: port: 13133 resources: limits: - cpu: 900m memory: 512Mi requests: cpu: 25m diff --git a/internal/resources/otelcollector/testdata/trace-gateway.yaml b/internal/resources/otelcollector/testdata/trace-gateway.yaml index 08d7ac72b..44e851360 100644 --- a/internal/resources/otelcollector/testdata/trace-gateway.yaml +++ b/internal/resources/otelcollector/testdata/trace-gateway.yaml @@ -150,7 +150,6 @@ spec: port: 13133 resources: limits: - cpu: 700m memory: 500Mi requests: cpu: 100m diff --git a/internal/resources/selfmonitor/resources.go b/internal/resources/selfmonitor/resources.go index c9eb0ed1a..9d8f0e0de 100644 --- a/internal/resources/selfmonitor/resources.go +++ b/internal/resources/selfmonitor/resources.go @@ -34,7 +34,6 @@ var ( storageVolumeSize = resource.MustParse("1000Mi") cpuRequest = resource.MustParse("10m") memoryRequest = resource.MustParse("50Mi") - cpuLimit = resource.MustParse("200m") memoryLimit = resource.MustParse("180Mi") ) @@ -384,7 +383,6 @@ func makePodSpec(baseName, image, configPath, configFile string, opts ...commonr func makeResourceRequirements() corev1.ResourceRequirements { return corev1.ResourceRequirements{ Limits: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceCPU: cpuLimit, corev1.ResourceMemory: memoryLimit, }, Requests: map[corev1.ResourceName]resource.Quantity{ diff --git a/internal/resources/selfmonitor/resources_test.go b/internal/resources/selfmonitor/resources_test.go index 10e7ba56a..240435af2 100644 --- a/internal/resources/selfmonitor/resources_test.go +++ b/internal/resources/selfmonitor/resources_test.go @@ -182,7 +182,6 @@ func verifyDeploymentIsPreset(ctx context.Context, t *testing.T, client client.C resources := container.Resources require.True(t, cpuRequest.Equal(*resources.Requests.Cpu()), "cpu requests should be defined") require.True(t, memoryRequest.Equal(*resources.Requests.Memory()), "memory requests should be defined") - require.True(t, cpuLimit.Equal(*resources.Limits.Cpu()), "cpu limit should be defined") require.True(t, memoryLimit.Equal(*resources.Limits.Memory()), "memory limit should be defined") // security contexts