CCXDEV-15641: gather machineconfig size#1240
CCXDEV-15641: gather machineconfig size#1240openshift-merge-bot[bot] merged 3 commits intoopenshift:masterfrom
Conversation
Annotate MachineConfig CRs with their original size before removing spec fields to reduce archive size. The newly added annotation is insights.operator.openshift.io/cr-size. Signed-off-by: Ondrej Pokorny <opokorny@redhat.com>
Signed-off-by: Ondrej Pokorny <opokorny@redhat.com>
Signed-off-by: Ondrej Pokorny <opokorny@redhat.com>
|
@opokornyy: This pull request references CCXDEV-15641 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.22.0" version, but no target version was set. 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. |
WalkthroughTwelve MachineConfig JSON resource definitions are updated to include a new annotation recording their JSON-marshaled size in bytes. A Go gatherer function is introduced to compute and apply this annotation to all MachineConfig resources before redacting sensitive fields. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.5.0)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/gatherers/clusterconfig/gather_machine_configs.go`:
- Around line 120-128: The code currently sets the
"insights.operator.openshift.io/cr-size" annotation even when getCRSize(&mc)
returns an error (mcSize stays 0); change the logic in the block around
getCRSize to only assign and call mc.SetAnnotations(annotations) when err == nil
(i.e., successful size calculation). Specifically, after calling getCRSize(&mc)
check if err is nil before doing
annotations["insights.operator.openshift.io/cr-size"] = strconv.Itoa(mcSize) and
calling mc.SetAnnotations(annotations); keep the existing klog.Errorf and errs =
append(errs, err) behavior on failure.
ℹ️ Review info
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (14)
docs/insights-archive-sample/config/machineconfigs/00-master.jsondocs/insights-archive-sample/config/machineconfigs/00-worker.jsondocs/insights-archive-sample/config/machineconfigs/01-master-container-runtime.jsondocs/insights-archive-sample/config/machineconfigs/01-master-kubelet.jsondocs/insights-archive-sample/config/machineconfigs/01-worker-container-runtime.jsondocs/insights-archive-sample/config/machineconfigs/01-worker-kubelet.jsondocs/insights-archive-sample/config/machineconfigs/99-master-generated-registries.jsondocs/insights-archive-sample/config/machineconfigs/99-master-ssh.jsondocs/insights-archive-sample/config/machineconfigs/99-worker-generated-registries.jsondocs/insights-archive-sample/config/machineconfigs/99-worker-ssh.jsondocs/insights-archive-sample/config/machineconfigs/rendered-master-025110333ea44423ccb1052723956671.jsondocs/insights-archive-sample/config/machineconfigs/rendered-worker-39c9df4a2c026c3149a02abe6f88cfc8.jsonpkg/gatherers/clusterconfig/gather_machine_configs.gopkg/gatherers/clusterconfig/gather_machine_configs_test.go
|
/retest |
4 similar comments
|
/retest |
|
/retest |
|
/retest |
|
/retest |
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ncaak, opokornyy 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 |
1 similar comment
|
/retest |
|
/label qe-approved |
|
@opokornyy: This pull request references CCXDEV-15641 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.22.0" version, but no target version was set. 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. |
|
/verified later @BaiyangZhou |
|
@BaiyangZhou: This PR has been marked to be verified later by 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. |
|
/retest |
|
/override pull-ci-openshift-insights-operator-master-lint I have verified it locally |
|
@opokornyy: Overrode contexts on behalf of opokornyy: ci/prow/lint 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 kubernetes-sigs/prow repository. |
|
@opokornyy: all tests passed! 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. |
Annotate MachineConfig CRs with their original size before removing spec fields to reduce archive size. The newly added annotation is
insights.operator.openshift.io/cr-size.Categories
Sample Archive
docs/insights-archive-sample/config/machineconfigsDocumentation
NoneUnit Tests
pkg/gatherers/clusterconfig/gather_machine_configs_test.goPrivacy
Yes. There are no sensitive data in the newly collected information.
Changelog
Breaking Changes
No
References
CCXDEV-15641