@highstate/k3s 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ function getServerConnection(server) {
8
8
  port: server2.sshCredentials?.port ?? 22,
9
9
  user: server2.sshCredentials?.user ?? "root",
10
10
  password: server2.sshCredentials?.password,
11
+ privateKey: server2.sshCredentials?.keyPair?.privateKey,
11
12
  dialErrorLimit: 3
12
13
  }));
13
14
  }
@@ -39,13 +40,20 @@ class Server {
39
40
  }
40
41
 
41
42
  function text(array, ...values) {
42
- const str = array.reduce((result, part, i) => result + part + (String(values[i]) || ""), "");
43
- const lines = str.split("\n");
43
+ const str = array.reduce(
44
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
45
+ (result, part, i) => result + part + (values[i] ? String(values[i]) : ""),
46
+ ""
47
+ );
48
+ return trimIndentation(str);
49
+ }
50
+ function trimIndentation(text2) {
51
+ const lines = text2.split("\n");
44
52
  const indent = lines.filter((line) => line.trim() !== "").map((line) => line.match(/^\s*/)?.[0].length ?? 0).reduce((min, indent2) => Math.min(min, indent2), Infinity);
45
53
  return lines.map((line) => line.slice(indent)).join("\n").trim();
46
54
  }
47
55
 
48
- const { inputs, outputs } = forUnit(k3s.cluster);
56
+ const { name, inputs, outputs } = forUnit(k3s.cluster);
49
57
  const server = new Server(inputs.server);
50
58
  const k3sCommand = server.command({
51
59
  id: "k3s",
@@ -59,14 +67,18 @@ const kubeconfigCommand = server.command({
59
67
  const kubeconfig = all([kubeconfigCommand.stdout, server.endpoint]).apply(([kubeconfig2, endpoint]) => kubeconfig2.replace("127.0.0.1", endpoint));
60
68
  var index = outputs({
61
69
  k8sCluster: {
62
- kubeconfig
70
+ name,
71
+ kubeconfig,
72
+ cni: "unknown"
63
73
  },
64
- $terminal: {
65
- image: "ghcr.io/exeteres/highstate/terminal-kubectl",
66
- command: ["bash", "/welcome.sh"],
67
- files: {
68
- "/kubeconfig": kubeconfig,
69
- "/welcome.sh": text`
74
+ $terminals: {
75
+ kubectl: {
76
+ title: "Kubectl",
77
+ image: "ghcr.io/exeteres/highstate/terminal-kubectl",
78
+ command: ["bash", "/welcome.sh"],
79
+ files: {
80
+ "/kubeconfig": kubeconfig,
81
+ "/welcome.sh": text`
70
82
  echo "Connecting to the cluster..."
71
83
  kubectl cluster-info
72
84
 
@@ -75,9 +87,10 @@ var index = outputs({
75
87
 
76
88
  exec script -q -c bash /dev/null
77
89
  `
78
- },
79
- env: {
80
- KUBECONFIG: "/kubeconfig"
90
+ },
91
+ env: {
92
+ KUBECONFIG: "/kubeconfig"
93
+ }
81
94
  }
82
95
  }
83
96
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/k3s",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -16,14 +16,14 @@
16
16
  "generate-cilium": "bash ./scripts/generate-cilium.sh"
17
17
  },
18
18
  "dependencies": {
19
- "@highstate/pulumi": "^0.4.4",
20
- "@pulumi/command": "^1.0.1"
19
+ "@highstate/pulumi": "^0.4.5",
20
+ "@pulumi/command": "^1.0.2"
21
21
  },
22
22
  "peerDependencies": {
23
- "@highstate/library": "workspace:^"
23
+ "@highstate/library": "workspace:^0.4.4"
24
24
  },
25
25
  "devDependencies": {
26
26
  "pkgroll": "^2.5.1"
27
27
  },
28
- "gitHead": "58a1b969cca5dad233f885f2e67185a0384ea1aa"
28
+ "gitHead": "61f6f1b0ff3f97bd7ed5e37c26302f094b892392"
29
29
  }