Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Otel Controller - Auxiliares resources deletion #2575

Merged
merged 31 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5a31481
Fixed HPA deletion
yuriolisa Jan 29, 2024
bd9bd93
Fix e2e tests
yuriolisa Jan 29, 2024
10f82b0
Added reconciliation test
yuriolisa Feb 12, 2024
515a034
Changed from client.Object to HPA Obj
yuriolisa Feb 12, 2024
2ac2af7
Added owned objects function
yuriolisa Feb 12, 2024
a61de02
Fixed controller test
yuriolisa Feb 13, 2024
20c7bf6
Fixed controller test
yuriolisa Feb 13, 2024
29135cd
Fixed controller test
yuriolisa Feb 13, 2024
8f6159c
Add PodDisruptionBudget
yuriolisa Feb 14, 2024
dacc99a
Add PodDisruptionBudget
yuriolisa Feb 15, 2024
a0a30da
Change vars setting
yuriolisa Feb 16, 2024
1edd721
Change vars setting
yuriolisa Feb 16, 2024
29ad837
Change vars setting
yuriolisa Feb 19, 2024
2f1b576
Update e2e tests to chainsaw
yuriolisa Feb 20, 2024
9a669d0
Added ingress e2e tests
yuriolisa Feb 21, 2024
ebbb447
Added Volumes, changed function's place
yuriolisa Feb 26, 2024
55240ba
Added Volumes, changed function's place
yuriolisa Feb 26, 2024
4350a56
Added Volumes, changed function's place
yuriolisa Feb 27, 2024
1839504
Fixed Suite Test
yuriolisa Feb 27, 2024
88b30ef
Added RBAC for Volumes
yuriolisa Feb 27, 2024
7e1b010
Added RBAC for Volumes
yuriolisa Feb 27, 2024
18c8385
Fixed Suite Test
yuriolisa Feb 27, 2024
3e77e72
Fixed Suite Test
yuriolisa Feb 27, 2024
8bd21d5
Fixed Suite Test
yuriolisa Feb 27, 2024
2087366
Add a sleep
jaronoff97 Feb 27, 2024
d2a0269
Merge pull request #1 from jaronoff97/fix-hpa-delete
yuriolisa Feb 28, 2024
7d09dd0
Fixed Chainsaw test
yuriolisa Feb 28, 2024
42469b4
Fixed Chainsaw test
yuriolisa Feb 28, 2024
8af8038
Fixed Chainsaw test
yuriolisa Feb 28, 2024
1ffc7eb
Fixed Chainsaw test
yuriolisa Feb 28, 2024
ba7c3b2
Fixed Chainsaw test
yuriolisa Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .chloggen/fix-hpa-delete.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: 'bug_fix'

# 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: Fixed HPA deletion

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

# (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:
5 changes: 2 additions & 3 deletions internal/manifests/collector/horizontalpodautoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ import (
autoscalingv2 "k8s.io/api/autoscaling/v2"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
"github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils"
"github.com/open-telemetry/opentelemetry-operator/internal/naming"
)

func HorizontalPodAutoscaler(params manifests.Params) client.Object {
func HorizontalPodAutoscaler(params manifests.Params) *autoscalingv2.HorizontalPodAutoscaler {
yuriolisa marked this conversation as resolved.
Show resolved Hide resolved
name := naming.Collector(params.OtelCol.Name)
labels := manifestutils.Labels(params.OtelCol.ObjectMeta, name, params.OtelCol.Spec.Image, ComponentOpenTelemetryCollector, params.Config.LabelsFilter())
annotations := Annotations(params.OtelCol)
var result client.Object
var result *autoscalingv2.HorizontalPodAutoscaler

objectMeta := metav1.ObjectMeta{
Name: naming.HorizontalPodAutoscaler(params.OtelCol.Name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"testing"

"github.com/stretchr/testify/assert"
autoscalingv2 "k8s.io/api/autoscaling/v2"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Expand Down Expand Up @@ -78,9 +77,7 @@ func TestHPA(t *testing.T) {
OtelCol: otelcol,
Log: logger,
}
raw := HorizontalPodAutoscaler(params)

hpa := raw.(*autoscalingv2.HorizontalPodAutoscaler)
hpa := HorizontalPodAutoscaler(params)

// verify
assert.Equal(t, "my-instance-collector", hpa.Name)
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e-autoscale/autoscale/04-delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kuttl.dev/v1beta1
yuriolisa marked this conversation as resolved.
Show resolved Hide resolved
kind: TestStep
delete:
- apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: simplest
- apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: simplest-set-utilization
28 changes: 28 additions & 0 deletions tests/e2e-autoscale/autoscale/04-error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
jaronoff97 marked this conversation as resolved.
Show resolved Hide resolved
metadata:
name: simplest-collector
spec:
maxReplicas: 2
scaleTargetRef:
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
name: simplest
status:
currentMetrics: null
currentReplicas: 1
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: simplest-set-utilization-collector
spec:
maxReplicas: 2
scaleTargetRef:
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
name: simplest-set-utilization
status:
currentMetrics: null
currentReplicas: 1
Loading