Skip to content

Commit

Permalink
Remove networkingTunnel from settings
Browse files Browse the repository at this point in the history
Signed-off-by: Nino Kodabande <[email protected]>
  • Loading branch information
Nino-K committed Sep 6, 2024
1 parent a7d0923 commit 0cfcb72
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 31 deletions.
2 changes: 0 additions & 2 deletions e2e/backend.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, {current: any, desired: any, severity: 'reset' | 'restart'}> = {};
Expand Down
4 changes: 2 additions & 2 deletions pkg/rancher-desktop/backend/kube/wsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 2 additions & 8 deletions pkg/rancher-desktop/backend/wsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}

/**
Expand Down
8 changes: 2 additions & 6 deletions pkg/rancher-desktop/config/__tests__/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ describe('settings', () => {
},
experimental: {
virtualMachine: {
networkingTunnel: true,
},
},
kubernetes: {
Expand Down Expand Up @@ -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'],
},
},
Expand Down Expand Up @@ -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'],
},
},
Expand Down Expand Up @@ -587,7 +584,6 @@ describe('settings', () => {
},
experimental: {
virtualMachine: {
networkingTunnel: true,
},
},
kubernetes: {},
Expand Down
4 changes: 1 addition & 3 deletions pkg/rancher-desktop/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ export const defaultSettings = {
cacheMode: CacheMode.MMAP,
},
},
/* windows only: legacy setting, always ignored */
networkingTunnel: true,
proxy: {
proxy: {
enabled: false,
address: '',
password: '',
Expand Down
1 change: 1 addition & 0 deletions pkg/rancher-desktop/config/settingsImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ export const updateTable: Record<number, (settings: any, locked : boolean) => vo
},
13: (settings) => {
_.unset(settings, 'virtualMachine.hostResolver');
_.unset(settings, 'experimental.virtualMachine.networkingTunnel');
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
11 changes: 2 additions & 9 deletions pkg/rancher-desktop/main/commandServer/settingsValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
Expand Down

0 comments on commit 0cfcb72

Please sign in to comment.