From 0cfcb72ab3267391fa4081471c7a63df13207da5 Mon Sep 17 00:00:00 2001 From: Nino Kodabande Date: Thu, 5 Sep 2024 17:22:47 -0700 Subject: [PATCH] Remove networkingTunnel from settings Signed-off-by: Nino Kodabande --- e2e/backend.e2e.spec.ts | 2 -- pkg/rancher-desktop/backend/kube/wsl.ts | 4 ++-- pkg/rancher-desktop/backend/wsl.ts | 10 ++-------- pkg/rancher-desktop/config/__tests__/settings.spec.ts | 8 ++------ pkg/rancher-desktop/config/settings.ts | 4 +--- pkg/rancher-desktop/config/settingsImpl.ts | 1 + .../commandServer/__tests__/settingsValidator.spec.ts | 1 - .../main/commandServer/settingsValidator.ts | 11 ++--------- 8 files changed, 10 insertions(+), 31 deletions(-) diff --git a/e2e/backend.e2e.spec.ts b/e2e/backend.e2e.spec.ts index c29efaa0882..3fc8b232aad 100644 --- a/e2e/backend.e2e.spec.ts +++ b/e2e/backend.e2e.spec.ts @@ -155,8 +155,6 @@ test.describe.serial('KubernetesBackend', () => { expectedDefinition['application.adminAccess'] = false; expectedDefinition['virtualMachine.numberCPUs'] = false; expectedDefinition['virtualMachine.memoryInGB'] = false; - } else if (process.platform === 'win32') { - expectedDefinition['experimental.virtualMachine.networkingTunnel'] = false; } const expected: Record = {}; diff --git a/pkg/rancher-desktop/backend/kube/wsl.ts b/pkg/rancher-desktop/backend/kube/wsl.ts index 5815debdec7..6e72097d0a1 100644 --- a/pkg/rancher-desktop/backend/kube/wsl.ts +++ b/pkg/rancher-desktop/backend/kube/wsl.ts @@ -227,10 +227,10 @@ export default class WSLKubernetesBackend extends events.EventEmitter implements } await util.promisify(timers.setTimeout)(1_000); } - const rdNetworking = `--rd-networking=${ config?.experimental.virtualMachine.networkingTunnel }`; + // TODO: remove once --rd-networking removed from k3s_kubeconfig.go await this.k3sHelper.updateKubeconfig( - async() => await this.vm.execCommand({ capture: true }, await this.vm.getWSLHelperPath(), 'k3s', 'kubeconfig', rdNetworking)); + async() => await this.vm.execCommand({ capture: true }, await this.vm.getWSLHelperPath(), 'k3s', 'kubeconfig', '--rd-networking=true')); }); const client = this.client = kubeClient?.() || new KubeClient(); diff --git a/pkg/rancher-desktop/backend/wsl.ts b/pkg/rancher-desktop/backend/wsl.ts index 1f19a94f60e..531879cf87c 100644 --- a/pkg/rancher-desktop/backend/wsl.ts +++ b/pkg/rancher-desktop/backend/wsl.ts @@ -1294,13 +1294,7 @@ export default class WSLBackend extends events.EventEmitter implements VMBackend }), this.progressTracker.action('Configuring image proxy', 50, async() => { const allowedImagesConf = '/usr/local/openresty/nginx/conf/allowed-images.conf'; - let resolver; - - if (this.cfg?.experimental.virtualMachine.networkingTunnel) { - resolver = `resolver ${ rdNetworkingDNS } ipv6=off;\n`; - } else { - resolver = `resolver ${ await this.ipAddress } ipv6=off;\n`; - } + const resolver = `resolver ${ rdNetworkingDNS } ipv6=off;\n`; await this.writeFile(`/usr/local/openresty/nginx/conf/nginx.conf`, NGINX_CONF, 0o644); await this.writeFile(`/usr/local/openresty/nginx/conf/resolver.conf`, resolver, 0o644); @@ -1650,7 +1644,7 @@ export default class WSLBackend extends events.EventEmitter implements VMBackend } return Promise.resolve(this.kubeBackend.requiresRestartReasons( - this.cfg, cfg, { 'experimental.virtualMachine.networkingTunnel': { current: this.cfg.experimental.virtualMachine.networkingTunnel } })); + this.cfg, cfg)); } /** diff --git a/pkg/rancher-desktop/config/__tests__/settings.spec.ts b/pkg/rancher-desktop/config/__tests__/settings.spec.ts index 64ac3c4734e..a2243f17fb5 100644 --- a/pkg/rancher-desktop/config/__tests__/settings.spec.ts +++ b/pkg/rancher-desktop/config/__tests__/settings.spec.ts @@ -354,7 +354,6 @@ describe('settings', () => { }, experimental: { virtualMachine: { - networkingTunnel: true, }, }, kubernetes: { @@ -472,8 +471,7 @@ describe('settings', () => { version: settings.CURRENT_SETTINGS_VERSION, experimental: { virtualMachine: { - networkingTunnel: true, - proxy: { + proxy: { noproxy: ['1.2.3.4', '11.12.13.14', '21.22.23.24'], }, }, @@ -506,8 +504,7 @@ describe('settings', () => { version: settings.CURRENT_SETTINGS_VERSION, experimental: { virtualMachine: { - networkingTunnel: true, - proxy: { + proxy: { noproxy: ['1.2.3.4', '11.12.13.14', '21.22.23.24'], }, }, @@ -587,7 +584,6 @@ describe('settings', () => { }, experimental: { virtualMachine: { - networkingTunnel: true, }, }, kubernetes: {}, diff --git a/pkg/rancher-desktop/config/settings.ts b/pkg/rancher-desktop/config/settings.ts index 87a2b0098ee..2a1ac8b522e 100644 --- a/pkg/rancher-desktop/config/settings.ts +++ b/pkg/rancher-desktop/config/settings.ts @@ -132,9 +132,7 @@ export const defaultSettings = { cacheMode: CacheMode.MMAP, }, }, - /* windows only: legacy setting, always ignored */ - networkingTunnel: true, - proxy: { + proxy: { enabled: false, address: '', password: '', diff --git a/pkg/rancher-desktop/config/settingsImpl.ts b/pkg/rancher-desktop/config/settingsImpl.ts index e08d4c2a005..06a6d15203e 100644 --- a/pkg/rancher-desktop/config/settingsImpl.ts +++ b/pkg/rancher-desktop/config/settingsImpl.ts @@ -487,6 +487,7 @@ export const updateTable: Record vo }, 13: (settings) => { _.unset(settings, 'virtualMachine.hostResolver'); + _.unset(settings, 'experimental.virtualMachine.networkingTunnel'); }, }; diff --git a/pkg/rancher-desktop/main/commandServer/__tests__/settingsValidator.spec.ts b/pkg/rancher-desktop/main/commandServer/__tests__/settingsValidator.spec.ts index 655da2f7a05..0271d4acc68 100644 --- a/pkg/rancher-desktop/main/commandServer/__tests__/settingsValidator.spec.ts +++ b/pkg/rancher-desktop/main/commandServer/__tests__/settingsValidator.spec.ts @@ -78,7 +78,6 @@ describe(SettingsValidator, () => { ['experimental', 'virtualMachine', 'mount', '9p', 'protocolVersion'], ['experimental', 'virtualMachine', 'mount', '9p', 'securityModel'], ['experimental', 'virtualMachine', 'mount', 'type'], - ['experimental', 'virtualMachine', 'networkingTunnel'], // Cannot be set ['experimental', 'virtualMachine', 'type'], ['experimental', 'virtualMachine', 'useRosetta'], ['experimental', 'virtualMachine', 'proxy', 'noproxy'], diff --git a/pkg/rancher-desktop/main/commandServer/settingsValidator.ts b/pkg/rancher-desktop/main/commandServer/settingsValidator.ts index 71ec2ee08a0..27a7604a8b3 100644 --- a/pkg/rancher-desktop/main/commandServer/settingsValidator.ts +++ b/pkg/rancher-desktop/main/commandServer/settingsValidator.ts @@ -122,15 +122,8 @@ export default class SettingsValidator { cacheMode: this.checkLima(this.check9P(this.checkEnum(...Object.values(CacheMode)))), }, }, - // networkingTunnel only applies to Win32, but deployment profiles on macOS/Linux may still include - // the setting. Since we changed the default value, this would now throw a validation error. - // see https://github.com/rancher-sandbox/rancher-desktop/issues/6953 - // The setting will be removed once the legacy Windows networking mode is disabled, so until - // then we will allow changing the setting on all platforms to avoid the profile error. - // Changing the setting will have no effect on macOS/Linux anyways.1 - networkingTunnel: this.checkUnchanged, - useRosetta: this.checkPlatform('darwin', this.checkRosetta), - type: this.checkPlatform('darwin', this.checkMulti( + useRosetta: this.checkPlatform('darwin', this.checkRosetta), + type: this.checkPlatform('darwin', this.checkMulti( this.checkEnum(...Object.values(VMType)), this.checkVMType), ),