-
Notifications
You must be signed in to change notification settings - Fork 103
OCPBUGS-60043: lastReportTime field of clusteroperator.insights should be updated accordingly #1160
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
base: master
Are you sure you want to change the base?
OCPBUGS-60043: lastReportTime field of clusteroperator.insights should be updated accordingly #1160
Conversation
|
Skipping CI for Draft Pull Request. |
|
@katushiik11: This pull request references Jira Issue OCPBUGS-60043, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@katushiik11: This pull request references Jira Issue OCPBUGS-60043, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/test all |
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.
Please also add the update of gather cluster role with required permissions to update the status field. Also please add some unit tests where possible.
pkg/controller/gather_commands.go
Outdated
| _, err = client.ClusterOperators().UpdateStatus(ctx, insightsCo, metav1.UpdateOptions{}) | ||
|
|
||
| klog.Infof("successfully updated LastReportTime to %s", reported.LastReportTime) | ||
| return err |
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.
Avoid logging success message when the update failed and we are returning an error
| _, err = client.ClusterOperators().UpdateStatus(ctx, insightsCo, metav1.UpdateOptions{}) | |
| klog.Infof("successfully updated LastReportTime to %s", reported.LastReportTime) | |
| return err | |
| _, err = client.ClusterOperators().UpdateStatus(ctx, insightsCo, metav1.UpdateOptions{}) | |
| if err != nil { | |
| klog.Errorf("failed updating the clusteroperator status: %v", err) | |
| return err | |
| } | |
| klog.Infof("successfully updated LastReportTime to %s", reported.LastReportTime) | |
| return nil |
pkg/controller/gather_commands.go
Outdated
| if err := updateClusterOperatorLastReportTime(ctx, configClient.ConfigV1()); err != nil { | ||
| klog.Errorf("Failed to update ClusterOperator lastReportTime: %v", err) | ||
| } |
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 think we should move this closer to the actual upload of report. So imo we should do it in the pkg/insights/insightsuploader/insightsuploader.go Upload function.
pkg/controller/gather_commands.go
Outdated
| if err != nil { | ||
| return fmt.Errorf("unable to marshal status extension: %v", err) | ||
| } | ||
| insightsCo.Status.Extension.Raw = data |
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 will override all data in Status.Extension. Please verify we're not writing anything else there besides LastReportTime
|
@katushiik11: This pull request references Jira Issue OCPBUGS-60043, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
| klog.Infof("Uploaded report successfully in %s", time.Since(start)) | ||
|
|
||
| // Update LastReportTime after successful upload | ||
| updateClusterOperatorLastReportTime(ctx, configClient) |
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 should keep the error handling as it was in the gather_commands.go and log the error returned from this function.
| _, err = client.ClusterOperators().UpdateStatus(ctx, insightsCo, metav1.UpdateOptions{}) | ||
|
|
||
| if err != nil { | ||
| klog.Errorf("Failed to update LastReportTime: %v", err) | ||
| } |
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.
if _, err := client.ClusterOperators().UpdateStatus(ctx, insightsCo, metav1.UpdateOptions{}); err != nil {
return err
}|
@BaiyangZhou do you want to add integration test for this functionality? |
ncaak
left a comment
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.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: katushiik11, ncaak The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
@katushiik11: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
We will probably need to update our CRD API first in order to address this issue. /hold |
This PR implements a fix, so that lastReportTime field of clusteroperator.insights should be updated accordingly.
Categories
Sample Archive
None
Documentation
None
Unit Tests
pkg/insights/insightsuploader/insightsuploader_test.goPrivacy
Yes. There are no sensitive data in the newly collected information.
Changelog
No
Breaking Changes
No
References
https://issues.redhat.com/browse/OCPBUGS-60043