rancher / dashboard

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

Cannot create new cloud credentials for custom node drivers #8523

Open jakefhyde opened 1 year ago

jakefhyde commented 1 year ago

Setup

Describe the bug

When enabling some custom node drivers, the Cloud Credential creation page doesn't not show the correct default fields, and has an uneditable foo key.

To Reproduce

Result

An unremovable foo key is present

Expected Result

Correct field apiKey shows in UI

Screenshots

image

Additional context

I've noticed this on other cloud providers as well. As an aside, what populated these fields by default? Is it hard coded, or is it interpolated from available fields (from a list of token, apiKey, password, etc.), or is it coming from the backend somewhere and I've missed it?

aalves08 commented 1 year ago

@richard-cox this topic is quite similar to our last discussion around extensions. I can reproduce this by enabling cloud.ca node driver and creating a new RKE2 cloud.ca cluster... It's supposed to "use" the resourceFields coming from cloudcacredentialconfig but I suspect that this won't work for RKE2 right?

also, this scenario happens because the KeyValue is getting null from resourceFields field on the schema.

richard-cox commented 1 year ago

There's a chance this has never worked. Node drivers that were implemented with RKE1 in mind appear enabled for RKE2 as well. Unless this worked in previous versions I don't think this is a 2.7.2 thing.

~An improvement would be to determine if we have a schema for the machine config associated with the provider (rke-machine-config.cattle.io.<provider name>config) before showing the provider icon when creating an rke2 cluster. We should be careful though with how we get the provider name, it should be determined in the same when way we create the machine configs. @nwmac does that approach sound sensible? For instance enabling the open stack node driver meant the schema rke-machine-config.cattle.io.openstackconfigs became available~

Edit: I'm talking junk, enabled node drivers have configs

@aalves08 You're talking about the cloudcacredentialConfig field from the cloudcredential resource? Are we not setting it correctly when created?

bashofmann commented 1 year ago

It should still be possible to add and use custom node drivers, also for RKE2.

jakefhyde commented 1 year ago

@richard-cox FWIW Openstack is technically built-in. There are probably 3 separate categories of node drivers we need to support, embedded, custom (in-tree, i.e. everything available by default third party node driver), and then custom out-of-tree drivers that anyone can write. I don't think it's too much of a stretch on the backend side to generate the custom in-tree schemas (add here: https://github.com/rancher/rancher/blob/01454eb896ea8e46f95daf096afa56c6ad0e3e41/pkg/data/management/machinedriver_data.go#L38-L56) and do best effort for out-of-tree. @snasovich what do you think?

richard-cox commented 1 year ago

@jakefhyde I did some digging, and Vince wrote some docs on this before he left - https://rancher.github.io/dashboard/code-base-works/machine-drivers#driver-binary which help me understand a tad.

I'm not sure why prior to some actions (creating a cloudca cred), the form only shows apiKey. Following that action the form shows no fields, as Alex pointed out, because the schemas/cloudcacredentialconfig resourceFields contains a null value.

Interestingly I'm assuming the BE should translate node driver annotations like publicCredentialFields, privateCredentialFields, etc into schema values. For cloudca their driver does NOT contain any similar node driver annotations

richard-cox commented 1 year ago

Ok, worked out some of the weirdness.

  1. Enable the cloudca node driver on a fresh install
  2. Do not refresh the browser
    • Enabling node driver creates lots of provider specific CRDs. We get new dynamicSchema resource.create notifications for resources, specifically one with an id of cloudcacredentialconfig. We do NOT get a resource.create for schema though, so the UI doesn't know it exists
  3. Try to create a cloud ca.
    • We have no credentials config schema, so fall back on a majorly trimmed down list from the cloudcaconfig schema (just apiKey).
    • The cloud credentials screen even warns Rancher has no built-in support for this driver. We've taken a guess, but consult the driver's documentation for the fields required for authentication.
  4. Refresh... the cloudcacredentialconfig is now available, but contains no resourceFields

So...

gaktive commented 1 year ago

Related backend has moved to 2.7.x Q2 and likely will move to Q3.

@richard-cox & @jakefhyde shall I move this to 2.7.x for now if we're blocked on this? If this is needed, then we'd need to talk with Team 2.

richard-cox commented 1 year ago

Related backend has moved to 2.7.x Q2 and likely will move to Q3.

@richard-cox & @jakefhyde shall I move this to 2.7.x for now if we're blocked on this? If this is needed, then we'd need to talk with Team 2.

We should keep this one to address issue two from my comment above. The other issue from that comment is covered by the other ticket rancher/rancher side

snasovich commented 1 year ago

@richard-cox @gaktive , is there capacity / enough time to ensure no regressions to fix "issue 2" for 2.7.2?

richard-cox commented 1 year ago

In summary

1) This issue only covers issue 2 from https://github.com/rancher/dashboard/issues/8523#issuecomment-1485581660 2) Issue 1 from https://github.com/rancher/dashboard/issues/8523#issuecomment-1485581660 means we have to refresh after enabling the cloud ca node provider 3) The credentials page should show the apiKeys field (as per the credentials page when creating an cloud ca credentials in embedded rke1 interface)

gaktive commented 1 year ago

@snasovich it's a regression so we can get this into 2.7.2.

snasovich commented 1 year ago

@gaktive , oh, I didn't realize it's a regression. Thank you for giving it priority then!

mantis-toboggan-md commented 1 year ago

/backport v2.7.2

gaktive commented 1 year ago

Added QA/None since QA will test this in 2.7.2.

richard-cox commented 1 year ago

I'm adding the comment here for visibility. The fix unblocks users from creating credentials for cloud ca... however it falls back on a generic handler. There's a follow on issue for the maintainers of the node driver to either

markusewalker commented 1 year ago

QA TEST PLAN

Scenarios Scenario Test Case
1 As a standard user, attempt to create a cloud credential for node driver Cloud.ca, delete that credential and add additional cloud credentials
2 As a standard user, attempt to create a cloud credential for node driver Open Telekom Cloud, delete that credential and add additional cloud credentials
markusewalker commented 1 year ago

Tested this against v2.7-head https://github.com/rancher/rancher/commit/1712bf9f7116e25711fd76b99d7ce5672c2d4a23. Please see results below:

ENVIRONMENT DETAILS

TEST RESULT Scenario Test Case Result
1 As a standard user, attempt to create a cloud credential for node driver Cloud.ca, delete that credential and add additional cloud credentials :x:
2 As a standard user, attempt to create a cloud credential for node driver Open Telekom Cloud, delete that credential and add additional cloud credentials :white_check_mark:

VALIDATION STEPS

Scenario 1

  1. As a standard user, attempted to provision a downstream RKE2 node driver using Cloud.ca.
  2. When creating a cloud credential, it never creates and it loops me back as shown below: Apr-04-2023 09-42-54
  3. The cloud credential claims it is Saved, but it does not appear in the Cloud Credentials list in Cluster Management: image

    Scenario 2

  4. As a standard user, attempted to provision a downstream RKE2 node driver using Open Telekom Cloud.
  5. Successfully able to create a cloud credential and it appears in the Cloud Credentials list in Cluster Management: image
  6. Validated that I am able to delete the cloud credential and create a new one as well with no issues.

NOTES I saw the exact behavior (as expected) in the backport issue, so I used the same GIFS here to showcase behavior seen. Reopening this issue due to the failures seen.

richard-cox commented 1 year ago

When the Cloud CA Node driver is enabled - browser is NOT refreshed (issue 1 from https://github.com/rancher/dashboard/issues/8523#issuecomment-1485581660)

When the page is refreshed after enabling the node driver (issue 2 from https://github.com/rancher/dashboard/issues/8523#issuecomment-1485581660)

In terms of when a user creates a credentials when the form shows lots of values...

General OTC works fine because it's schema ("otccredentialconfig") has resourceFields defined

Issue Wise....

Summary

richard-cox commented 1 year ago

Note - Cloud CA credentials can still be created by creating a Node Template, either from the Cluster Manager Node Template list or going down the RKE1 cluster create route and adding it there.

gaktive commented 1 year ago

Pushing to Q4 since Q3 timeline is tight and backend ticket not scheduled.

Internal reference: SURE-6517

gaktive commented 1 year ago

Backend work remains unscheduled, need to check what's going on there.

gaktive commented 4 months ago

Backend remains unscheduled and UI capacity for 2.10.0 needs to be considered.