Add personal ssh key addition so we can ssh lol
This commit is contained in:
@@ -59,6 +59,7 @@
|
|||||||
(defn create-cluster []
|
(defn create-cluster []
|
||||||
(let [cfg (pulumi/Config.)
|
(let [cfg (pulumi/Config.)
|
||||||
ssh-key (.require cfg "sshKeyName")
|
ssh-key (.require cfg "sshKeyName")
|
||||||
|
personal-key (.require cfg "sshPersonalKeyName")
|
||||||
priv-key (.requireSecret cfg "privateKeySsh")
|
priv-key (.requireSecret cfg "privateKeySsh")
|
||||||
|
|
||||||
firewall (hcloud/Firewall.
|
firewall (hcloud/Firewall.
|
||||||
@@ -73,7 +74,7 @@
|
|||||||
(clj->js {:serverType "cx22"
|
(clj->js {:serverType "cx22"
|
||||||
:image "ubuntu-22.04"
|
:image "ubuntu-22.04"
|
||||||
:location "fsn1"
|
:location "fsn1"
|
||||||
:sshKeys [ssh-key]
|
:sshKeys [ssh-key personal-key]
|
||||||
:firewallIds [(.-id firewall)]}))
|
:firewallIds [(.-id firewall)]}))
|
||||||
|
|
||||||
master-ip (.-ipv4Address master)
|
master-ip (.-ipv4Address master)
|
||||||
@@ -96,16 +97,19 @@
|
|||||||
:create "sudo cat /var/lib/rancher/k3s/server/node-token"})
|
:create "sudo cat /var/lib/rancher/k3s/server/node-token"})
|
||||||
(clj->js {:dependsOn [install-master]}))
|
(clj->js {:dependsOn [install-master]}))
|
||||||
|
|
||||||
worker-script
|
worker-script
|
||||||
(.apply (pulumi/all [master-ip (.-stdout token-cmd)])
|
(.apply master-ip
|
||||||
(fn [[ip token]] (install-worker-script ip (.trim token))))
|
(fn [ip]
|
||||||
|
(.apply (.-stdout token-cmd)
|
||||||
|
(fn [token]
|
||||||
|
(install-worker-script ip (.trim token))))))
|
||||||
|
|
||||||
worker-de (hcloud/Server.
|
worker-de (hcloud/Server.
|
||||||
"k3s-worker-de"
|
"k3s-worker-de"
|
||||||
(clj->js {:serverType "cx22"
|
(clj->js {:serverType "cx22"
|
||||||
:image "ubuntu-22.04"
|
:image "ubuntu-22.04"
|
||||||
:location "fsn1"
|
:location "fsn1"
|
||||||
:sshKeys [ssh-key]
|
:sshKeys [ssh-key personal-key]
|
||||||
:userData worker-script
|
:userData worker-script
|
||||||
:firewallIds [(.-id firewall)]}))
|
:firewallIds [(.-id firewall)]}))
|
||||||
|
|
||||||
@@ -114,7 +118,7 @@
|
|||||||
(clj->js {:serverType "cpx11"
|
(clj->js {:serverType "cpx11"
|
||||||
:image "ubuntu-22.04"
|
:image "ubuntu-22.04"
|
||||||
:location "ash"
|
:location "ash"
|
||||||
:sshKeys [ssh-key]
|
:sshKeys [ssh-key personal-key]
|
||||||
:userData worker-script
|
:userData worker-script
|
||||||
:firewallIds [(.-id firewall)]}))
|
:firewallIds [(.-id firewall)]}))
|
||||||
|
|
||||||
@@ -125,18 +129,20 @@
|
|||||||
:create (.apply master-ip
|
:create (.apply master-ip
|
||||||
(fn [ip]
|
(fn [ip]
|
||||||
(str "sudo sed 's/127.0.0.1/" ip "/' /etc/rancher/k3s/k3s.yaml")))})
|
(str "sudo sed 's/127.0.0.1/" ip "/' /etc/rancher/k3s/k3s.yaml")))})
|
||||||
(clj->js {:dependsOn [install-master]}))
|
(clj->js {:dependsOn [install-master worker-de worker-us]}))
|
||||||
|
|
||||||
label-node
|
label-node
|
||||||
(local/Command.
|
(local/Command.
|
||||||
"label-german-node"
|
"label-german-node-alt"
|
||||||
(clj->js {:create (.apply (pulumi/all [(.-stdout kubeconfig-cmd) (.-name worker-de)])
|
(clj->js {:create (.apply (.-stdout kubeconfig-cmd)
|
||||||
(fn [[kubeconfig worker-name]]
|
(fn [kubeconfig]
|
||||||
(let [path "./kubeconfig.yaml"]
|
(.apply (.-name worker-de)
|
||||||
(.writeFileSync fs path kubeconfig)
|
(fn [worker-name]
|
||||||
(str "kubectl --kubeconfig=" path
|
(let [path "./kubeconfig.yaml"]
|
||||||
" label node " worker-name
|
(.writeFileSync fs path kubeconfig)
|
||||||
" location=de --overwrite"))))})
|
(str "kubectl --kubeconfig=" path
|
||||||
|
" label node " worker-name
|
||||||
|
" location=de --overwrite"))))))})
|
||||||
(clj->js {:dependsOn [kubeconfig-cmd]}))]
|
(clj->js {:dependsOn [kubeconfig-cmd]}))]
|
||||||
|
|
||||||
{:masterIp master-ip
|
{:masterIp master-ip
|
||||||
|
|||||||
Reference in New Issue
Block a user