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

When 'metrics' field is set invalidly on add/edit HPA yaml view page, switching to form view will show runtime error.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • 4.21.0
    • 4.20, 4.21, 4.21.0
    • Management Console
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      On add/edit HPA yaml view page, set invalid object for spec.metrics field, eg: 'metrics: {}', then switch to form view, it will throw runtime error:
      Something wrong happened
      s.findIndex is not a function
          

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

      4.20.0-0.nightly-2025-10-22-194414
      4.21.0-0.nightly-2025-10-22-123727
          

      How reproducible:

      Always
          

      Steps to Reproduce:

          1.Go to a deployment page, open add/edit HPA page from action list.
          2.On yaml view page, set invalid object for spec.metrics field, eg: 'metrics: {}'. Click 'Save'
          3.Switch to form view page.
          

      Actual results:

      2. There will be an error info to point out the invalid field:
      An error occurred
      HorizontalPodAutoscaler in version "v2" cannot be handled as a HorizontalPodAutoscaler: json: cannot unmarshal object into Go struct field HorizontalPodAutoscalerSpec.spec.metrics of type []v2.MetricSpec
      3. The page meets runtime error:
      Something wrong happened
      s.findIndex is not a function
          

      Expected results:

      3. Should not meet runtime error. It's acceptable to show similar error info as yaml view or ignore the invalid set.
          

      Additional info:

      
          

              rh-ee-kragarwa Krish Agarwal
              rhn-support-yanpzhan Yanping Zhang
              None
              None
              Yanping Zhang Yanping Zhang
              None
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: