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

Expose Horizontal Pod Autoscaler Behavior and add hpa scaledown test #1077

Merged
merged 17 commits into from
Sep 15, 2022

Conversation

kevinearls
Copy link
Member

No description provided.

Signed-off-by: Kevin Earls <[email protected]>
@kevinearls kevinearls requested a review from a team September 6, 2022 09:41
// for the OpenTelemetryCollector workload.
//
// +optional
Autoscaler *AutoscalerSpec `json:"autoscaler,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: did we consider embedding the HPA spec in here? Or at least embed the autoscaling behavior spec here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just adding enough code to be able to get an e2e test to work within the time allocated, which means we need to scale down much quicker that the default 300 seconds.

@pavolloffay what do you think? Do I need to add the other values of PA scaling rules here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my use case, I know that I would like to be able to specify policies and not just StabilizationWindowSeconds. Embedding only StabilizationWindowSeconds is going to make it so we need to add in each feature on request, making a code change for each one.

@@ -129,6 +129,15 @@ func (r *OpenTelemetryCollector) validateCRDSpec() error {
return fmt.Errorf("the OpenTelemetry Spec autoscale configuration is incorrect, minReplicas should be one or more")
}

if r.Spec.Autoscaler != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also check that min or max replicas is set in order to use this feature

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's inside an if statement that's checking whether maxReplicas is set.

@@ -13,4 +13,7 @@ metadata:
spec:
minReplicas: 1
maxReplicas: 2
# This is not neccesarily exact. We really just want to wait until this is no longer <unknown>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really good "hack"

Signed-off-by: Kevin Earls <[email protected]>
Signed-off-by: Kevin Earls <[email protected]>
@pavolloffay
Copy link
Member

Does this resolve #942 ?

@kevinearls
Copy link
Member Author

@pavolloffay Yes

@kevinearls kevinearls changed the title Add hpa scaledown test Expose Horizontal Pod Autoscaler Behavior and add hpa scaledown test Sep 15, 2022
@pavolloffay pavolloffay merged commit 50592cc into open-telemetry:main Sep 15, 2022
@kevinearls kevinearls deleted the add-hpa-scaledown-test branch September 15, 2022 16:44
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
…pen-telemetry#1077)

* Add scaledown test for autoscaling

Signed-off-by: Kevin Earls <[email protected]>

* Fix nits

Signed-off-by: Kevin Earls <[email protected]>

* Appease the linter

Signed-off-by: Kevin Earls <[email protected]>

* Don't use a default, only set scaleUp/scaleDown if they are in the CR

Signed-off-by: Kevin Earls <[email protected]>

* Removed commented out code

Signed-off-by: Kevin Earls <[email protected]>

* Change defaults for scaleUp/scaleDown

Signed-off-by: Kevin Earls <[email protected]>

* Update autoscaling scaleup/scaledown

Signed-off-by: Kevin Earls <[email protected]>

* Run generate

Signed-off-by: Kevin Earls <[email protected]>

* Ran make api-docs

Signed-off-by: Kevin Earls <[email protected]>

* Update HPA implementation to embed HorizontalPodAutoscalerBehavior

Signed-off-by: Kevin Earls <[email protected]>

* Only set behavior if it exists in the collector CR

Signed-off-by: Kevin Earls <[email protected]>

* Aded some unit tests

Signed-off-by: Kevin Earls <[email protected]>

* Add kuttl assertion that hpa scaled down

Signed-off-by: Kevin Earls <[email protected]>

* added whitespace to rerun tests

Signed-off-by: Kevin Earls <[email protected]>

Signed-off-by: Kevin Earls <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants