diff --git a/02-k8s-bootstrap/index.ts b/02-k8s-bootstrap/index.ts index c839745..85dd015 100644 --- a/02-k8s-bootstrap/index.ts +++ b/02-k8s-bootstrap/index.ts @@ -255,7 +255,7 @@ const joinWorker3 = new command.remote.Command( const workers = [worker1Ip, worker2Ip, worker3Ip]; const workerSshReader = [waitWorker1Ssh, waitWorker2Ssh, waitWorker3Ssh]; -const mountLonghornDisks = workers.map((worker, i) => { +workers.forEach((worker, i) => { return new command.remote.Command( `mount-longhorn-disk-${i}`, { @@ -287,6 +287,61 @@ const getKubeconfig = new command.remote.Command( { dependsOn: [joinWorker1, joinWorker2, joinWorker3] }, ); +// --------------------------------------------------------------------------- +// Step 7: Install additional packages +// --------------------------------------------------------------------------- + +const allVms = [ + { + id: master1VmId, + ip: master1Ip, + name: "master-1", + readiness: waitMaster1Ssh, + }, + { + id: master2VmId, + ip: master2Ip, + name: "master-2", + readiness: waitMaster2Ssh, + }, + { + id: master3VmId, + ip: master3Ip, + name: "master-3", + readiness: waitMaster3Ssh, + }, + { + id: worker1VmId, + ip: worker1Ip, + name: "worker-1", + readiness: waitWorker1Ssh, + }, + { + id: worker2VmId, + ip: worker2Ip, + name: "worker-2", + readiness: waitWorker2Ssh, + }, + { + id: worker3VmId, + ip: worker3Ip, + name: "worker-3", + readiness: waitWorker3Ssh, + }, +]; + +allVms.forEach(({ id, ip, name, readiness }) => { + new command.remote.Command( + `install-packages-${name}`, + { + connection: conn(ip), + create: pulumi.interpolate`sudo apt update && sudo apt install -y qemu-guest-agent && sudo systemctl enable --now qemu-guest-agent`, + triggers: [id], + }, + { dependsOn: readiness }, + ); +}); + export const kubeconfig = pulumi.secret( pulumi .all([getKubeconfig.stdout, master1Ip])