Skip to content

Commit

Permalink
Merge pull request #4556 from rancher-sandbox/re-enable-guest-agent-r…
Browse files Browse the repository at this point in the history
…d-networking

Re-enable GuestAgent for RD Networking
  • Loading branch information
Nino-K authored Apr 27, 2023
2 parents 5b52818 + b245d59 commit 05a20a8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pkg/rancher-desktop/backend/wsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -831,12 +831,12 @@ export default class WSLBackend extends events.EventEmitter implements VMBackend
const enableKubernetes = K3sHelper.requiresPortForwardingFix(kubeVersion);
const rdNetworking = !!cfg?.experimental.virtualMachine.networkingTunnel;

if (this.privilegedServiceEnabled) {
if (rdNetworking || this.privilegedServiceEnabled) {
guestAgentConfig = {
LOG_DIR: await this.wslify(paths.logs),
GUESTAGENT_KUBERNETES: enableKubernetes ? 'true' : 'false',
GUESTAGENT_IPTABLES: enableKubernetes ? 'false' : 'true', // only enable IPTABLES for older K8s
GUESTAGENT_PRIVILEGED_SERVICE: 'true',
GUESTAGENT_PRIVILEGED_SERVICE: rdNetworking ? 'false' : 'true',
GUESTAGENT_CONTAINERD: cfg?.containerEngine.name === ContainerEngine.CONTAINERD ? 'true' : 'false',
GUESTAGENT_DOCKER: cfg?.containerEngine.name === ContainerEngine.MOBY ? 'true' : 'false',
GUESTAGENT_DEBUG: this.debug ? 'true' : 'false',
Expand All @@ -852,6 +852,7 @@ export default class WSLBackend extends events.EventEmitter implements VMBackend
GUESTAGENT_K8S_SVC_ADDR: '127.0.0.1', // always use localhost for non-privileged installation/user
};
}

const guestAgentPath = path.join(paths.resources, 'linux', 'internal', 'rancher-desktop-guestagent');

await Promise.all([
Expand All @@ -860,13 +861,6 @@ export default class WSLBackend extends events.EventEmitter implements VMBackend
this.writeConf('rancher-desktop-guestagent', guestAgentConfig),
]);
await this.execCommand('/sbin/rc-update', 'add', 'rancher-desktop-guestagent', 'default');

// Stop the service if RD Networking is enabled. We need to add it
// first as rc-service del … fails if the service is not enabled,
// but rc-service add … handles an already-enabled service fine.
if (rdNetworking) {
await this.execCommand('/sbin/rc-update', 'del', 'rancher-desktop-guestagent', 'default');
}
}

/**
Expand Down

0 comments on commit 05a20a8

Please sign in to comment.