Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dashboard] Show warning when unsupported Devfile features used #21873

Closed
Tracked by #21925 ...
AObuchow opened this issue Dec 8, 2022 · 6 comments · Fixed by eclipse-che/che-dashboard#727
Closed
Tracked by #21925 ...
Assignees
Labels
area/dashboard kind/enhancement A feature request - must adhere to the feature request template. severity/P1 Has a major impact to usage or development of the system. sprint/current

Comments

@AObuchow
Copy link

AObuchow commented Dec 8, 2022

Is your enhancement related to a problem? Please describe

There are features in the Devfile spec that are currently unsupported by the DevWorkspace-Operator (and consequently, by Che).

devfile/devworkspace-operator#989 adds support for providing a webhook warning when applying a devworkspace that contains unsupported features, however this warning is not yet taken into account by the Che Dashboard.

Describe the solution you'd like

When a warning is provided by the DevWorkspace-Operator about unsupported features being present in the devworkspace, the Che-Dashboard should display this warning and ask the user if they wish to continue using the Devfile, or resort to using the default devfile, similar to the UX implemented in #20738.

image

When the webhook warning is returned, the kubernetes API HTTP response body has the following format:
Devworkspace:

kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: plain-devworkspace
spec:
  started: true
  routingClass: 'basic'
  template:
    components:
      - name: web-terminal
        container:
          image: quay.io/wto/web-terminal-tooling:next
          memoryLimit: 512Mi
          mountSources: true
          command:
           - "tail"
           - "-f"
           - "/dev/null"
          dedicatedPod: true # This feature is unsupported

Response Body (see warning at very end):

{
   "apiVersion":"workspace.devfile.io/v1alpha2",
   "kind":"DevWorkspace",
   "metadata":{
      "annotations":{
         "kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"workspace.devfile.io/v1alpha2\",\"kind\":\"DevWorkspace\",\"metadata\":{\"annotations\":{},\"name\":\"plain-devworkspace\",\"namespace\":\"devworkspace-controller\"},\"spec\":{\"routingClass\":\"basic\",\"started\":true,\"template\":{\"components\":[{\"container\":{\"command\":[\"tail\",\"-f\",\"/dev/null\"],\"dedicatedPod\":true,\"image\":\"quay.io/wto/web-terminal-tooling:next\",\"memoryLimit\":\"512Mi\",\"mountSources\":true},\"name\":\"web-terminal\"}]}}}\n"
      },
      "creationTimestamp":"2022-12-08T16:00:26Z",
      "generation":1,
      "labels":{
         "controller.devfile.io/creator":""
      },
      "managedFields":[
         {
            "apiVersion":"workspace.devfile.io/v1alpha2",
            "fieldsType":"FieldsV1",
            "fieldsV1":{
               "f:metadata":{
                  "f:annotations":{
                     ".":{
                        
                     },
                     "f:kubectl.kubernetes.io/last-applied-configuration":{
                        
                     }
                  }
               },
               "f:spec":{
                  ".":{
                     
                  },
                  "f:routingClass":{
                     
                  },
                  "f:started":{
                     
                  },
                  "f:template":{
                     ".":{
                        
                     },
                     "f:components":{
                        
                     }
                  }
               }
            },
            "manager":"kubectl-client-side-apply",
            "operation":"Update",
            "time":"2022-12-08T16:00:26Z"
         }
      ],
      "name":"plain-devworkspace",
      "namespace":"devworkspace-controller",
      "resourceVersion":"2231",
      "uid":"85b8a468-6ab2-4172-99cf-f7d2e2fbb881"
   },
   "spec":{
      "routingClass":"basic",
      "started":true,
      "template":{
         "components":[
            {
               "container":{
                  "command":[
                     "tail",
                     "-f",
                     "/dev/null"
                  ],
                  "dedicatedPod":true,
                  "image":"quay.io/wto/web-terminal-tooling:next",
                  "memoryLimit":"512Mi",
                  "mountSources":true,
                  "sourceMapping":"/projects"
               },
               "name":"web-terminal"
            }
         ]
      }
   }
}
Warning: Unsupported Devfile features are present in this workspace. The following features will have no effect: components[].container.dedicatedPod, used by components: web-terminal

The warning is outside the outermost JSON braces, and will always begin with Warning:.

Edit: I got the above response body by doing a kubectl apply -f ... -v=9. However, checking the Kubernetes Webhook docs shows that the warning should be present within its own JSON key/value element, like the following:

{
  "apiVersion": "admission.k8s.io/v1",
  "kind": "AdmissionReview",
  "response": {
    "uid": "<value from request.uid>",
    "allowed": true,
    "warnings": [
      "duplicate envvar entries specified with name MY_ENV",
      "memory request less than 4MB specified for container mycontainer, which will not start successfully"
    ]
  }
}

It also mentions that the response should contain HTTP Warning headers with a warning code of 299.

Here is a longer example of an unsupported feature warning message, though the requirement for displaying the warning in the dashboard should just be to display the Warning in its entirety (no modification of the message should be necessary):

Warning: Unsupported Devfile features are present in this workspace. The following features will have no effect: components[].container.annotation.service, used by components: testing-container-1; components[].container.endpoints[].annotations, used by components: testing-container-1; components[].container.dedicatedPod, used by components: testing-container-1; components[].image, used by components: image-component; components[].custom, used by components: custom-component; components[].volume.size, used by components: projects; events.postStop: eventD, eventE, eventF; events.preStop: eventA, eventB, eventC

Describe alternatives you've considered

Currently, the only way to see this warning is by directly oc/kubectl apply'ing the devworkspace to the cluster.

Additional context

The DWO issue and suggested UX

@AObuchow AObuchow added the kind/enhancement A feature request - must adhere to the feature request template. label Dec 8, 2022
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Dec 8, 2022
@AObuchow
Copy link
Author

AObuchow commented Dec 8, 2022

@ibuziuk @l0rd feel free to add additional details about the desired UX for this request. I am also unable to add the sprint/next label, unfortunately (I believe this requires committer status on the Eclipse Che project).

@nickboldt
Copy link
Contributor

I've added the label for you... if this is for sprint/next do we want to mark it P1 and assign it to an area label?

@AObuchow
Copy link
Author

AObuchow commented Dec 9, 2022

Thanks @nickboldt :) Sorry for the slow reply, but yes I believe the area/dashboard label should be applied. I'm not sure about P1, however.

@ibuziuk ibuziuk added area/dashboard severity/P1 Has a major impact to usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Dec 9, 2022
@ibuziuk
Copy link
Member

ibuziuk commented Dec 12, 2022

my comment in the DWO issue - devfile/devworkspace-operator#984 (comment)
from UD perspective we should have the Continue Anyway button + we should consider removing Reload button

@ibuziuk ibuziuk mentioned this issue Dec 12, 2022
82 tasks
@ibuziuk ibuziuk mentioned this issue Jan 10, 2023
60 tasks
@akurinnoy akurinnoy self-assigned this Feb 8, 2023
@akurinnoy
Copy link
Contributor

@ibuziuk I've tried creating (kubectl apply ...) a devworkspace with the unsupported feature and noticed that even though I got the warning, the devworkspace was created successfully. So there are no actions a user can take on this step. So should the UD only show a simple warning notification without any buttons?

@ibuziuk
Copy link
Member

ibuziuk commented Feb 9, 2023

@akurinnoy yeah, we should not block the devworkspace creation/startup but should notify the user that some of the fields defined in the spec would not work since those are not supported by DWO - https://github.com/devfile/devworkspace-operator/blob/main/docs/unsupported-devfile-api.adoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dashboard kind/enhancement A feature request - must adhere to the feature request template. severity/P1 Has a major impact to usage or development of the system. sprint/current
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants