rancher / dashboard

The Rancher UI
https://rancher.com
Apache License 2.0
450 stars 258 forks source link

Cannot create Clusters in 2.9.1 using non-builtin Node drivers #11936

Open nnoethling opened 4 days ago

nnoethling commented 4 days ago

Setup

Describe the bug

In the current stable Rancher version 2.9.1 Cluster creation is not working using non-builtin drivers. UI is shown the following Error when trying to create the cluster: OutscaleConfig.rke-machine-config.cattle.io "nc-outscale-test-pool1-wshzr" is invalid: extraTagsAll: Invalid value: "string": extraTagsAll in body must be of type array: "string"

To Reproduce

  1. Deploy Rancher 2.9.1
  2. Enable Non-builtin Node driver (e.g. Outscale in my example)
  3. Go to Clusters and create new Cluster
  4. Make sure RKE2/K3s is enabled
  5. Select outscale as node driver
  6. Enter a cluster name
  7. Enter dummy values for extraTagsAll or securityGroupIds
  8. Click Create

Result Cluster create is blocked by UI error: OutscaleConfig.rke-machine-config.cattle.io "nc-outscale-test-pool1-wshzr" is invalid: extraTagsAll: Invalid value: "string": extraTagsAll in body must be of type array: "string"

The actual Network Request response:

{
    "type": "error",
    "links": {},
    "code": "Invalid",
    "message": "OutscaleConfig.rke-machine-config.cattle.io \"nc-outscale-test-pool1-pt54k\" is invalid: extraTagsAll: Invalid value: \"string\": extraTagsAll in body must be of type array: \"string\"",
    "status": 422,
    "type": "error"
}

Expected Result

Creation of Cluster is possible using the UI.

Screenshots

extraTagsAll field in Cluster create in Rancher 2.9.1 seems to be a field for a string:

image

extraTagsAll field in Cluster create in Rancher 2.8.5 is for multiple values with Add button:

image

Additional context

Seems like in Rancher 2.9.1 UI array fields from custom UI are not processed correctly, or atleast other than in previous versions of Rancher. If you have a look at the custom UI code of the Driver (e.g. for outscale: https://oos.eu-west-2.outscale.com/rancher-ui-driver-outscale/v0.2.0/component.js) all fields that are arrays are affected and will not be displayed as array in Rancher UI. This only seems to affect non-builtin Drivers. I tested with 3 different ones (Outscale, Nutanix and Cloudscale)

brandond commented 4 days ago

It sounds like there have been changes made to the struct on the rancher side that are out of sync with the non-builtin driver. For example the field on the rancher MachineConfig object is now an array, but the OutscaleConfig object expects a string... or vice versa. Perhaps these drivers need to be updated to support rancher 2.9?

richard-cox commented 3 days ago

We should investigate if this will affect partners with node drivers as well. For whoever picks this up, raise it in the team slack channel for details

richard-cox commented 2 days ago

For outscale the UI uses the shell/machine-config/generic.vue component to render the form for node details. It creates the form given fields provided by shell/store/plugins.js fieldsForDriver. Pre 2.9.0 this looked at the node drivers resourceFields, however from 2.9.0 these come from a new schemaDefinition endpoint.

image

The endpoint returns extraTagsAll of type "string".

Outscale driver side it looks like that should be an array, see https://github.com/outscale/docker-machine-driver-outscale/blob/ed1caed0714f42d4f339430741c76269f9f7b24a/pkg/drivers/outscale/outscale.go#L63 (need to confirm how this somehow gets to be a schema rke-machine-config.cattle.io.outscaleconfig).

I think there was an issue with schemaDefinition and nested arrays, however i think from memory standard arrays (i.e. string[]) were fine. Checking with @MbolotSuse

richard-cox commented 2 days ago

In 2.9.0 the issue in https://github.com/rancher/dashboard/issues/11936#issuecomment-2361435906 was resolved by https://github.com/rancher/rancher/issues/45157.

However in 2.9.1 it's still an issue. ~investigating now.~ This is a UI bug that doesn't handle the new resourceField format for supplying an array shell/components/Questions/index.vue componentForQuestion checks for a type starting with array[, which is now array. Need to also confirm the type is correctly picked up

richard-cox commented 1 day ago

/backport v2.9.3