Skip to content

Contexts aren't added/deleted from the Tray menu on Linux platforms #3765

@torchiaf

Description

@torchiaf

Actual Behavior

Contexts aren't added/deleted from the Tray menu until restarting Rancher Desktop.

Steps to Reproduce

Reproduction steps make use of k3d

  1. Start Rancher Desktop and wait for Kubernetes is running state in tray
  2. Create a new cluster in k3d (k3d cluster create test-cluster)
  3. Open the tray menu and hover over Kubernetes Contexts
  4. Observe that test cluster is missing from the list of Kubernetes Contexts
  5. Restart Rancher Desktop and wait for Kubernetes is running state
  6. Observe that test cluster is present in the list of Kubernetes Contexts

Result

Contexts aren't added/deleted from the Tray menu until restarting Rancher Desktop.

Expected Behavior

Contexts are added/deleted from the Tray menu immediately.

Additional Information

There is an uncaught exception from fs.watch

const options: fs.WatchOptions = {
persistent: false,
recursive: true,
encoding: 'utf-8',
signal: abortController.signal,
};

Exception message:

(node:12162) UnhandledPromiseRejectionWarning: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
    at new NodeError (node:internal/errors:372:5)
    at Object.watch (node:fs:2262:11)
    at /home/francesco/WORK/rancher/rancher-desktop/dist/app/background.js:54887:73
    at Array.map (<anonymous>)
    at Tray.watchForChanges (/home/francesco/WORK/rancher/rancher-desktop/dist/app/background.js:54887:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
(node:12162) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) 

The recursive option is not available on Linux when watching directories (Node verion >= 14) but it seems that will be introduced in next Node.js versions (18.x)
nodejs/node#45098

Rancher Desktop Version

1.7.x

Rancher Desktop K8s Version

any

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Other Linux

Operating System / Build Version

Linux

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions