OCPBUGS-60043: lastReportTime field of clusteroperator.insights should be updated accordingly#1160
OCPBUGS-60043: lastReportTime field of clusteroperator.insights should be updated accordingly#1160katushiik11 wants to merge 4 commits intoopenshift:masterfrom
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 |
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.
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.
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.
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.
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.
if _, err := client.ClusterOperators().UpdateStatus(ctx, insightsCo, metav1.UpdateOptions{}); err != nil {
return err
}|
@BaiyangZhou do you want to add integration test for this functionality? |
|
[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 |
|
/jira refresh The requirements for Jira bugs have changed (Jira issues linked to PRs on main branch need to target different OCP), recalculating validity. |
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-60043, which is invalid:
Comment 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. |
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