Skip to content

Commit b1e9ba2

Browse files
authored
Merge pull request #46 from linux-kdevops/cel-cloud-config
Wire AWS dynamic Kconfig menu generation into "make cloud-config"
2 parents b91344a + 67e1005 commit b1e9ba2

File tree

3 files changed

+439
-36
lines changed

3 files changed

+439
-36
lines changed

scripts/generate_cloud_configs.py

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,52 @@ def get_lambdalabs_summary() -> tuple[bool, str]:
100100
return False, "Lambda Labs: Error querying API - using defaults"
101101

102102

103+
def generate_aws_kconfig() -> bool:
104+
"""
105+
Generate AWS Kconfig files.
106+
Returns True on success, False on failure.
107+
"""
108+
script_dir = os.path.dirname(os.path.abspath(__file__))
109+
project_root = os.path.dirname(script_dir)
110+
aws_scripts_dir = os.path.join(project_root, "terraform", "aws", "scripts")
111+
aws_kconfigs_dir = os.path.join(project_root, "terraform", "aws", "kconfigs")
112+
113+
# Define the script-to-output mapping
114+
scripts_to_run = [
115+
("gen_kconfig_ami", "Kconfig.ami"),
116+
("gen_kconfig_instance", "Kconfig.instance"),
117+
("gen_kconfig_location", "Kconfig.location"),
118+
]
119+
120+
all_success = True
121+
122+
for script_name, kconfig_file in scripts_to_run:
123+
script_path = os.path.join(aws_scripts_dir, script_name)
124+
output_path = os.path.join(aws_kconfigs_dir, kconfig_file)
125+
126+
# Run the script and capture its output
127+
result = subprocess.run(
128+
[script_path],
129+
capture_output=True,
130+
text=True,
131+
check=False,
132+
)
133+
134+
if result.returncode == 0:
135+
# Write the output to the corresponding Kconfig file
136+
try:
137+
with open(output_path, 'w') as f:
138+
f.write(result.stdout)
139+
except IOError as e:
140+
print(f"Error writing {kconfig_file}: {e}", file=sys.stderr)
141+
all_success = False
142+
else:
143+
print(f"Error running {script_name}: {result.stderr}", file=sys.stderr)
144+
all_success = False
145+
146+
return all_success
147+
148+
103149
def main():
104150
"""Main function to generate cloud configurations."""
105151
print("Cloud Provider Configuration Summary")
@@ -121,15 +167,23 @@ def main():
121167
print(f"⚠ {summary}")
122168
print()
123169

124-
# AWS (placeholder - not implemented)
125-
print("⚠ AWS: Dynamic configuration not yet implemented")
170+
# AWS - Generate Kconfig files
171+
kconfig_generated = generate_aws_kconfig()
172+
if kconfig_generated:
173+
print("✓ AWS: Kconfig files generated successfully")
174+
else:
175+
print("⚠ AWS: Failed to generate Kconfig files - using defaults")
176+
print()
126177

127178
# Azure (placeholder - not implemented)
128179
print("⚠ Azure: Dynamic configuration not yet implemented")
129180

130181
# GCE (placeholder - not implemented)
131182
print("⚠ GCE: Dynamic configuration not yet implemented")
132183

184+
# OCI (placeholder - not implemented)
185+
print("⚠ OCI: Dynamic configuration not yet implemented")
186+
133187
print()
134188
print("Note: Dynamic configurations query real-time availability")
135189
print("Run 'make menuconfig' to configure your cloud provider")

terraform/aws/kconfigs/Kconfig.ami

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ config TERRAFORM_AWS_AMI_OWNER
109109
config TERRAFORM_AWS_NS
110110
string
111111
output yaml
112-
default "AlmaLinux OS *" if TERRAFORM_AWS_AMI_ALMALINUX_10
113-
default "AlmaLinux OS 8.*" if TERRAFORM_AWS_AMI_ALMALINUX_8
112+
default "AlmaLinux OS Kitten 10.202509*" if TERRAFORM_AWS_AMI_ALMALINUX_10
113+
default "AlmaLinux OS 8.10.202*" if TERRAFORM_AWS_AMI_ALMALINUX_8
114114
default "almalinux9-x86_64-community-vmware-bundle" if TERRAFORM_AWS_AMI_ALMALINUX_9
115115

116116
endif # TERRAFORM_AWS_DISTRO_ALMALINUX
@@ -139,7 +139,7 @@ config TERRAFORM_AWS_AMI_OWNER
139139
config TERRAFORM_AWS_NS
140140
string
141141
output yaml
142-
default "amzn2-ami-*" if TERRAFORM_AWS_AMI_AMAZON_LINUX_2
142+
default "amzn2-ami-minimal-*" if TERRAFORM_AWS_AMI_AMAZON_LINUX_2
143143
default "al2023-ami-*" if TERRAFORM_AWS_AMI_AMAZON_LINUX_2023
144144

145145
endif # TERRAFORM_AWS_DISTRO_AMAZON
@@ -257,9 +257,9 @@ config TERRAFORM_AWS_NS
257257
default "fedora-coreos-39.20240*" if TERRAFORM_AWS_AMI_FEDORA_39
258258
default "fedora-coreos-40.202410*" if TERRAFORM_AWS_AMI_FEDORA_40
259259
default "fedora-coreos-41.20250*" if TERRAFORM_AWS_AMI_FEDORA_41
260-
default "fedora-coreos-42.202509*" if TERRAFORM_AWS_AMI_FEDORA_42
261-
default "fedora-coreos-43.20250917.1*" if TERRAFORM_AWS_AMI_FEDORA_43
262-
default "fedora-coreos-44.202509*" if TERRAFORM_AWS_AMI_FEDORA_44
260+
default "fedora-coreos-42.202510*" if TERRAFORM_AWS_AMI_FEDORA_42
261+
default "fedora-coreos-43.2025100*" if TERRAFORM_AWS_AMI_FEDORA_43
262+
default "fedora-coreos-44.2025100*" if TERRAFORM_AWS_AMI_FEDORA_44
263263

264264
endif # TERRAFORM_AWS_DISTRO_FEDORA
265265

@@ -322,9 +322,9 @@ config TERRAFORM_AWS_AMI_OWNER
322322
config TERRAFORM_AWS_NS
323323
string
324324
output yaml
325-
default "RHEL-10.0.0_HVM*" if TERRAFORM_AWS_AMI_RHEL_10
325+
default "RHEL-10.0.0_HVM-20250*" if TERRAFORM_AWS_AMI_RHEL_10
326326
default "RHEL-7.9_HVM-20240930-x86_64-0-Hourly2-GP3" if TERRAFORM_AWS_AMI_RHEL_7
327-
default "RHEL-8.10.0_HVM-20250*" if TERRAFORM_AWS_AMI_RHEL_8
327+
default "RHEL-8.10.0_HVM-2025*" if TERRAFORM_AWS_AMI_RHEL_8
328328
default "RHEL-9.*" if TERRAFORM_AWS_AMI_RHEL_9
329329

330330
endif # TERRAFORM_AWS_DISTRO_REDHAT
@@ -392,8 +392,8 @@ config TERRAFORM_AWS_AMI_OWNER
392392
config TERRAFORM_AWS_NS
393393
string
394394
output yaml
395-
default "suse-sles-12-sp5-v20250*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_12
396-
default "suse-sles-15-sp*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_15
395+
default "suse-sles-12-sp5-v2025*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_12
396+
default "suse-sles-15-sp7-*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_15
397397
default "suse-sle-micro-5-*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_5
398398
default "suse-sle-micro-6-*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_6
399399

@@ -428,6 +428,9 @@ config TERRAFORM_AWS_AMI_UBUNTU_24_10
428428
config TERRAFORM_AWS_AMI_UBUNTU_25_04
429429
bool "Ubuntu 25.04"
430430

431+
config TERRAFORM_AWS_AMI_UBUNTU_25_10
432+
bool "Ubuntu 25.10"
433+
431434
endchoice
432435

433436
config TERRAFORM_AWS_AMI_OWNER
@@ -445,5 +448,6 @@ config TERRAFORM_AWS_NS
445448
default "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-a*" if TERRAFORM_AWS_AMI_UBUNTU_24_04_LTS
446449
default "ubuntu/images/hvm-ssd-gp3/ubuntu-oracular-24.10-a*" if TERRAFORM_AWS_AMI_UBUNTU_24_10
447450
default "ubuntu/images/hvm-ssd-gp3/ubuntu-plucky-25.04-a*" if TERRAFORM_AWS_AMI_UBUNTU_25_04
451+
default "ubuntu/images/hvm-ssd-gp3/ubuntu-questing-25.10-a*" if TERRAFORM_AWS_AMI_UBUNTU_25_10
448452

449453
endif # TERRAFORM_AWS_DISTRO_CANONICAL

0 commit comments

Comments
 (0)