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

Refactored fallback logic to only patch status when the fallback is e… #5659

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

bharathguvvala
Copy link

…nabled

This change ensures that the update health status of the scaledObjects is only updated when the fallback configuration is enabled on the scaledobject. Further optimizations to avoid redundant updates when the status doesn't change can be done later. Tests will be added, if the change is ratified by the maintainers.

Checklist

Fixes #5624

…nabled

Signed-off-by: Bharath Guvvala <bharath.raghavendra@gmail.com>
@bharathguvvala bharathguvvala requested a review from a team as a code owner April 3, 2024 07:31
Signed-off-by: Bharath Guvvala <bharath.raghavendra@gmail.com>
Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

LGTM! Could you update the changelog linking the fixed issue? I think that improvements can be the better fit considering that this will improve the performance.
@zroubalik @dttung2905 PTAL if you have time :)

@JorTurFer
Copy link
Member

JorTurFer commented Apr 7, 2024

/run-e2e
Update: You can check the progress here

@JorTurFer
Copy link
Member

@bharathguvvala , could you check the failing CI checks? I think that unit tests probably need to be updated as they expect the call to patch

@zroubalik zroubalik self-requested a review April 10, 2024 17:02
Signed-off-by: Bharath Guvvala <bharath.raghavendra@gmail.com>
Signed-off-by: Bharath Guvvala <bharath.raghavendra@gmail.com>
@@ -67,7 +67,7 @@ var _ = Describe("fallback", func() {
primeGetMetrics(scaler, expectedMetricValue)
so := buildScaledObject(nil, nil)
metricSpec := createMetricSpec(3)
expectStatusPatch(ctrl, client)
//expectStatusPatch(ctrl, client)
Copy link
Member

Choose a reason for hiding this comment

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

If this isn't required, can we remove the code? it's confusing for new folks

Copy link
Author

Choose a reason for hiding this comment

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

Sorry about the latest changes, I am testing out the fixes made to the tests. These will be removed in the final version.

Copy link
Author

Choose a reason for hiding this comment

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

Somehow these fixes are working locally and CI is breaking. Give me sometime to fix this.

Copy link
Member

Choose a reason for hiding this comment

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

sure, no worries xD
I thought that it was ready to review, but if you are working on it, just let me know when it's ready 😄

@@ -114,7 +114,7 @@ var _ = Describe("fallback", func() {

so := buildScaledObject(nil, nil)
metricSpec := createMetricSpec(3)
expectStatusPatch(ctrl, client)
//expectStatusPatch(ctrl, client)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

Comment on lines +133 to +134
//mockClient.EXPECT().Status().Return(mockStatusWriter)
//mockStatusWriter.EXPECT().Patch(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@@ -153,7 +153,7 @@ func TestGetScaledObjectMetrics_FromCache(t *testing.T) {
recorder := record.NewFakeRecorder(1)
mockClient := mock_client.NewMockClient(ctrl)
mockExecutor := mock_executor.NewMockScaleExecutor(ctrl)
mockStatusWriter := mock_client.NewMockStatusWriter(ctrl)
//mockStatusWriter := mock_client.NewMockStatusWriter(ctrl)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

Comment on lines +224 to +225
//mockClient.EXPECT().Status().Return(mockStatusWriter)
//mockStatusWriter.EXPECT().Patch(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@@ -259,7 +259,7 @@ func TestGetScaledObjectMetrics_InParallel(t *testing.T) {
recorder := record.NewFakeRecorder(1)
mockClient := mock_client.NewMockClient(ctrl)
mockExecutor := mock_executor.NewMockScaleExecutor(ctrl)
mockStatusWriter := mock_client.NewMockStatusWriter(ctrl)
//mockStatusWriter := mock_client.NewMockStatusWriter(ctrl)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

Comment on lines +356 to +357
//mockClient.EXPECT().Status().Times(len(metricNames)).Return(mockStatusWriter)
//mockStatusWriter.EXPECT().Patch(gomock.Any(), gomock.Any(), gomock.Any()).Times(len(metricNames)).Return(nil)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@@ -907,7 +907,7 @@ func TestScalingModifiersFormula(t *testing.T) {
recorder := record.NewFakeRecorder(1)
mockClient := mock_client.NewMockClient(ctrl)
mockExecutor := mock_executor.NewMockScaleExecutor(ctrl)
mockStatusWriter := mock_client.NewMockStatusWriter(ctrl)
//mockStatusWriter := mock_client.NewMockStatusWriter(ctrl)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

Comment on lines +1001 to +1002
//mockClient.EXPECT().Status().Return(mockStatusWriter).Times(2)
//mockStatusWriter.EXPECT().Patch(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(2)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

Signed-off-by: Bharath Guvvala <bharath.raghavendra@gmail.com>
Signed-off-by: Bharath Guvvala <bharath.raghavendra@gmail.com>
Signed-off-by: Bharath Guvvala <bharath.raghavendra@gmail.com>
Signed-off-by: Bharath Guvvala <bharath.raghavendra@gmail.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.

Colocating metrics provider along with the operator causes HPA delays if not configured properly
3 participants