rancher / capi-ui-extension

Rancher Extension used in rancher/dashboard for Rancher Turtles CAPI Provisioning UI.
Apache License 2.0
8 stars 7 forks source link

Mark provider name optional for Custom providers, and remove for predefined #64

Open Danil-Grigorev opened 1 month ago

Danil-Grigorev commented 1 month ago

The CAPIProvider since v0.8.0 no longer requires spec.name to be specified at all times. In case when it is not set, it uses metadata.name, so this field can be marked as optional.

It makes sense to specify spec.name only if the kind of provider is unknown. For existing set of providers like Docker, AWS, etc., the default one for the applied resource coming from UI code is enough.

Why

This will remove ambiguity. Users may supply a name for docker provider like aws and install aws provider under docker label.

image
eva-vashkevich commented 1 day ago

Hi @Danil-Grigorev, the "Name" field from your screenshot sets metadata.name field. We only allow user to provide spec.name when creating Custom provider ('Provider' field). Are you suggesting we should not be asking the user to provide metadata.name and supply the name ourselves instead?

Danil-Grigorev commented 20 hours ago

I’m not aware of the internals that much to tell that metadata.name is set or the spec.name is. I’m suggesting that for known provider types, which are known in the UI tiles it should not be possible to supply a name at all. The UI always knows it in advance. Example: docker is always docker, aws is always aws. If you call aws as my-aws, it is still the same aws provider, and on top of that there shall not allow creation of duplicate providers in the cluster (read: creating duplicate CAPIProvider with the same spec.type)

eva-vashkevich commented 20 hours ago

Hi @kwwii, what do you think?