commit fix

This commit is contained in:
Iurii Anfinogenov
2026-05-03 13:23:54 +00:00
parent bb4dc311c1
commit 40694927c8
7 changed files with 359 additions and 0 deletions

54
generate.py Normal file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python3
BASE_IP = "192.168.20"
START = 10
COUNT = 5
CPU = 2
MEMORY = 2048
GATEWAY = "192.168.20.1"
def generate():
print("locals {")
print(" nodes = {")
for i in range(COUNT):
idx = i + 1
last_octet = START + i
if last_octet > 254:
raise ValueError("IP overflow")
ip = f"{BASE_IP}.{last_octet}"
comma = "," if i < COUNT - 1 else ""
print(f""" k8s-worker-{idx} = {{
index = {idx}
cpu = {CPU}
memory = {MEMORY}
disks = [
{{
datastore = "ssd2"
interface = "scsi0"
size = 20
import_from = "local:import/ubuntu-24.qcow2"
}}
]
network_devices = [
{{
bridge = "vmbr0"
vlan_id = 20
ip = "{ip}"
cidr = 24
gateway = "{GATEWAY}"
}}
]
}}{comma}""")
print(" }")
print("}")
if __name__ == "__main__":
generate()