@highstate/talos 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.
@@ -1,9 +1,57 @@
1
- import { readFileSync } from 'node:fs';
2
- import { forUnit, output, interpolate, all } from '@highstate/pulumi';
1
+ import { forUnit, readResolvedPackageFileSync, output, interpolate, all } from '@highstate/pulumi';
3
2
  import { talos } from '@highstate/library';
4
3
  import { machine, cluster } from '@pulumiverse/talos';
4
+ import { text } from '@highstate/contract';
5
+ import { local } from '@pulumi/command';
6
+ import { resolveChartPath } from '@highstate/k8s';
5
7
 
6
8
  const { name, args, inputs, outputs } = forUnit(talos.cluster);
9
+ const cni = args.cni ?? "cilium";
10
+ const csi = args.csi ?? "local-path-provisioner";
11
+ const inlineManifests = [];
12
+ const extraMounts = [];
13
+ if (cni === "cilium") {
14
+ const ciliumManifestCommand = new local.Command("cilium-manifest", {
15
+ create: [
16
+ "helm template",
17
+ resolveChartPath("@highstate/cilium", "cilium", import.meta.url),
18
+ "--namespace kube-system",
19
+ "--set ipam.mode=kubernetes",
20
+ "--set kubeProxyReplacement=true",
21
+ "--set operator.replicas=1",
22
+ "--set hubble.relay.enabled=true",
23
+ "--set hubble.ui.enabled=true",
24
+ '--set securityContext.capabilities.ciliumAgent="{CHOWN,KILL,NET_ADMIN,NET_RAW,IPC_LOCK,SYS_ADMIN,SYS_RESOURCE,DAC_OVERRIDE,FOWNER,SETGID,SETUID}"',
25
+ '--set securityContext.capabilities.cleanCiliumState="{NET_ADMIN,SYS_ADMIN,SYS_RESOURCE}"',
26
+ "--set cgroup.autoMount.enabled=false",
27
+ "--set cgroup.hostRoot=/sys/fs/cgroup",
28
+ "--set k8sServiceHost=localhost",
29
+ "--set k8sServicePort=7445",
30
+ "--set bpf.lbExternalClusterIP=true"
31
+ ].join(" "),
32
+ logging: "stderr"
33
+ });
34
+ inlineManifests.push({
35
+ name: "cilium",
36
+ contents: ciliumManifestCommand.stdout
37
+ });
38
+ }
39
+ if (csi === "local-path-provisioner") {
40
+ extraMounts.push({
41
+ destination: "/var/lib/local-path-provisioner",
42
+ type: "bind",
43
+ source: "/var/lib/local-path-provisioner",
44
+ options: ["bind", "rshared", "rw"]
45
+ });
46
+ inlineManifests.push({
47
+ name: "local-path-provisioner",
48
+ contents: readResolvedPackageFileSync(
49
+ "@highstate/talos/cluster",
50
+ "assets/local-path-provisioner.yaml",
51
+ import.meta.url
52
+ )
53
+ });
54
+ }
7
55
  const clusterName = args.clusterName ?? name;
8
56
  const globalConfigPatch = output({
9
57
  machine: {
@@ -11,29 +59,17 @@ const globalConfigPatch = output({
11
59
  image: "ghcr.io/siderolabs/installer:v1.8.3",
12
60
  extensions: [{ image: "ghcr.io/siderolabs/qemu-guest-agent:9.1.0" }]
13
61
  },
14
- sysctls: {
15
- "net.ipv4.ip_forward": "1",
16
- "net.ipv4.conf.all.src_valid_mark": "1"
62
+ kubelet: {
63
+ extraMounts
17
64
  }
18
65
  },
19
66
  cluster: {
20
67
  allowSchedulingOnMasters: inputs.workers.length.apply(
21
68
  (length) => length === 0 || args.scheduleOnMasters
22
69
  ),
23
- inlineManifests: [
24
- {
25
- name: "cilium",
26
- contents: readFileSync("../../assets/manifests/cilium.yaml", "utf-8")
27
- }
28
- ],
29
- network: {
30
- cni: {
31
- name: "none"
32
- }
33
- },
34
- proxy: {
35
- disabled: true
36
- }
70
+ inlineManifests,
71
+ network: cni !== "flannel" ? { cni: { name: "none" } } : void 0,
72
+ proxy: cni === "cilium" ? { disabled: true } : void 0
37
73
  }
38
74
  }).apply(JSON.stringify);
39
75
  const secrets = new machine.Secrets("secrets", { talosVersion: "v1.8.3" });
@@ -126,27 +162,38 @@ function getConfigurationApplyArgs(node, machineConfiguration) {
126
162
  }
127
163
  var index = outputs({
128
164
  k8sCluster: {
129
- kubeconfig
165
+ name: clusterName,
166
+ kubeconfig,
167
+ cni: cni === "none" ? "unknown" : cni
130
168
  },
131
169
  talosCluster: {
132
170
  clientConfiguration,
133
171
  machineSecrets
134
172
  },
135
- egress: {
136
- someField: "hi"
137
- },
138
- $terminal: {
139
- image: "ghcr.io/exeteres/highstate/terminal-talos",
140
- command: ["/bin/bash"],
141
- cwd: "/cluster",
142
- files: {
143
- "/cluster/kubeconfig": kubeconfig,
144
- "/cluster/talosconfig": clientConfiguration,
145
- "/cluster/secrets": machineSecrets
146
- },
147
- env: {
148
- KUBECONFIG: "/cluster/kubeconfig",
149
- TALOSCONFIG: "/cluster/talosconfig"
173
+ $terminals: {
174
+ management: {
175
+ title: "Cluster Management",
176
+ image: "ghcr.io/exeteres/highstate/terminal-talosctl",
177
+ command: ["bash", "/welcome.sh"],
178
+ files: {
179
+ "/kubeconfig": kubeconfig,
180
+ "/talosconfig": clientConfiguration,
181
+ "/secrets": machineSecrets,
182
+ "/welcome.sh": text`
183
+ echo "Connecting to the cluster..."
184
+ kubectl cluster-info
185
+
186
+ echo "Use 'kubectl' and 'helm' to manage the cluster."
187
+ echo "Use 'talosctl' to manage the Talos side of the cluster."
188
+ echo
189
+
190
+ exec script -q -c bash /dev/null
191
+ `
192
+ },
193
+ env: {
194
+ KUBECONFIG: "/kubeconfig",
195
+ TALOSCONFIG: "/talosconfig"
196
+ }
150
197
  }
151
198
  }
152
199
  });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@highstate/talos",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "type": "module",
5
5
  "files": [
6
- "assets",
6
+ "assets/manifests",
7
7
  "dist"
8
8
  ],
9
9
  "exports": {
@@ -14,17 +14,22 @@
14
14
  },
15
15
  "scripts": {
16
16
  "build": "pkgroll --tsconfig=tsconfig.build.json",
17
- "generate-cilium": "bash ./scripts/generate-cilium.sh"
17
+ "generate-local-path-provisioner": "bash ./scripts/generate-local-path-provisioner.sh"
18
18
  },
19
19
  "dependencies": {
20
- "@highstate/pulumi": "^0.4.4",
20
+ "@highstate/cilium": "^0.4.5",
21
+ "@highstate/common": "^0.4.5",
22
+ "@highstate/contract": "^0.4.5",
23
+ "@highstate/k8s": "^0.4.5",
24
+ "@highstate/pulumi": "^0.4.5",
25
+ "@pulumi/command": "^1.0.2",
21
26
  "@pulumiverse/talos": "^0.4.1"
22
27
  },
23
28
  "peerDependencies": {
24
- "@highstate/library": "workspace:^"
29
+ "@highstate/library": "workspace:^0.4.4"
25
30
  },
26
31
  "devDependencies": {
27
32
  "pkgroll": "^2.5.1"
28
33
  },
29
- "gitHead": "58a1b969cca5dad233f885f2e67185a0384ea1aa"
34
+ "gitHead": "afd601fdade1bcf31af58072eea3c08ee26349b8"
30
35
  }
Binary file