Skip to content

Commit

Permalink
fix: Remove CPU Limits from all resources (#1677)
Browse files Browse the repository at this point in the history
  • Loading branch information
hisarbalik authored Dec 16, 2024
1 parent e1eaa8e commit 02f8e6c
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 37 deletions.
1 change: 0 additions & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ spec:
periodSeconds: 10
resources:
limits:
cpu: 300m
memory: 384Mi
requests:
cpu: 5m
Expand Down
2 changes: 0 additions & 2 deletions controllers/telemetry/logpipeline_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const (

var (
// FluentBit
fbCPULimit = resource.MustParse("1")
fbMemoryLimit = resource.MustParse("1Gi")
fbCPURequest = resource.MustParse("100m")
fbMemoryRequest = resource.MustParse("50Mi")
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions internal/resources/fluentbit/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
},
}
Expand All @@ -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"),
},
}
Expand Down
2 changes: 0 additions & 2 deletions internal/resources/fluentbit/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions internal/resources/otelcollector/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const (
)

var (
metricAgentCPULimit = resource.MustParse("1")
metricAgentMemoryLimit = resource.MustParse("1200Mi")
metricAgentCPURequest = resource.MustParse("15m")
metricAgentMemoryRequest = resource.MustParse("50Mi")
Expand All @@ -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,
Expand All @@ -64,7 +62,6 @@ type AgentApplierDeleter struct {
priorityClassName string
rbac rbac

cpuLimit resource.Quantity
memoryLimit resource.Quantity
cpuRequest resource.Quantity
memoryRequest resource.Quantity
Expand Down Expand Up @@ -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{
Expand Down
17 changes: 0 additions & 17 deletions internal/resources/otelcollector/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,20 @@ 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")
logGatewayDynamicCPURequest = resource.MustParse("100m")
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")
metricGatewayDynamicCPURequest = resource.MustParse("0")
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")
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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{
Expand All @@ -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,
},
}
Expand Down
1 change: 0 additions & 1 deletion internal/resources/otelcollector/testdata/log-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ spec:
port: 13133
resources:
limits:
cpu: 700m
memory: 500Mi
requests:
cpu: 100m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ spec:
port: 13133
resources:
limits:
cpu: "1"
memory: 1200Mi
requests:
cpu: 15m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ spec:
port: 13133
resources:
limits:
cpu: 900m
memory: 512Mi
requests:
cpu: 25m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ spec:
port: 13133
resources:
limits:
cpu: 900m
memory: 512Mi
requests:
cpu: 25m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ spec:
port: 13133
resources:
limits:
cpu: 700m
memory: 500Mi
requests:
cpu: 100m
Expand Down
2 changes: 0 additions & 2 deletions internal/resources/selfmonitor/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)

Expand Down Expand Up @@ -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{
Expand Down
1 change: 0 additions & 1 deletion internal/resources/selfmonitor/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 02f8e6c

Please sign in to comment.