-
Notifications
You must be signed in to change notification settings - Fork 199
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
Handle the case when the request to CC /state endpoint returns the async task instead of the result #974
Handle the case when the request to CC /state endpoint returns the async task instead of the result #974
Conversation
a4b68c1
to
9cb5644
Compare
Hey @bartam1, thank you for your review! I will be in vacation for a week, so I will not be responsive during this time. |
New api tag has been created: https://github.com/banzaicloud/koperator/tree/api/v0.28.1 |
a53d75b
to
aae0bd7
Compare
Thank you, @bartam1! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation LGTM.
Just one question (I might be nit-picking here):
I found the naming of this OperationStatus CruiseControlTaskOperation = "status"
in #975 is a bit misleading: the CruiseControlTaskOperation
type was created to represent the actual CC operation. So when I saw OperationStatus CruiseControlTaskOperation = "status"
, I would assume there is an actual CC operation called "status", but I checked the CC wiki and source code and I couldn't really find such an operation.
But this could be due to my limited knowledge on cruise control
Hi @panyuenlau, there is the CC GET I used the Line 28 in d00b18c
I don't know the reason why it's |
@aguzovatii Thank you for the explanation behind this! I think it is fine in terms of this PR. We will refactor the naming in a separate PR if our team decide to go that way. |
@@ -295,6 +295,21 @@ func (mr *MockCruiseControlScalerMockRecorder) Status(ctx interface{}) *gomock.C | |||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Status", reflect.TypeOf((*MockCruiseControlScaler)(nil).Status), ctx) | |||
} | |||
|
|||
// StatusTask mocks base method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-run make mock-generate
to generate this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, generated the file in 193a716
…nc task instead of the result When the request on /state endpoint of CC takes longer than webserver.request.maxBlockTimeMs, then CC will convert the request into an async task and will respond with the taskID instead of the result. The Koperator should handle this case by waiting for CC to complete the task.
193a716
to
02c7fc3
Compare
Description
This PR attempts to fix #828.
Currently marked this PR as draft until the change in the API module introduced with the #975 PR is merged.
When the request on CC /state endpoint takes longer than webserver.request.maxBlockTimeMs, then CC will convert the request into an async task and will respond with the taskID instead of the result. The Koperator should handle this case by waiting for CC to complete the task.
The approach is the following:
Status
request into an async task and returns just thetaskID
, then:CruiseControlOperation
to track the progress of the Status request and requeue the reconciliation for laterStatus
CruiseControlOperation
in progress and just request the latest status of this task. If not ready, then we requeue again. This step is repeated until the CC task is completedNotes:
Status
CruiseControlOperation
in progress for akafkaClusterReference
.Status
of CC in more than 5 minutes, then we will consider this outdated and retryType of Change
Checklist