Skip to content

[main] provisioning cluster: remove carriage returns from agentEnvVars values - #1789

Open
vardhaman22 wants to merge 3 commits into
rancher:mainfrom
vardhaman22:fix-provisioning-cluster-agent-env-vars
Open

[main] provisioning cluster: remove carriage returns from agentEnvVars values#1789
vardhaman22 wants to merge 3 commits into
rancher:mainfrom
vardhaman22:fix-provisioning-cluster-agent-env-vars

Conversation

@vardhaman22

@vardhaman22 vardhaman22 commented Aug 18, 2026

Copy link
Copy Markdown

Issue:

rancher/rancher#50213

Problem

When configuring a provisioning cluster's agent environment variables from a file on UI, values containing DOS/Windows line endings (\r\n) retain the trailing carriage return.
These carriage returns are propagated to the generated node registration command, resulting in malformed environment variable values

Solution

Update the provisioning cluster mutating webhook to normalize agentEnvVars values during Create and Update operations.

The normalization removes trailing carriage return (\r) and newline (\n) characters while preserving any newline characters within the value.

CheckList

  • Test
  • Docs

@vardhaman22 vardhaman22 changed the title provisioning cluster: remove carriage returns from agentEnvVars value… provisioning cluster: remove carriage returns from agentEnvVars values Aug 18, 2026
@vardhaman22 vardhaman22 changed the title provisioning cluster: remove carriage returns from agentEnvVars values [main] provisioning cluster: remove carriage returns from agentEnvVars values Aug 18, 2026
@vardhaman22
vardhaman22 force-pushed the fix-provisioning-cluster-agent-env-vars branch from 25e058b to a912a74 Compare August 18, 2026 16:15
@vardhaman22
vardhaman22 marked this pull request as ready for review August 18, 2026 16:38
@vardhaman22
vardhaman22 requested a review from a team as a code owner August 18, 2026 16:38

@crobby crobby left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good. Is there any chance of \r or \n in the middle of the value that would need stripping or is this expected to be sufficient?

Also, is this change worthy of being noted in the mutator's doc?

@HarrisonWAffel HarrisonWAffel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Chad, we'll need to update the documentation as well. IIUC this was preventing users from registering nodes entirely, so I don't know if there are any migration / existing cluster concerns here, but something to think about

@HarrisonWAffel
HarrisonWAffel requested a review from a team August 18, 2026 19:08
@vardhaman22

Copy link
Copy Markdown
Author

Seems good. Is there any chance of \r or \n in the middle of the value that would need stripping or is this expected to be sufficient?

kept the behavior same except the line endings since the issue was reported explicitly for the line endings.

@HarrisonWAffel
HarrisonWAffel requested a review from a team August 19, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants