generated from ContainerCraft/devcontainer
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
125 additions
and
82 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 |
---|---|---|
@@ -1,35 +1,81 @@ | ||
# __main__.py | ||
|
||
# Import General Purpose Libraries | ||
from typing import List, Dict, Any | ||
|
||
# Import Pulumi Libraries | ||
import pulumi | ||
from src.lib.init import initialize_pulumi | ||
from src.lib.config import export_results | ||
from src.lib.deploy_module import deploy_module | ||
|
||
# Pulumi Initialization | ||
init = initialize_pulumi() | ||
|
||
# Retrieve initialized resources | ||
config = init["config"] | ||
k8s_provider = init["k8s_provider"] | ||
versions = init["versions"] | ||
configurations = init["configurations"] | ||
default_versions = init["default_versions"] | ||
global_depends_on = init["global_depends_on"] | ||
compliance_config = init["compliance_config"] | ||
|
||
# List of modules to deploy | ||
modules_to_deploy = ["cert_manager", "kubevirt"] | ||
|
||
# Deploy each module | ||
for module_name in modules_to_deploy: | ||
deploy_module( | ||
module_name=module_name, | ||
config=config, | ||
default_versions=default_versions, | ||
global_depends_on=global_depends_on, | ||
k8s_provider=k8s_provider, | ||
versions=versions, | ||
configurations=configurations, | ||
) | ||
|
||
# Export Component Metadata Outputs: - Versions - Configurations | ||
export_results(versions, configurations, compliance_config) | ||
from pulumi_kubernetes import Provider | ||
|
||
# Import Local Libraries | ||
from core.init import initialize_pulumi | ||
from core.config import export_results | ||
from core.deploy_module import deploy_module | ||
|
||
|
||
def main(): | ||
""" | ||
Main entry point for the Kargo Kubevirt Pulumi IaC. | ||
Initializes the Pulumi program, configures resources, and deploys specified modules. | ||
""" | ||
try: | ||
# Initialize Pulumi resources | ||
init = initialize_pulumi() | ||
|
||
# Retrieve initialized resources | ||
config = init["config"] | ||
k8s_provider = init["k8s_provider"] | ||
versions = init["versions"] | ||
configurations = init["configurations"] | ||
default_versions = init["default_versions"] | ||
global_depends_on = init["global_depends_on"] | ||
compliance_config = init["compliance_config"] | ||
|
||
# Define the list of modules to deploy | ||
modules_to_deploy = ["cert_manager", "kubevirt"] | ||
|
||
# Deploy each module | ||
deploy_modules(modules_to_deploy, config, default_versions, global_depends_on, k8s_provider, versions, configurations) | ||
|
||
# Export results | ||
export_results(versions, configurations, compliance_config) | ||
|
||
except Exception as e: | ||
pulumi.log.error(f"Deployment failed: {str(e)}") | ||
raise | ||
|
||
def deploy_modules( | ||
modules: List[str], | ||
config: pulumi.Config, | ||
default_versions: Dict[str, Any], | ||
global_depends_on: List[pulumi.Resource], | ||
k8s_provider: Provider, | ||
versions: Dict[str, str], | ||
configurations: Dict[str, Dict[str, Any]] | ||
) -> None: | ||
""" | ||
Deploy the specified modules. | ||
Args: | ||
modules (list): List of module names to deploy. | ||
config (pulumi.Config): The Pulumi configuration object. | ||
default_versions (dict): Default versions for modules. | ||
global_depends_on (list): Global dependencies. | ||
k8s_provider (Provider): Kubernetes provider object. | ||
versions (dict): Dictionary to store versions of deployed modules. | ||
configurations (dict): Dictionary to store configurations of deployed modules. | ||
""" | ||
for module_name in modules: | ||
pulumi.log.info(f"Deploying module: {module_name}") | ||
deploy_module( | ||
module_name=module_name, | ||
config=config, | ||
default_versions=default_versions, | ||
global_depends_on=global_depends_on, | ||
k8s_provider=k8s_provider, | ||
versions=versions, | ||
configurations=configurations, | ||
) | ||
|
||
if __name__ == "__main__": | ||
main() |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# src/lib/config.py | ||
# core/config.py | ||
# Description: Module Configuration Parsing & Loading | ||
|
||
""" | ||
|
9 changes: 5 additions & 4 deletions
9
pulumi/src/lib/deploy_module.py → pulumi/core/deploy_module.py
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
2 changes: 2 additions & 0 deletions
2
pulumi/src/lib/helm_chart_versions.py → pulumi/core/helm_chart_versions.py
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# core/helm_chart_versions.py | ||
|
||
import requests | ||
import logging | ||
import 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# src/lib/metadata.py | ||
# core/metadata.py | ||
|
||
import subprocess | ||
from typing import Dict | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# src/lib/types.py | ||
# core/types.py | ||
|
||
""" | ||
Types and data structures used across Kargo modules. | ||
|
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions
12
pulumi/src/cert_manager/deploy.py → pulumi/modules/cert_manager/deploy.py
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
2 changes: 1 addition & 1 deletion
2
pulumi/src/cert_manager/types.py → pulumi/modules/cert_manager/types.py
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
4 changes: 2 additions & 2 deletions
4
pulumi/src/kubevirt/types.py → pulumi/modules/kubevirt/types.py
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.