Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-37466

TALM policy objects inspect wrong message

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 4.16
    • TALM Operator
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      if the policy is created without an object-template nor object-template-raw objects, the operator shows the message:

       

      2024-07-22T11:42:54Z	ERROR	controllers.ClusterGroupUpgrade	Policy is invalid	{"error": "common-ran-operators: policy has both spec.policy-templates.objectDefinition.spec.object-templates and spec.policy-templates.objectDefinition.spec.object-templates-raw"} 

      which is actually the opposite. The message is confusing.  If using PGT generator plugin this cannot happen. But sometimes, we create manually our own Policies, if these are wrongly configured, or using a Policy Kind not supported by TALM, the message is not pointing to the real issue.

       

      Version-Release number of selected component (if applicable):

          

      How reproducible:

      Create a Policy that does not contain neither     object-template nor object-template-raw.

      apiVersion: policy.open-cluster-management.io/v1
      kind: Policy
      metadata:
        annotations:
          ran.openshift.io/ztp-deploy-wave: "2"
        name: vsno6-operators
        namespace: policies-sub
      spec:
        disabled: false
        policy-templates:
        - objectDefinition:
            apiVersion: policy.open-cluster-management.io/v1beta1
            kind: OperatorPolicy
            metadata:
              name: install-operators
            spec:
              complianceType: musthave
              operatorGroup:
                name: openshift-ptp
                namespace: openshift-ptp
                targetNamespaces:
                - openshift-ptp
              remediationAction: inform
              severity: critical
              subscription:
                channel: stable
                name: ptp-operator
                source: redhat-operators
                sourceNamespace: openshift-marketplace
                startingCSV: ptp-operator.v4.14.0-202404250639
              upgradeApproval: None
              versions:
              - 4.14.0-202402211209
              - 4.14.0-202406051038
              - 4.14.0-202407021509
              - 4.14.0-202312062209
              - 4.14.0-202404161544
              - 4.14.0-202404250639
              - 4.14.0-202406180839
        remediationAction: inform
       

      Even if this kind of Policy is not supported the message returned is wrong

       

      Steps to Reproduce:

          1.
          2.
          3.
          

      Actual results:

      The Operator should return the opposite message:

         2024-07-23T14:09:30Z    ERROR    controllers.ClusterGroupUpgrade    Policy is invalid    {"error": "vsno6-operators: policy is missing both spec.policy-templates.objectDefinition.spec.object-templates and spec.policy-templates.objectDefinition.spec.object-templates-raw"} 

      Expected results:

          

      Additional info:

          

              jche@redhat.com Jun Chen
              jgato@redhat.com Jose Gato Luis
              None
              Jose Gato Luis
              Dwaine Gonyier Dwaine Gonyier
              None
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: