@highstate/k3s 0.7.0 → 0.7.2

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.
@@ -1,57 +1,8 @@
1
- import { remote } from '@pulumi/command';
2
- import { output, forUnit, all } from '@highstate/pulumi';
1
+ import { Server } from '@highstate/common';
2
+ import { text } from '@highstate/contract';
3
3
  import { k3s } from '@highstate/library';
4
-
5
- function getServerConnection(server) {
6
- return output(server).apply((server2) => ({
7
- host: server2.endpoint,
8
- port: server2.sshCredentials?.port ?? 22,
9
- user: server2.sshCredentials?.user ?? "root",
10
- password: server2.sshCredentials?.password,
11
- privateKey: server2.sshCredentials?.privateKey,
12
- dialErrorLimit: 3
13
- }));
14
- }
15
- class Server {
16
- server;
17
- connection;
18
- get endpoint() {
19
- return this.server.endpoint;
20
- }
21
- get hostname() {
22
- return this.server.hostname;
23
- }
24
- constructor(server) {
25
- this.server = output(server);
26
- this.connection = getServerConnection(this.server);
27
- }
28
- command(options) {
29
- return new remote.Command(
30
- options.id,
31
- {
32
- connection: this.connection,
33
- create: options.create,
34
- update: options.update,
35
- delete: options.delete
36
- },
37
- { dependsOn: options.dependsOn }
38
- );
39
- }
40
- }
41
-
42
- function text(array, ...values) {
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");
52
- const indent = lines.filter((line) => line.trim() !== "").map((line) => line.match(/^\s*/)?.[0].length ?? 0).reduce((min, indent2) => Math.min(min, indent2), Infinity);
53
- return lines.map((line) => line.slice(indent)).join("\n").trim();
54
- }
4
+ import { forUnit, all } from '@highstate/pulumi';
5
+ import { Provider, core } from '@pulumi/kubernetes';
55
6
 
56
7
  const { name, inputs, outputs } = forUnit(k3s.cluster);
57
8
  const server = new Server(inputs.server);
@@ -65,11 +16,15 @@ const kubeconfigCommand = server.command({
65
16
  dependsOn: k3sCommand
66
17
  });
67
18
  const kubeconfig = all([kubeconfigCommand.stdout, server.endpoint]).apply(([kubeconfig2, endpoint]) => kubeconfig2.replace("127.0.0.1", endpoint));
19
+ const provider = new Provider(name, { kubeconfig });
20
+ const kubeSystem = core.v1.Namespace.get("kube-system", "kube-system", { provider });
68
21
  var index = outputs({
69
22
  k8sCluster: {
70
- name,
71
- kubeconfig,
72
- cni: "unknown"
23
+ info: {
24
+ id: kubeSystem.metadata.uid,
25
+ name
26
+ },
27
+ kubeconfig
73
28
  },
74
29
  $terminals: {
75
30
  kubectl: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/k3s",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -16,8 +16,11 @@
16
16
  "generate-cilium": "bash ./scripts/generate-cilium.sh"
17
17
  },
18
18
  "dependencies": {
19
- "@highstate/pulumi": "^0.7.0",
20
- "@pulumi/command": "^1.0.2"
19
+ "@highstate/common": "^0.7.2",
20
+ "@highstate/contract": "^0.7.2",
21
+ "@highstate/pulumi": "^0.7.2",
22
+ "@pulumi/command": "^1.0.2",
23
+ "@pulumi/kubernetes": "^4.18.0"
21
24
  },
22
25
  "peerDependencies": {
23
26
  "@highstate/library": "workspace:^0.4.4"
@@ -25,5 +28,5 @@
25
28
  "devDependencies": {
26
29
  "pkgroll": "^2.5.1"
27
30
  },
28
- "gitHead": "2f5227f7b88cf38946e490fc4cdb96127bd8b174"
31
+ "gitHead": "e177535015e0fa3c74ae8ddc0bc6d31b191d2c54"
29
32
  }