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

Change Horizontal Pod Autoscaler to scale on OpenTelemetry Collector … #984

Merged
merged 5 commits into from Jul 25, 2022
Merged

Conversation

kevinearls
Copy link
Member

…object

Signed-off-by: Kevin Earls kearls@redhat.com

…object

Signed-off-by: Kevin Earls <kearls@redhat.com>
Copy link
Contributor

@yuriolisa yuriolisa left a comment

Choose a reason for hiding this comment

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

Only small code nit. LGTM.

Signed-off-by: Kevin Earls <kearls@redhat.com>
Signed-off-by: Kevin Earls <kearls@redhat.com>
@kevinearls
Copy link
Member Author

@pavolloffay Can you please review this again and then merge it if it looks ok?

Copy link
Member

@frzifus frzifus left a comment

Choose a reason for hiding this comment

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

ive a few nit-picks :)

apis/v1alpha1/opentelemetrycollector_types.go Outdated Show resolved Hide resolved
hack/install-metrics-server.sh Outdated Show resolved Hide resolved
tests/e2e/autoscale/00-install.yaml Outdated Show resolved Hide resolved
tests/e2e/autoscale/01-assert.yaml Outdated Show resolved Hide resolved
tests/e2e/autoscale/01-install.yaml Outdated Show resolved Hide resolved
pkg/collector/upgrade/v0_56_0_test.go Outdated Show resolved Hide resolved
Signed-off-by: Kevin Earls <kearls@redhat.com>
}
upgradedInstance, err := versionUpgrade.ManagedInstance(context.Background(), collectorInstance)
assert.NoError(t, err)
assert.Equal(t, one, *upgradedInstance.Spec.MinReplicas)
Copy link
Member

Choose a reason for hiding this comment

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

The test should as well assert that the HPA object was changed accordingly.

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'm not sure if this is possible as upgrade get the HPA by calling the k8sclient. It's not in the object that is passed in:

https://jenkins-cpaas-distributed-tracing.apps.cpaas-poc.r6c9.p1.openshiftapps.com/

Copy link
Member

Choose a reason for hiding this comment

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

It should be possible the test can access the k8sClient and create the objects before running the upgrade procedure.

patch := client.MergeFrom(&existing)
err := u.Client.Patch(ctx, updated, patch)
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

We could continue on an error and then return a multierror at the end wrapped with a message that the upgrade of HPA was not successful.

Either way the upgrade will have to be restarted or done manually.

}
}

u.Log.Info("in upgrade0_56_0", "Otel Instance", otelcol.Name, "Upgrade version", u.Version.String())
Copy link
Member

Choose a reason for hiding this comment

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

IIRC the other upgrade procedures use event API to record the "log" messages for the user.

hpaList := &autoscalingv1.HorizontalPodAutoscalerList{}
ctx := context.Background()
if err := u.Client.List(ctx, hpaList, listOptions...); err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

We should wrap the error to make it clear what operation failed

Signed-off-by: Kevin Earls <kearls@redhat.com>
Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

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

I am merging this to unblock 0.56 release.

Consider improving the upgrade test in a follow up PR.

}
upgradedInstance, err := versionUpgrade.ManagedInstance(context.Background(), collectorInstance)
assert.NoError(t, err)
assert.Equal(t, one, *upgradedInstance.Spec.MinReplicas)
Copy link
Member

Choose a reason for hiding this comment

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

It should be possible the test can access the k8sClient and create the objects before running the upgrade procedure.

@pavolloffay pavolloffay merged commit 0232b80 into open-telemetry:main Jul 25, 2022
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
open-telemetry#984)

* Change Horizontal Pod Autoscaler to scale on OpenTelemetry Collector object

Signed-off-by: Kevin Earls <kearls@redhat.com>

* Update doc; move upgrade code out of reconciler

Signed-off-by: Kevin Earls <kearls@redhat.com>

* Fixed doc

Signed-off-by: Kevin Earls <kearls@redhat.com>

* Respond to comments, implement test

Signed-off-by: Kevin Earls <kearls@redhat.com>

* respond to comments

Signed-off-by: Kevin Earls <kearls@redhat.com>
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.

None yet

4 participants