rancher / dashboard

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

[BUG] Agent Env Vars without names breaks cluster provisioning #12022

Open alexey-kruchenok opened 1 month ago

alexey-kruchenok commented 1 month ago

Rancher Server Setup

When creating a custom cluster, if in the Rancher UI you open Agent Environment Vars -> Add variable and do not add a variable, the cluster will start creating and generate a defective /var/lib/rancher/rke2/server/manifests/rancher/cluster-agent.yaml

with the following content:

/var/lib/rancher/rke2/server/manifests/rancher/cluster-agent.yaml ...

This will cause the cluster creation process to hang at the step "waiting for cluster agent to connect."

To Reproduce When creating a custom cluster, if in the Rancher UI open

Agent Environment Vars -> Add variable

and do not add a variable, not name not value

Result cluster provision process to hang at the step "waiting for cluster agent to connect."

Expected Result

Enviroment variables without names should be ignored, or error reported

Josh-Diamond commented 1 month ago

This behavior is seen in v2.9.1 as well and is existing behavior, not unique to v2.9.2 -- it is ultimately due to user error, where a blank key/value pair is attempting to be set as an agent env var on a downstream cluster.

This scenario is most likely to be hit via Rancher UI, where it may not be obvious to some users that clicking add variable creates a blank key/value pair, so this could be a future enhancement request, to add validation to prevent this scenario from being hit, but not likely considered a bug.