Bug 2034146

Summary: [release-4.7] spec.cpu.reserved is not set correctly by default if only spec.cpu.isolated is defined in PerformanceProfile
Product: OpenShift Container Platform Reporter: Mario Fernández <mariofer>
Component: Performance Addon OperatorAssignee: Martin Sivák <msivak>
Status: CLOSED ERRATA QA Contact: Gowrishankar Rajaiyan <grajaiya>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.7CC: aos-bugs, grajaiya, mniranja, msivak, yquinn
Target Milestone: ---   
Target Release: 4.7.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2033292 Environment:
Last Closed: 2022-05-26 06:02:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2033292    
Bug Blocks:    

Comment 3 Niranjan Mallapadi Raghavender 2022-05-23 14:32:37 UTC
Versions:

PAO Version :

 "architecture": "x86_64",
  "build-date": "2022-05-18T09:26:28.286937",
  "com.redhat.build-host": "cpt-1006.osbs.prod.upshift.rdu2.redhat.com",
  "com.redhat.component": "performance-addon-operator-container",
  "com.redhat.license_terms": "https://www.redhat.com/agreements",
  "description": "performance-addon-operator",
  "distribution-scope": "public",
  "io.k8s.description": "performance-addon-operator",
  "io.k8s.display-name": "performance-addon-operator",
  "io.openshift.expose-services": "",
  "io.openshift.maintainer.component": "Performance Addon Operator",
  "io.openshift.maintainer.product": "OpenShift Container Platform",
  "io.openshift.tags": "operator",
  "maintainer": "openshift-operators",
  "name": "openshift4/performance-addon-rhel8-operator",
  "release": "6",
  "summary": "performance-addon-operator",
  "upstream-vcs-ref": "db65f191d73fc8f3515ba8280d67479cb5c2f9bd",
  "upstream-vcs-type": "git",
  "upstream-version": "4.7.1-1-51-gdb65f19",
  "url": "https://access.redhat.com/containers/#/registry.access.redhat.com/openshift4/performance-addon-rhel8-operator/images/v4.7.12-6",
  "vcs-ref": "58970cfa344f78d59ad2897823a9f5296537d95b",
  "vcs-type": "git",
  "vendor": "Red Hat, Inc.",
  "version": "v4.7.12"

OCP Version: Server Version: 4.7.51

1. Create a performance profile with no reserved cpu mentioned in performance profile:
[root@ocp-edge89 ~]# cat ppsh.yaml 
apiVersion: performance.openshift.io/v2
kind: PerformanceProfile
metadata:
  name: performancesh
spec:
  cpu:
    isolated: "3-5"
  realTimeKernel:
    enabled: true
  nodeSelector:
    node-role.kubernetes.io/worker-cnf: ""
2. Apply the profile

root@ocp-edge89 ~]# oc apply -f ppsh.yaml 
The PerformanceProfile "performancesh" is invalid: spec.cpu.reserved: Required value


3. Try editing an existing  profile and remove the reserved cpus from spec. 

oc edit performanceprofile/performance 


# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: performance.openshift.io/v2
kind: PerformanceProfile
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"performance.openshift.io/v2","kind":"PerformanceProfile","metadata":{"annotations":{},"name":"performance"},"spec":{"cpu":{"isolated":"3-6"},"nodeSelector":{"node-role.kubernetes.io/worker-cnf":""},"realTimeKernel":{"enabled":true}}}
  creationTimestamp: "2022-05-23T12:44:33Z"
  finalizers:
  - foreground-deletion
  generation: 2
  name: performance
  resourceVersion: "88333"
  selfLink: /apis/performance.openshift.io/v2/performanceprofiles/performance
  uid: e8afdba5-25b9-453f-8423-144c6a99a7e3
spec:
  cpu:
    isolated: 3-6
  globallyDisableIrqLoadBalancing: true
  nodeSelector:
    node-role.kubernetes.io/worker-cnf: ""
  realTimeKernel:
    enabled: true
status:
  conditions:
  - lastHeartbeatTime: "2022-05-23T14:21:46Z"
    lastTransitionTime: "2022-05-23T14:21:46Z"
    status: "True"
    type: Available
  - lastHeartbeatTime: "2022-05-23T14:21:46Z"
    lastTransitionTime: "2022-05-23T14:21:46Z"
    status: "True"
    type: Upgradeable
  - lastHeartbeatTime: "2022-05-23T14:21:46Z"
    lastTransitionTime: "2022-05-23T14:21:46Z"
    status: "False"
    type: Progressing
  - lastHeartbeatTime: "2022-05-23T14:21:46Z"
    lastTransitionTime: "2022-05-23T14:21:46Z"
    status: "False"
    type: Degraded
  runtimeClass: performance-performance
  tuned: openshift-cluster-node-tuning-operator/openshift-node-performance-performance

The below message appears and edit fails 

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# performanceprofiles.performance.openshift.io "performance" was not valid:
# * spec.cpu.reserved: Required value

Comment 4 Niranjan Mallapadi Raghavender 2022-05-23 14:34:55 UTC
Verify CRD has the parameters isolated and reserved as required.

          Spec:
            Description:  PerformanceProfileSpec defines the desired state of PerformanceProfile.
            Properties:
              Additional Kernel Args:
                Description:  Addional kernel arguments.
                Items:
                  Type:  string
                Type:    array
              Cpu:
                Description:  CPU defines a set of CPU related parameters.
                Properties:
                  Balance Isolated:
                    Description:  BalanceIsolated toggles whether or not the Isolated CPU set is eligible for load balancing work loads. When this option is set to "false", the Isolated CPU set will be static, m
eaning workloads have to explicitly assign each thread to a specific cpu in order to work across multiple CPUs. Setting this to "true" allows workloads to be balanced across CPUs. Setting this to "false" offers 
the most predictable performance for guaranteed workloads, but it offloads the complexity of cpu load balancing to the application. Defaults to "true"
                    Type:         boolean
                  Isolated:
                    Description:  Isolated defines a set of CPUs that will be used to give to application threads the most execution time possible, which means removing as many extraneous tasks off a CPU as poss
ible. It is important to notice the CPU manager can choose any CPU to run the workload except the reserved CPUs. In order to guarantee that your workload will run on the isolated CPU:   1. The union of reserved 
CPUs and isolated CPUs should include all online CPUs   2. The isolated CPUs field should be the complementary to reserved CPUs field
                    Type:         string
                  Reserved:
                    Description:  Reserved defines a set of CPUs that will not be used for any container workloads initiated by kubelet.
                    Type:         string
                Required:
                  isolated 
                  reserved <<==============
                Type:  object

Comment 6 errata-xmlrpc 2022-05-26 06:02:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.7.51 low-latency extras update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:4704