Bug 1732740

Summary: [CONSOLE-1476] Give correct help info in YAML editor
Product: OpenShift Container Platform Reporter: Yadan Pei <yapei>
Component: Management ConsoleAssignee: Josh Pinkney <jpinkney>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2.0CC: aos-bugs, jokerman, jpinkney, mbenitez, mmccomas, spadgett, yapei
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-16 06:31:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The suggestions look correct for kind none

Description Yadan Pei 2019-07-24 09:05:17 UTC
Description of problem:
Hover help text should give correct instructions

Version-Release number of selected component (if applicable):
4.2.0-0.nightly-2019-07-24-000310

How reproducible:
Always

Steps to Reproduce:
1. User open Import YAML editor, try to add content manually
2. Try to add these lines and see what hints will be given in YAML editor when hover the 'kind' text
apiVersion: build.openshift.io/v1
kind: 
3. ry to add these lines and see what hints will be given in YAML editor when hover the 'kind' text
apiVersion: image.openshift.io/v1
kind: 
4. ry to add these lines and see what hints will be given in YAML editor when hover the 'kind' text
apiVersion: apps.openshift.io/v1
kind: 

Actual results:
2. Incorrect type, Expected "string"
Value is not accepted. Valid values: "Build", "Build"
3. Incorrect type, Expected "string"
Value is not accepted. Valid values: "ImageStreamLayers"
4. Incorrect type, Expected "string"
Value is not accepted. Valid values: "DeploymentConfig", "DeploymentConfig"


Expected results:
2. for apiVersion `build.openshift.io/v1`, we have kind: Build, kind: BuildConfig
3. for apiVersion `image.openshift.io/v1`, we also have more kinds supported, such as Image, ImageStream etc
4. for apiVersion `apps.openshift.io/v1`, we have DeploymentConfig, but the hover help info shows duplicate items

Additional info:

Comment 1 Samuel Padgett 2019-07-24 12:26:33 UTC
Created attachment 1593139 [details]
The suggestions look correct for kind

Comment 2 Samuel Padgett 2019-07-24 12:27:08 UTC
I'm not able to reproduce. (See screenshot.)

Comment 4 Yadan Pei 2019-07-25 05:52:59 UTC
Do I need some key combinations?

Comment 5 Yadan Pei 2019-07-25 06:58:22 UTC
I'm experiencing comment 3 on Firefox 68 and Chrome 75

Comment 6 Yadan Pei 2019-07-25 09:53:39 UTC
We found out the combination key to get resource lists: control + space

For apiVersion: apps.openshift.io/v1, the suggestion list is: 
DeleleOptions
DeploymentConfig
DeploymentConfigList
DeploymentConfigRollback
DeploymentLog
DeploymentRequest
Scale
WatchEvent


Some of the kind, DeploymentConfigList,DeploymentConfigRollback,DeploymentLog,DeploymentRequest,Scale,WatchEvent,DeleleOptions seems invalid, because when use these kind to create resources, the server will return error message "The server doesn't have a resource type "kind: Scale, apiVersion: apps.openshift.io/v1"."

Comment 7 Yadan Pei 2019-07-25 09:58:45 UTC
The messages can be seen when hover the ~~~
"
Incorrect type, Expected "string"
Value is not accepted. Valid values: "Build", "Build"
"

Comment 8 Yadan Pei 2019-07-25 10:04:34 UTC
$ oc api-resources --api-group=apps.openshift.io
NAME                SHORTNAMES   APIGROUP            NAMESPACED   KIND
deploymentconfigs   dc           apps.openshift.io   true         DeploymentConfig

So the only one kind for `apps.openshift.io/v1` is `DeploymentConfig`

Comment 10 Yadan Pei 2019-08-22 02:24:05 UTC
When given these text in YAML editor

apiVersion: build.openshift.io/v1
kind: 


Hover the text 'kind' it will give message:
Incorrect type, Expected "string"
Value is not accepted. Valid values: "Build", "BuildConfig", "BuildConfigList","BuildList","BuildLog","BuildRequest","DeleteOptions","WatchEvent"



When I check supported API Resources via oc

$ oc api-resources --api-group=build.openshift.io
NAME           SHORTNAMES   APIGROUP             NAMESPACED   KIND
buildconfigs   bc           build.openshift.io   true         BuildConfig
builds                      build.openshift.io   true         Build


It means only "Build" and "BuildConfig" are supported API resources in API Group 'build.openshift.io'. Can you explain why in YAML editor it shows some other suggested resources "BuildConfigList","BuildList","BuildLog","BuildRequest","DeleteOptions","WatchEvent" ?

Comment 11 Josh Pinkney 2019-08-22 14:08:56 UTC
It's not something I have control over from my side (the language server side). If that is the case then the JSON schema itself is wrong. I've turned the JSON schema that the YAML language server is given by the console into a github gist: https://gist.githubusercontent.com/JPinkney/5a74222b083db6ff85b3d74ed9e445be/raw/74c86e37edacb199e81d5e733d007d6f2fc67156/testschema.json. If you search for build.openshift.io you'll find that "BuildConfigList","BuildList","BuildLog" etc are all associated with build.openshift.io.

Comment 12 Samuel Padgett 2019-08-22 15:00:49 UTC
Those are valid resources in the API group, which include subresources.

❯ oc get --raw /apis/build.openshift.io/v1 

{
  "kind": "APIResourceList",
  "apiVersion": "v1",
  "groupVersion": "build.openshift.io/v1",
  "resources": [
    {
      "name": "buildconfigs",
      "singularName": "",
      "namespaced": true,
      "kind": "BuildConfig",
      "verbs": [
        "create",
        "delete",
        "deletecollection",
        "get",
        "list",
        "patch",
        "update",
        "watch"
      ],
      "shortNames": [
        "bc"
      ],
      "categories": [
        "all"
      ]
    },
    {
      "name": "buildconfigs/instantiate",
      "singularName": "",
      "namespaced": true,
      "kind": "BuildRequest",
      "verbs": [
        "create"
      ]
    },
    {
      "name": "buildconfigs/instantiatebinary",
      "singularName": "",
      "namespaced": true,
      "kind": "BinaryBuildRequestOptions",
      "verbs": [
        "create"
      ]
    },
    {
      "name": "buildconfigs/webhooks",
      "singularName": "",
      "namespaced": true,
      "kind": "Build",
      "verbs": [
        "create"
      ]
    },
    {
      "name": "builds",
      "singularName": "",
      "namespaced": true,
      "kind": "Build",
      "verbs": [
        "create",
        "delete",
        "deletecollection",
        "get",
        "list",
        "patch",
        "update",
        "watch"
      ],
      "categories": [
        "all"
      ]
    },
    {
      "name": "builds/clone",
      "singularName": "",
      "namespaced": true,
      "kind": "BuildRequest",
      "verbs": [
        "create"
      ]
    },
    {
      "name": "builds/details",
      "singularName": "",
      "namespaced": true,
      "kind": "Build",
      "verbs": [
        "update"
      ]
    },
    {
      "name": "builds/log",
      "singularName": "",
      "namespaced": true,
      "kind": "BuildLog",
      "verbs": [
        "get"
      ]
    }
  ]
}

Comment 13 Yadan Pei 2019-08-23 05:59:39 UTC
Thank you all for your explanation.

Moving to VERIFIED since the issues have been resolved

Comment 14 errata-xmlrpc 2019-10-16 06:31:08 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, 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-2019:2922

Comment 15 Samuel Padgett 2020-06-18 18:46:19 UTC
*** Bug 1735685 has been marked as a duplicate of this bug. ***