-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: implement stagedUpdateRun initialization #975
Conversation
d8825f2
to
5022c97
Compare
6727c44
to
f2d71b3
Compare
if toBeUpdatedBindings, toBeDeletedBindings, err = r.initialize(ctx, &updateRun); err != nil { | ||
klog.ErrorS(err, "Failed to initialize the clusterStagedUpdateRun", "clusterStagedUpdateRun", runObjRef) | ||
// errInitializedFailed cannot be retried. | ||
if errors.Is(err, errInitializedFailed) { |
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.
we also should not retry if the error is "unexpected"
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.
I believe I wrapped all terminating errors including unexpected ones as errInitializedFailed
. I think adding another case would make things more complicated.
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.
oh, I miss read the code. However, since the outer error is always failedToInitialize, can we unwrap when we return the error. It might be easier to classify the error and create alert/monitor that way, especially now we emit error types like user error, unexpected or API error.
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.
hmmm but this error is not returned/reported in the controller, it's written to the clusterStagedUpdateRun
condition.
d318d7a
to
ad9bda9
Compare
if toBeUpdatedBindings, toBeDeletedBindings, err = r.initialize(ctx, &updateRun); err != nil { | ||
klog.ErrorS(err, "Failed to initialize the clusterStagedUpdateRun", "clusterStagedUpdateRun", runObjRef) | ||
// errInitializedFailed cannot be retried. | ||
if errors.Is(err, errInitializedFailed) { |
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.
oh, I miss read the code. However, since the outer error is always failedToInitialize, can we unwrap when we return the error. It might be easier to classify the error and create alert/monitor that way, especially now we emit error types like user error, unexpected or API error.
}) | ||
}) | ||
|
||
func validateFailedInitCondition(ctx context.Context, updateRun *placementv1alpha1.ClusterStagedUpdateRun, message string) { |
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.
no need to add this in this PR but I think it will be good to also verify the type of error (user error, unexpected, or api error) in this function.
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.
This one is related to above discussion. The initialization errors are not returned by the reconciler but just written to the initialization condition. The controller returns nil for these errors to avoid retrying. We can only check the error by checking the condition.
Description of your changes
Implement the initialization stage of the
clusterStagedUpdateRun
controller.Fixes #
I have:
make reviewable
to ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer