Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2057566

Summary: Changes made in tuned config creates additional entry instead of overriding existing config because of musthave compliance type
Product: OpenShift Container Platform Reporter: yliu1
Component: Telco EdgeAssignee: Nahian <npathan>
Telco Edge sub component: ZTP QA Contact: yliu1
Status: CLOSED WONTFIX Docs Contact:
Severity: low    
Priority: unspecified CC: imiller, jramsay, keyoung, npathan
Version: 4.9Flags: npathan: needinfo+
npathan: needinfo+
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Release Note
Doc Text:
When updating content contained in lists within CRs managed by Policy, such as the Tuned configuration included in the source CR TunedPerformancePatch.yaml, the updated values will create a new list entry rather than overwriting the existing list entry. If the intent is to update the existing list entry rather than creating an additional list entry the complianceType for that CR must be set to 'mustonlyhave' instead of the default 'musthave'.
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-04-30 18:04:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description yliu1 2022-02-23 15:45:14 UTC
Description of problem:
Since we now have musthave a default policy complianceType, any changes made in tuned config will result in additionally data entry that is in conflict with existing config. There are probably other configs having similar issue. 

Version-Release number of selected component (if applicable):
4.9 (Likely in 4.10 as well)

How reproducible:
Always

Steps to Reproduce:
1. Deploy a cluster viz ZTP
2. Update tuned config
3. Observe changes on spoke

Actual results:
- Additional entry added to tuned profile on spoke like below
[kni@provisionhost-0-0 ~]$ oc get tuned -n openshift-cluster-node-tuning-operator performance-patch -o yaml
....
spec:
  profile:
  - data: |
      [main]
      summary=Configuration changes profile inherited from performance created tuned
      include=openshift-node-performance-openshift-node-performance-profile
      [bootloader]
      cmdline_crash=nohz_full=4-7
      [sysctl]
      kernel.timer_migration=1
      [service]
      service.stalld=start,enable
    name: performance-patch
  - data: |
      [main]
      summary=Configuration changes profile inherited from performance created tuned
      include=openshift-node-performance-openshift-node-performance-profile
      [bootloader]
      cmdline_crash=nohz_full=4-15
      [sysctl]
      kernel.timer_migration=1
      [service]
      service.stalld=start,enable
    name: performance-patch
  recommend:
  - machineConfigLabels:
      machineconfiguration.openshift.io/role: master
    priority: 19
    profile: performance-patch


Expected results:
tuned config change should override the existing config.


Additional info:

Workaround is to set complianceType to mustonlyhave in PGT.

- fileName: TunedPerformancePatch.yaml
  complianceType: mustonlyhave

Comment 1 yliu1 2022-03-14 16:21:38 UTC
Same issue observed with ptp config update.

Comment 6 yliu1 2022-04-27 18:39:00 UTC
@npathan can you update the examples for all applicable configs?

Comment 7 yliu1 2022-04-27 18:43:54 UTC
Why not just changing the examples instead of adding a issue readme? The readme is a bit confusing to users, also this issue also happens with ptp config.

Comment 10 Nahian 2022-08-18 19:13:52 UTC
@yliu1 agreed the docs are confusing. Instead of updating though, I'll delete the doc once this (https://bugzilla.redhat.com/show_bug.cgi?id=2117728) fix is available from ACM. It should be in ACM 2.5.2 (merged upstream now waiting for downstream) 

Just to summarize the problem and expected fix(since it's been a while): 
We need to keep `musthave` and not `mustonlyhave` because of `mustonlyhave`'s all-encompassing power of overriding everything which cause issues like infinite loops when other operators try to change even the smallest thing (destroying and recreating CRs). But `musthave` currently appends to a list instead of updating/replacing the content of an array entry (reason for this ticket). With fix from ACM, users can now update the object in an array as long they have the key `name` and same value.

Comment 11 Nahian 2022-09-07 16:44:42 UTC
ACM 2.6 is now in OperatorHub

Comment 12 yliu1 2022-09-09 19:02:23 UTC
Hi Nahian, could you please provide an example ptp or tuned config using PGT?

Comment 13 Nahian 2022-09-09 20:38:25 UTC
Hi Yang, example wise I would say maybe try change you made in `tuned` (from the description). So maybe changing `cmdline_crash=nohz_full=4-7` to `cmdline_crash=nohz_full=4-9` in PGT and see if you're getting the expected behaviour? 

Basically as long as you have the latest ACM (2.6.0 in this case) and keep everything else the same (i.e no extra CRs to install or configs to change)...you shouldn't see any more appending.

Comment 14 yliu1 2022-10-25 20:23:41 UTC
Verified ACM 2.6.2 handles this properly.

Comment 15 Rory Thrasher 2024-04-30 18:04:53 UTC
OCP is no longer using Bugzilla and this bug appears to have been left in an orphaned state. If the bug is still relevant, please open a new issue in the OCPBUGS Jira project: https://issues.redhat.com/projects/OCPBUGS/summary