-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor out some common things like talos version to a json file that can be read by both nix and cue
- Loading branch information
Showing
19 changed files
with
228 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ dist-deps/ | |
result | ||
.ghtoken | ||
cue.mod/gen | ||
secrets.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package netserv | ||
|
||
#BGPPolicyLabel: "pythoner6.dev/bgp-policy" | ||
|
||
#DefaultBGPPolicyLabels: { | ||
(#BGPPolicyLabel): "default" | ||
... | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package netserv | ||
|
||
_talosVersion: string | ||
_kubeVersion: "1.29.0" | ||
|
||
#Config: { | ||
_address: string | ||
_controlplane: bool | ||
_model: "rpi" | "m720q" | ||
_endpoint: "10.16.2.10" | ||
_installdisk: string | ||
|
||
machine: { | ||
time: servers: ["time.cloudflare.com"] | ||
if !_controlplane { | ||
nodeLabels: #DefaultBGPPolicyLabels | ||
} | ||
network: { | ||
nameservers: ["192.168.1.1"] | ||
interfaces: [{ | ||
dhcp: false, | ||
addresses: [ "\(_address)/24" ] | ||
routes: [{ | ||
network: "0.0.0.0/0" | ||
gateway: "10.16.2.2" | ||
}] | ||
if _controlplane { | ||
vip: ip: _endpoint | ||
} | ||
}] | ||
} | ||
if !_controlplane { | ||
install: wipe: true | ||
} | ||
} | ||
cluster: { | ||
proxy: disabled: true | ||
network: { | ||
podSubnets: ["172.16.0.0/16"] | ||
serviceSubnets: ["172.17.0.0/16"] | ||
cni: name: "none" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package netserv | ||
|
||
import ( | ||
"tool/exec" | ||
"tool/file" | ||
"regexp" | ||
"encoding/json" | ||
"encoding/yaml" | ||
) | ||
|
||
outputDir: string | *"output" @tag(outputDir) | ||
_talosVersion : regexp.ReplaceAll("^v", json.Unmarshal(command.gen."versions.json".contents).talos.version, "") | ||
|
||
command: gen: { | ||
mkdir: file.MkdirAll & { | ||
path: outputDir | ||
} | ||
|
||
"versions.json": file.Read & { | ||
filename: "versions.json" | ||
} | ||
|
||
for node in #Nodes { | ||
"node-\(node._address)": exec.Run & { | ||
$after: [mkdir] | ||
_type: [if node._controlplane {"controlplane"}, "worker"][0] | ||
cmd: [ | ||
"talosctl", "gen", "config", "--force", | ||
"--config-patch", yaml.Marshal(node), | ||
"--with-secrets", "secrets.yaml", | ||
"--install-image", "ghcr.io/siderolabs/installer:v\(_talosVersion)", | ||
"--talos-version", "v\(_talosVersion)", | ||
"--kubernetes-version", _kubeVersion, | ||
"--install-disk", node._installdisk, | ||
"--output-types", _type, | ||
"--output", "\(outputDir)/\(_type)-\(node._address).yaml", | ||
"netserv", "https://\(node._endpoint):6443", | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package netserv | ||
|
||
#Config: { | ||
_model: string | ||
if _model == "m720q" { | ||
_installdisk: "/dev/nvme0n1" | ||
machine: { | ||
nodeLabels: ceph: "yes" | ||
disks: [{ | ||
device: "/dev/nvme0n2" | ||
partitions: [{mountpoint: "/var/storage"}] | ||
}] | ||
network: interfaces: [{ | ||
interface: "enp1s0" | ||
}] | ||
install: extraKernelArgs: [ | ||
"net.ifnames=1", | ||
"pcie_aspm=off", | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package netserv | ||
|
||
#Nodes: [ | ||
for i in [1,2,3] { #Config & { | ||
_address: "10.16.2.\(100 + i)" | ||
_controlplane: true | ||
_model: "rpi" | ||
}} | ||
for i in [1,2,3] { #Config & { | ||
_address: "10.16.2.\(200 + i)" | ||
_controlplane: false | ||
_model: "rpi" | ||
}} | ||
for i in [1,2,3] { #Config & { | ||
_address: "10.16.2.\(220 + i)" | ||
_controlplane: false | ||
_model: "m720q" | ||
}} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package netserv | ||
|
||
#Config: { | ||
_model: string | ||
_controlplane: bool | ||
if _model == "rpi" { | ||
_installdisk: [if _controlplane {"/dev/nvme0n1"}, "/dev/mmcblk0"][0] | ||
machine: { | ||
if !_controlplane { | ||
disks: [{ | ||
device: "/dev/nvme0n1" | ||
partitions: [{mountpoint: "/var/storage"}] | ||
}] | ||
} | ||
network: interfaces: [{ | ||
deviceSelector: driver: "bcmgenet" | ||
}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"talos": { | ||
"datasource": "github-release-attachments", | ||
"package": "siderolabs/talos", | ||
"version": "v1.6.0", | ||
"talosctlDigest": "3682def031e9b89e4fe4437b8b7cc9f383781f4c3173be9416cd65bc6e1333e7" | ||
}, | ||
"flux": { | ||
"datasource": "github-release-attachments", | ||
"package": "fluxcd/flux2", | ||
"version": "v2.2.2", | ||
"digest": "292945a94ae370b91fe004e1f41b16063fc87371a61a1fd29958dfd959140a60" | ||
} | ||
} |