Skip to content

Commit

Permalink
Remove TargetAllocator resource defaults (#2040)
Browse files Browse the repository at this point in the history
* Remove TargetAllocator resource defaults

* Add changelog entry

* Update e2e test for target allocator

* trigger tests

* Add heads up for change of behaviour
  • Loading branch information
PeterSzegedi authored Sep 12, 2023
1 parent 06c5dce commit 9cf9e33
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
16 changes: 16 additions & 0 deletions .chloggen/remove_ta_defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
component: operator

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove default cpu and mem requests and limits from target allocator to match otel-collector behaviour

# One or more tracking issues related to the change
issues: [1914]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: To preserve the old behaviour for the case when the requests/limits were not explicitely set during the deployment, make sure to set the requests/limits of 100m/200m for CPU and 250Mi/500Mi for memory.
15 changes: 0 additions & 15 deletions apis/v1alpha1/opentelemetrycollector_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"fmt"

autoscalingv2 "k8s.io/api/autoscaling/v2"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -72,19 +70,6 @@ func (r *OpenTelemetryCollector) Default() {
r.Spec.TargetAllocator.Replicas = &one
}

if r.Spec.TargetAllocator.Enabled && r.Spec.TargetAllocator.Resources.Limits == nil {
r.Spec.TargetAllocator.Resources.Limits = corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("200m"),
corev1.ResourceMemory: resource.MustParse("500Mi"),
}
}
if r.Spec.TargetAllocator.Enabled && r.Spec.TargetAllocator.Resources.Requests == nil {
r.Spec.TargetAllocator.Resources.Requests = corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("100m"),
corev1.ResourceMemory: resource.MustParse("250Mi"),
}
}

if r.Spec.MaxReplicas != nil || (r.Spec.Autoscaler != nil && r.Spec.Autoscaler.MaxReplicas != nil) {
if r.Spec.Autoscaler == nil {
r.Spec.Autoscaler = &AutoscalerSpec{}
Expand Down
7 changes: 0 additions & 7 deletions tests/e2e/targetallocator-features/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
limits:
cpu: 200m
memory: 500Mi
requests:
cpu: 100m
memory: 250Mi
volumeMounts:
- mountPath: /conf
name: ta-internal
Expand Down

0 comments on commit 9cf9e33

Please sign in to comment.