Skip to content

Commit a35c99e

Browse files
authored
Merge pull request #52 from linux-kdevops/cel/aws-improvements
Bring the new AWS dynamic Kconfig menu generation more in line with the Lambda Labs reference implementation: - Add PyTorch AMI options - Improve the performance of the generation scripts - Improve the selection of AMIs to add to the menu - Use the .generated Kconfig files correctly
2 parents f4ee14a + d94decf commit a35c99e

File tree

12 files changed

+1074
-15194
lines changed

12 files changed

+1074
-15194
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ terraform/lambdalabs/kconfigs/Kconfig.compute.mappings
116116
terraform/lambdalabs/kconfigs/Kconfig.images.generated
117117
terraform/lambdalabs/kconfigs/Kconfig.location.generated
118118
terraform/lambdalabs/.terraform_api_key
119+
120+
terraform/aws/kconfigs/Kconfig.ami.generated
121+
terraform/aws/kconfigs/Kconfig.instance.generated
122+
terraform/aws/kconfigs/Kconfig.location.generated
123+
terraform/aws/scripts/__pycache__/
124+
119125
.cloud.initialized
120126

121127
scripts/__pycache__/

CLAUDE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,28 @@ make fix-whitespace-last-commit
527527

528528
This will fix all white space only for new files you add.
529529

530+
### Testing Generated Kconfig Files
531+
532+
When working with scripts that generate Kconfig files (like `terraform/*/scripts/gen_kconfig_*`),
533+
the indentation checker cannot properly validate Jinja2 template files (.j2) because they
534+
can generate any kind of output, not just Kconfig.
535+
536+
**Correct approach**: Generate the output to a file named with "Kconfig" prefix and test that:
537+
538+
```bash
539+
# Example: Testing AWS AMI Kconfig generation
540+
cd terraform/aws/scripts
541+
python3 gen_kconfig_ami --quiet > /tmp/Kconfig.ami.test 2>&1
542+
python3 ../../../scripts/detect_indentation_issues.py /tmp/Kconfig.ami.test
543+
```
544+
545+
The indentation checker recognizes files starting with "Kconfig" and applies the correct
546+
rules (tabs for indentation, tab+2spaces for help text is valid).
547+
548+
**Why this matters**: Jinja2 templates (.j2) are generic and can generate Python, YAML,
549+
Kconfig, or any other format. The style checker cannot determine the output format from
550+
the template filename alone. Always test the generated output, not the template.
551+
530552
## Complex System Interactions
531553

532554
kdevops integrates multiple subsystems (Ansible, Kconfig, Git, Make) that often

scripts/dynamic-cloud-kconfig.Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ LAMBDALABS_KCONFIGS := $(LAMBDALABS_KCONFIG_COMPUTE) $(LAMBDALABS_KCONFIG_LOCATI
1414

1515
# AWS dynamic configuration
1616
AWS_KCONFIG_DIR := terraform/aws/kconfigs
17-
AWS_KCONFIG_AMI := $(AWS_KCONFIG_DIR)/Kconfig.ami
18-
AWS_KCONFIG_INSTANCE := $(AWS_KCONFIG_DIR)/Kconfig.instance
19-
AWS_KCONFIG_LOCATION := $(AWS_KCONFIG_DIR)/Kconfig.location
17+
AWS_KCONFIG_AMI := $(AWS_KCONFIG_DIR)/Kconfig.ami.generated
18+
AWS_KCONFIG_INSTANCE := $(AWS_KCONFIG_DIR)/Kconfig.instance.generated
19+
AWS_KCONFIG_LOCATION := $(AWS_KCONFIG_DIR)/Kconfig.location.generated
2020

2121
AWS_KCONFIGS := $(AWS_KCONFIG_AMI) $(AWS_KCONFIG_INSTANCE) $(AWS_KCONFIG_LOCATION)
2222

scripts/generate_cloud_configs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def generate_aws_kconfig() -> bool:
113113

114114
# Define the script-to-output mapping
115115
scripts_to_run = [
116-
("gen_kconfig_ami", "Kconfig.ami"),
117-
("gen_kconfig_instance", "Kconfig.instance"),
118-
("gen_kconfig_location", "Kconfig.location"),
116+
("gen_kconfig_ami", "Kconfig.ami.generated"),
117+
("gen_kconfig_instance", "Kconfig.instance.generated"),
118+
("gen_kconfig_location", "Kconfig.location.generated"),
119119
]
120120

121121
all_success = True

terraform/aws/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# AWS provider configuration
2+
#
3+
# This file sources static wrapper files which in turn source
4+
# dynamically generated Kconfig menu data. Run 'make cloud-config-aws'
5+
# to populate Kconfig.*.generated with current AWS resource information.
6+
17
if TERRAFORM_AWS
28

39
menu "Resource Location"

0 commit comments

Comments
 (0)