@highstate/library 0.9.10 → 0.9.11

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/library",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -19,12 +19,12 @@
19
19
  "build": "highstate build --library"
20
20
  },
21
21
  "dependencies": {
22
- "@highstate/contract": "^0.9.10",
22
+ "@highstate/contract": "^0.9.11",
23
23
  "@sinclair/typebox": "^0.34.11",
24
24
  "remeda": "^2.21.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@highstate/cli": "^0.9.10"
27
+ "@highstate/cli": "^0.9.11"
28
28
  },
29
- "gitHead": "aacf8837fdf40f2bb2f83d4c11b35a358e26ec33"
29
+ "gitHead": "d62cae30ea9fadaa1aa4fb3b5734a16cf53810ce"
30
30
  }
@@ -0,0 +1,20 @@
1
+ import { defineUnit } from "@highstate/contract"
2
+ import { createArgs, createInputs, createSource } from "./shared"
3
+
4
+ export const hubble = defineUnit({
5
+ type: "apps.hubble",
6
+
7
+ args: createArgs("hubble", ["fqdn"]),
8
+ inputs: createInputs(["accessPoint"]),
9
+
10
+ meta: {
11
+ displayName: "Hubble",
12
+ description:
13
+ "Exposes Hubble UI to the user. It must be already installed in the cluster as part of the Cilium.",
14
+ primaryIcon: "mdi:eye",
15
+ secondaryIcon: "simple-icons:cilium",
16
+ category: "Observability",
17
+ },
18
+
19
+ source: createSource("hubble"),
20
+ })
package/src/apps/index.ts CHANGED
@@ -13,5 +13,6 @@ export * from "./maybe"
13
13
  export * from "./deployment"
14
14
  export * from "./syncthing"
15
15
  export * from "./code-server"
16
+ export * from "./hubble"
16
17
 
17
18
  export { createArgs, createInputs } from "./shared"
package/src/k3s.ts CHANGED
@@ -1,10 +1,48 @@
1
1
  import { defineUnit, Type } from "@highstate/contract"
2
2
  import { clusterInputs, clusterOutputs } from "./k8s"
3
3
 
4
+ export const packagedComponents = [
5
+ "coredns",
6
+ "servicelb",
7
+ "traefik",
8
+ "local-storage",
9
+ "metrics-server",
10
+ "runtimes",
11
+ ] as const
12
+
13
+ export const internalComponents = [
14
+ "scheduler",
15
+ "cloud-controller",
16
+ "kube-proxy",
17
+ "network-policy",
18
+ "helm-controller",
19
+ ] as const
20
+
21
+ export const componentSchema = Type.StringEnum([...packagedComponents, ...internalComponents])
22
+
23
+ export const cniSchema = Type.StringEnum(["none", "flannel"])
24
+
4
25
  export const cluster = defineUnit({
5
26
  type: "k3s.cluster",
6
27
 
7
28
  args: {
29
+ /**
30
+ * The components to disable in the K3S cluster.
31
+ *
32
+ * @schema
33
+ */
34
+ disabledComponents: Type.Default(Type.Array(componentSchema), []),
35
+
36
+ /**
37
+ * The CNI to use in the K3S cluster.
38
+ *
39
+ * Setting this to "none" will disable default Flannel CNI, but will not disable network policy controller and kube-proxy.
40
+ * If needed, you can disable them using `disabledComponents` argument.
41
+ *
42
+ * @schema
43
+ */
44
+ cni: Type.Default(cniSchema, "flannel"),
45
+
8
46
  /**
9
47
  * The K3S configuration to pass to each server or agent in the cluster.
10
48
  *
package/src/k8s.ts CHANGED
@@ -117,6 +117,13 @@ export const clusterInfoProperties = {
117
117
  * @schema
118
118
  */
119
119
  quirks: Type.Optional(clusterQuirksSchema),
120
+
121
+ /**
122
+ * The extra metadata to attach to the cluster.
123
+ *
124
+ * @schema
125
+ */
126
+ metadata: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
120
127
  } as const
121
128
 
122
129
  export const serviceTypeSchema = Type.StringEnum(["NodePort", "LoadBalancer", "ClusterIP"])
@@ -331,7 +338,7 @@ export const clusterPatch = defineUnit({
331
338
  })
332
339
 
333
340
  export const clusterDns = defineUnit({
334
- type: "cluster-dns",
341
+ type: "k8s.cluster-dns",
335
342
 
336
343
  args: {
337
344
  ...dns.createArgs(),
@@ -587,6 +594,42 @@ export const gatewayApi = defineUnit({
587
594
  },
588
595
  })
589
596
 
597
+ export const cilium = defineUnit({
598
+ type: "k8s.cilium",
599
+
600
+ args: {
601
+ /**
602
+ * If set to `true`, the generated network policy will allow
603
+ * all DNS queries to be resolved, even if they are
604
+ * for forbidden (non-allowed) FQDNs.
605
+ *
606
+ * By default, is `false`.
607
+ */
608
+ allowForbiddenFqdnResolution: Type.Default(Type.Boolean(), false),
609
+ },
610
+
611
+ inputs: {
612
+ k8sCluster: clusterEntity,
613
+ },
614
+
615
+ outputs: {
616
+ k8sCluster: clusterEntity,
617
+ },
618
+
619
+ meta: {
620
+ displayName: "Cilium",
621
+ description: "The Cilium CNI deployed on Kubernetes.",
622
+ primaryIcon: "simple-icons:cilium",
623
+ secondaryIcon: "devicon:kubernetes",
624
+ category: "Kubernetes",
625
+ },
626
+
627
+ source: {
628
+ package: "@highstate/cilium",
629
+ path: "unit",
630
+ },
631
+ })
632
+
590
633
  export type CNI = Static<typeof cniSchema>
591
634
  export type Cluster = Static<typeof clusterEntity.schema>
592
635
 
package/src/proxmox.ts CHANGED
@@ -15,6 +15,8 @@ export const clusterEntity = defineEntity({
15
15
 
16
16
  password: Type.Optional(Type.String()),
17
17
  apiToken: Type.Optional(Type.String()),
18
+
19
+ sshKeyPair: Type.Optional(keyPairEntity.schema),
18
20
  }),
19
21
 
20
22
  meta: {
@@ -51,6 +53,13 @@ export const connection = defineUnit({
51
53
  apiToken: Type.Optional(Type.String()),
52
54
  },
53
55
 
56
+ inputs: {
57
+ sshKeyPair: {
58
+ entity: keyPairEntity,
59
+ required: false,
60
+ },
61
+ },
62
+
54
63
  outputs: {
55
64
  proxmoxCluster: clusterEntity,
56
65
  },
@@ -138,23 +147,24 @@ export const virtualMachine = defineUnit({
138
147
  args: {
139
148
  nodeName: Type.Optional(Type.String()),
140
149
 
141
- cpuType: Type.Optional(Type.String({ default: "host" })),
142
- cores: Type.Optional(Type.Number({ default: 1 })),
143
- sockets: Type.Optional(Type.Number({ default: 1 })),
144
- memory: Type.Optional(Type.Number({ default: 512 })),
150
+ cpuType: Type.Default(Type.String(), "host"),
151
+ cores: Type.Default(Type.Number(), 1),
152
+ sockets: Type.Default(Type.Number(), 1),
153
+ memory: Type.Default(Type.Number(), 512),
145
154
 
146
155
  ipv4: Type.Optional(Type.String()),
147
156
  ipv4Gateway: Type.Optional(Type.String()),
148
157
  dns: Type.Optional(Type.Array(Type.String())),
149
158
 
150
159
  datastoreId: Type.Optional(Type.String()),
151
- diskSize: Type.Optional(Type.Number({ default: 8 })),
152
- bridge: Type.Optional(Type.String({ default: "vmbr0" })),
160
+ diskSize: Type.Default(Type.Number(), 8),
161
+ bridge: Type.Default(Type.String(), "vmbr0"),
153
162
 
154
- sshPort: Type.Optional(Type.Number({ default: 22 })),
155
- sshUser: Type.Optional(Type.String({ default: "root" })),
163
+ sshPort: Type.Default(Type.Number(), 22),
164
+ sshUser: Type.Default(Type.String(), "root"),
156
165
 
157
- waitForAgent: Type.Optional(Type.Boolean({ default: true })),
166
+ waitForAgent: Type.Default(Type.Boolean(), true),
167
+ vendorData: Type.Optional(Type.String({ language: "yaml" })),
158
168
  },
159
169
 
160
170
  secrets: {