fix: Skip proxy vars in SUC env resurrection so deletion propagates - #393
Open
pratikjagrut wants to merge 1 commit into
Open
pratikjagrut wants to merge 1 commit into
pratikjagrut wants to merge 1 commit into
Conversation
pratikjagrut
requested review from
a team,
HarrisonWAffel and
jakefhyde
as code owners
July 13, 2026 11:34
There was a problem hiding this comment.
Pull request overview
Fixes SUC (system-upgrade-controller) “env resurrection” behavior so deleting proxy-related env vars on downstream clusters actually clears them from /etc/systemd/system/rancher-system-agent.env.
Changes:
- Preserve
=characters in parsed env-file values by switching${line##*=}to${line#*=}. - Prevent stale proxy values from being re-exported by skipping
HTTP_PROXY/HTTPS_PROXY/NO_PROXY(and lowercase variants) when rehydrating env from the existing systemd env file.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -45,14 +45,26 @@ export CATTLE_AGENT_UNINSTALL_LOCAL=true | |||
| export CATTLE_AGENT_BINARY_LOCAL_LOCATION=${TMPDIR}/rancher-system-agent | |||
| export CATTLE_AGENT_UNINSTALL_LOCAL_LOCATION=${TMPDIR}/rancher-system-agent-uninstall.sh | |||
| if [ -s /host/etc/systemd/system/rancher-system-agent.env ]; then | |||
Contributor
There was a problem hiding this comment.
It will be simpler to remove this whole if block entirely.
The only variables that install.sh writes to the env file are the proxy variables anyways, and potentially the adjusted PATH like you mentioned, but this is unlikely to be ever empty here so it won't be exported, and it will be re-adjusted by install.sh anyways.
pratikjagrut
force-pushed
the
SURE-6828
branch
from
September 1, 2026 13:57
5760df9 to
9fb39a7
Compare
pedromfcarvalho
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Deleting an agent env var (
HTTP_PROXY/HTTPS_PROXY/NO_PROXY) on a downstream cluster doesn't propagate — the old value persists in/etc/systemd/system/rancher-system-agent.env.Fixes SURE-6828 / rancher/rancher#45210
Cause
package/suc/run.shre-exports vars from the existing env file before runninginstall.sh. On delete, the plan correctly omits the var, but the loop resurrects the stale value from the old file andcreate_env_filewrites it back.Fix
Skip proxy vars in the loop so the SUC plan env is the source of truth (present → written, absent → cleared).
PATHandother vars still preserved. Also fix
${line##*=}→${line#*=}for values containing=.Testing
Set → update → delete
NO_PROXYon a downstream cluster with the patched-sucimage: value now clears on delete. No regression for set/update/no-proxy cases.