-
Task
-
Resolution: Done
-
Normal
-
None
-
False
-
None
-
False
-
-
-
No
Create an informative issue (See each section, incomplete templates/issues won't be triaged)
Using the current documentation as a model, please complete the issue template.
Note: Doc team updates the current version and the two previous versions (n-2). For earlier versions, we will address only high-priority, customer-reported issues for releases in support.
Prerequisite: Start with what we have
Always look at the current documentation to describe the change that is needed. Use the source or portal link for Step 4:
- Use the Customer Portal: https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes
- Use the GitHub link to find the staged docs in the repository: https://github.com/stolostron/rhacm-docs
Describe the changes in the doc and link to your dev story
Provide info for the following steps:
1. - [x] Mandatory Add the required version to the Fix version/s field.
2. - [x] Mandatory Choose the type of documentation change.
- [ ] New topic in an existing section or new section
- [x] Update to an existing topic
3. - [ ] Mandatory for GA content:
- [ ] Add steps and/or other important conceptual information here:
- [ ] Add Required access level for the user to complete the task here:
- [ ] Add verification at the end of the task, how does the user verify success (a command to run or a result to see?)
- [ ] Add link to dev story here:
4. - [x] Mandatory for bugs: What is the diff? Clearly define what the problem is, what the change is, and link to the current documentation:
Update the global hub known issues for release 2.10: https://github.com/stolostron/rhacm-docs/blob/2.10_stage/release_notes/known_issues_global.adoc
The related PR: https://github.com/stolostron/rhacm-docs/pull/6211
Title: Compliance cronjob might fail when reimport the managed hub with a different name
Content:
The compliance cronjob is used to summarize the daily status of the policy by compliance and event table. When the managed hub reimport to the global hub with a different name, that might caused two events of the same policy with different managed hub names on one day. This will cause the daily job run with the error like this `pq: ON CONFLICT DO UPDATE command cannot affect row a second time`.
Workaround:
Most simply, you can choose to restart the manager to end the error, and then running the following SQL to restore the compliance history data of yesterday
INSERT INTO history.local_compliance (policy_id, cluster_id, leaf_hub_name, compliance_date, compliance, compliance_changed_frequency)WITH compliance_aggregate AS ( SELECT cluster_id, policy_id, leaf_hub_name, CASE WHEN bool_or(compliance = 'non_compliant') THEN 'non_compliant' WHEN bool_or(compliance = 'unknown') THEN 'unknown' ELSE 'compliant' END::local_status.compliance_type AS aggregated_compliance FROM event.local_policies lp WHERE created_at BETWEEN CURRENT_DATE - INTERVAL '1 days' AND CURRENT_DATE - INTERVAL '0 day' AND EXISTS ( SELECT 1 FROM status.leaf_hubs lh WHERE lh.leaf_hub_name = lp.leaf_hub_name AND deleted_at IS NULL ) GROUP BY cluster_id, policy_id, leaf_hub_name)SELECT policy_id, cluster_id, leaf_hub_name, (CURRENT_DATE - INTERVAL '1 day') AS compliance_date, aggregated_compliance, ( SELECT COUNT(1) FROM ( SELECT created_at, compliance, LAG(compliance) OVER (PARTITION BY cluster_id, policy_id ORDER BY created_at ASC) AS prev_compliance FROM event.local_policies lp WHERE (lp.created_at BETWEEN CURRENT_DATE - INTERVAL '1 day' AND CURRENT_DATE - INTERVAL '0 day') AND lp.cluster_id = ca.cluster_id AND lp.policy_id = ca.policy_id ORDER BY created_at ASC ) AS subquery WHERE compliance <> prev_compliance ) AS compliance_changed_frequencyFROM compliance_aggregate caORDER BY cluster_id, policy_id;ON CONFLICT (leaf_hub_name, policy_id, cluster_id, compliance_date)DO UPDATE SET compliance = EXCLUDED.compliance, compliance_changed_frequency = EXCLUDED.compliance_changed_frequency;