Uploaded image for project: 'OpenShift Console'
  1. OpenShift Console
  2. CONSOLE-3790

Configure OpenShift Console to display warnings from apiserver when creating/updating resources

XMLWordPrintable

    • Icon: Spike Spike
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • Admin Screens
    • None
    • False
    • None
    • False
    • OCPSTRAT-924 - Console: Customer Happiness (RFEs) for 4.16
    • HAC Infra OCP - Sprint 249

      Customer uses Gatekeeper to implement policies in a ValidatingWebhookConfiguration and each policy can either be a warning policy or a deny policy.  The warning messages shown/generated only are visible when using the `oc cli`, and they are not visible from the console. Doing the same in the console will just update the resource with no message.  The request should still be allowed through, but in the view of the customer, a way to notify the user that they violated a warn policy would be helpful.

      Slack thread - https://redhat-internal.slack.com/archives/C6A3NV5J9/p1689862224796089

      For example:

      #oc edit scaledobject example
      Warning: [block-unsupported-keda-scaler] ScaledObject example spec.triggers[1]: unsupported scaler type external
      scaledobject.keda.sh/example edited
      

       

      AC: 

      • Figure out how the warning is sent, if part of the response msg directly or there is a different mechanism (eg. check how CLI is handling this):
        The warning is in the HTTP Response Header. See attached screenshot. 
      • Identify what are the components which need to be updated to these warnings:
      • consoleFetch - Currently does not support HTTP `response.headers`
      • K8s resource functions i.e. K8sCreate, K8sUpdate, K8sPatch
      • Store the warning policy response in Redux state or use React Context
      • Update types for the above
      • Create a follow up story/ies:

      1. Add support for retrieving response.header in consoleFetchCommon function https://issues.redhat.com/browse/CONSOLE-3949
      2. Display a warning notification from kube-apiserver when creating a resource in Console UI story-
      https://issues.redhat.com/browse/CONSOLE-3939
      3. Display a warning notification from kube-apiserver when updating a resource in Console UI story-
      https://issues.redhat.com/browse/CONSOLE-3942
      4. Display warning notifications from kube-apiserver when creating bulk resources in Console UI
      https://issues.redhat.com/browse/CONSOLE-3954

       

      Additional info:

      • Add `response.headers.get('Warning')` to `consoleFetchCommon` function, and extract both JSON and headers from `consoleFetchCommon`. 
        Observation: The console resource response returns a string, and the `.text()` is used to extract the actual text response. We'll have to figure out how to return `response.headers` along `response.text()` in this case which would likely involve changes down the line.  
      •  The UX team have provided designs for notification. See the follow-up stories
      • See attached screenshots for screens redirected to after create or update actions where
        the notification should be displayed

        1. Screenshot 2024-02-21 at 4.02.36 PM.png
          1.16 MB
          Cyril Ajieh
        2. Screenshot 2024-02-21 at 4.00.39 PM.png
          744 kB
          Cyril Ajieh
        3. Screenshot 2024-02-21 at 3.56.14 PM.png
          327 kB
          Cyril Ajieh
        4. Screenshot 2024-02-21 at 3.56.47 PM.png
          394 kB
          Cyril Ajieh
        5. Screenshot 2024-02-09 at 10.07.42 AM.png
          209 kB
          Cyril Ajieh
        6. Screenshot 2024-02-09 at 10.01.51 AM.png
          400 kB
          Cyril Ajieh

            cajieh Cyril Ajieh
            jcaiani@redhat.com Joseph Caiani
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: