metropolis/cli/metroctl: implement install ssh

This implements another way of installing metropolis via ssh. It does
this by uploading the files to the target machine and then doing a kexec
into the install environment. If it fails at any point it will print the
error and reboot.

Change-Id: I1ac6538896709c386b053a84903fa04940c1f012
Reviewed-on: https://review.monogon.dev/c/monogon/+/2079
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/cli/metroctl/BUILD.bazel b/metropolis/cli/metroctl/BUILD.bazel
index 6e75400..50dc1eb 100644
--- a/metropolis/cli/metroctl/BUILD.bazel
+++ b/metropolis/cli/metroctl/BUILD.bazel
@@ -19,6 +19,7 @@
     srcs = [
         "cmd_certs.go",
         "cmd_install.go",
+        "cmd_install_ssh.go",
         "cmd_install_usb.go",
         "cmd_k8s_configure.go",
         "cmd_k8scredplugin.go",
@@ -37,6 +38,7 @@
     deps = [
         "//go/clitable",
         "//go/logging",
+        "//go/net/ssh",
         "//metropolis/cli/flagdefs",
         "//metropolis/cli/metroctl/core",
         "//metropolis/node",
@@ -51,13 +53,19 @@
         "//osbase/logtree/proto",
         "//version",
         "@com_github_adrg_xdg//:xdg",
+        "@com_github_schollz_progressbar_v3//:progressbar",
         "@com_github_spf13_cobra//:cobra",
         "@io_bazel_rules_go//go/runfiles:go_default_library",
         "@io_k8s_apimachinery//pkg/apis/meta/v1:meta",
         "@io_k8s_client_go//pkg/apis/clientauthentication/v1:clientauthentication",
         "@org_golang_google_grpc//:grpc",
+        "@org_golang_google_protobuf//proto",
+        "@org_golang_x_crypto//ssh",
+        "@org_golang_x_crypto//ssh/agent",
+        "@org_golang_x_crypto//ssh/terminal",
         "@org_golang_x_net//proxy",
         "@org_golang_x_sync//semaphore",
+        "@org_golang_x_term//:term",
     ],
 )
 
@@ -66,6 +74,7 @@
     data = select({
         ":buildkind_lite": [],
         "//conditions:default": [
+            "//metropolis/cli/takeover",
             "//metropolis/installer:kernel",
             "//metropolis/node:bundle",
         ],