Skip to content

Windows deployment deletes/resets custom entries from System PATH variable #8111

Description

@ShadowLNC

Describe the bug

When deploying Antrea, it will wipe out the Windows system path variable and effectively reset it to the default.

To Reproduce

  1. Modify system $PATH (e.g. through an Ansible script or Prepare-Node.ps1 when installing Kubernetes)
  2. Deploy antrea-windows-with-ovs.yml as per docs

Expected

If $env:PATH is modified, it must not erase my existing customisations

Actual behavior

System PATH (outside of container) is set to:

C:\Windows\system32;C:\Windows;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\wbem;C:\hpc\;C:\WINDOWS\System32\Wbem;C:\openvswitch\usr\bin

This appears to be due to Install-OVS.ps1 line 101 writing $env:PATH back to the system variable, which appears to be a minimal path value provided by the container, not the $env:PATH value from the host.

This approach (of writing back $env:PATH) is wrong in and of itself, because $env:PATH will include the user's path, which then gets merged into the system path.

Versions:

Kubernetes v1.33
Antrea 2.6.1
CNIplugins 1.6.2
Microsoft CNI plugins 0.3.1
containerd 2.3.1
nerdctl 2.3.1

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions