Skip to content

Commit d869fcb

Browse files
committed
Remove code causing node roles to be deleted
At one point we renamed the instance from lima-rancher-desktop to lima-0. The rancher-desktop and 0 are names passed to lima. The full name shows up in the socket path which has a limited number of characters. The shorter the name the better. Recently, we set the host name back to rancher-desktop. This is internal to the OS running on the node and not lima. This caused the node name to again be lima-rancher-desktop. The code deleted in this change removes the cleanup. The cleanup was deleting the node. It was then being added back by k3s without any roles on it. Closes #667 Signed-off-by: Matt Farina <matt.farina@suse.com>
1 parent 07036d8 commit d869fcb

2 files changed

Lines changed: 0 additions & 20 deletions

File tree

src/k8s-engine/client.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -533,20 +533,4 @@ export class KubeClient extends events.EventEmitter {
533533
});
534534
});
535535
}
536-
537-
/**
538-
* Clean up obsolete nodes that match a predicate.
539-
* @param predicate A function that returns true if a node should be removed.
540-
*/
541-
async cleanupNodes(predicate: (node: k8s.V1Node) => boolean) {
542-
const { body: nodeList } = await this.coreV1API.listNode();
543-
const promises = nodeList
544-
.items
545-
.filter(predicate)
546-
.map(node => node.metadata?.name)
547-
.filter(defined)
548-
.map(nodeName => this.coreV1API.deleteNode(nodeName));
549-
550-
return await Promise.all(promises);
551-
}
552536
}

src/k8s-engine/lima.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,6 @@ export default class LimaBackend extends events.EventEmitter implements K8s.Kube
673673
this.emit('service-changed', services);
674674
});
675675

676-
// We need to remove obsolete nodes because we renamed the VM; otherwise
677-
// they get stuck forever. No need to wait for the result.
678-
this.client.cleanupNodes(node => node.metadata?.name === 'lima-rancher-desktop');
679-
680676
this.activeVersion = desiredShortVersion;
681677
this.currentPort = this.#desiredPort;
682678
this.emit('current-port-changed', this.currentPort);

0 commit comments

Comments
 (0)