Skip to content

Commit

Permalink
for ContainerCraft#78 ContainerCraft#79 refactored to line up with th…
Browse files Browse the repository at this point in the history
…e refactor
  • Loading branch information
mlbiam committed Oct 11, 2024
1 parent 61bfdfd commit 865866d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 30 deletions.
39 changes: 19 additions & 20 deletions pulumi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def get_module_config(module_name):

depends = []

# defining a separate depends list for openunison to avoid circular dependencies
openunison_depends = []

def safe_append(depends, resource):
if resource:
depends.append(resource)
Expand Down Expand Up @@ -176,7 +179,7 @@ def run_kubevirt():
versions["kubevirt"] = {"enabled": kubevirt_enabled, "version": kubevirt[0]}
kubevirt_operator = kubevirt[1]

safe_append(depends, kubevirt_operator)
safe_append(openunison_depends, kubevirt_operator)

return kubevirt, kubevirt_operator
return None, None
Expand Down Expand Up @@ -354,10 +357,10 @@ def run_kubernetes_dashboard():
openunison_enabled
)

versions["kubernetes_dashboard"] = {"enabled": kubernetes_dashboard_enabled, "version": kubernetes_dashboard[0]}
versions["kubernetes_dashboard"] = {"enabled": kubernetes_dashboard_enabled, "version": kubernetes_dashboard[0], "release":kubernetes_dashboard[1]}
kubernetes_dashboard_release = kubernetes_dashboard[1]

safe_append(depends, kubernetes_dashboard_release)
safe_append(openunison_depends, kubernetes_dashboard_release)

return kubernetes_dashboard, kubernetes_dashboard_release
return None, None
Expand All @@ -374,10 +377,17 @@ def run_kubevirt_manager():
k8s_provider,
)

return kubevirt_manager
return None
versions["kubevirt_manager"] = {"enabled": kubevirt_manager_enabled, "version": kubevirt_manager[0]}
kubevirt_manager_release = kubevirt_manager[1]

safe_append(openunison_depends, kubevirt_manager_release)

kubevirt_manager = run_kubevirt_manager()
return kubevirt_manager, kubevirt_manager_release


return None, None

kubevirt_manager, kubevirt_manager_release = run_kubevirt_manager()

##################################################################################
def run_openunison():
Expand All @@ -403,18 +413,10 @@ def run_openunison():


safe_append(custom_depends,nginx_release)
safe_append(custom_depends,kubernetes_dashboard_release)
if (kubevirt_manager):
safe_append(custom_depends,kubevirt_manager);


# if kubevirt_enabled:
# enabled["kubevirt"] = {"enabled": kubevirt_enabled}

# if prometheus_enabled:
# enabled["prometheus"] = {"enabled": prometheus_enabled}
custom_depends.extend(depends)
custom_depends.extend(openunison_depends)

pulumi.export("enabled", enabled)

openunison = deploy_openunison(
custom_depends,
Expand All @@ -424,13 +426,10 @@ def run_openunison():
domain_suffix,
cluster_issuer,
cert_manager_selfsigned_cert,
kubernetes_dashboard_release,
nginx_release,
openunison_github_client_id,
openunison_github_client_secret,
openunison_github_teams,
enabled,
kubevirt_manager != None
versions
)

versions["openunison"] = {"enabled": openunison_enabled, "version": openunison[0]}
Expand Down
2 changes: 1 addition & 1 deletion pulumi/src/kv_manager/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def deploy_ui_for_kubevirt(name: str, k8s_provider: Provider):
# There's no helm chart for kubevirt-manager so <christopher walken shrug>
kubevirt_manager_manifest_url = 'https://raw.githubusercontent.com/kubevirt-manager/kubevirt-manager/main/kubernetes/bundled.yaml'
k8s_yaml = k8s.yaml.ConfigFile("kubevirt-manager", file=kubevirt_manager_manifest_url)
return k8s_yaml
return "1.4.1", k8s_yaml
13 changes: 4 additions & 9 deletions pulumi/src/openunison/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ def deploy_openunison(
domain_suffix: str,
cluster_issuer: str,
cert_manager_selfsigned_cert: str,
kubernetes_dashboard_release: str,
nginx_release: str,
ou_github_client_id: str,
ou_github_client_secret: str,
ou_github_teams: str,
enabled : bool,
kubevirt_manager_enabled: bool
enabled
):

kubernetes_dashboard_release = enabled["kubernetes_dashboard"]["release"]
ns_retain = True
ns_protect = False
ns_annotations = {}
Expand Down Expand Up @@ -240,10 +237,7 @@ def deploy_openunison(


# if enabled["kubevirt"] and enabled["kubevirt"]["enabled"]:
if kubevirt_manager_enabled:



if "kubevirt_manager" in enabled and enabled["kubevirt_manager"]["enabled"]:
ou_helm_values["openunison"]["apps"].append(
{
"name": "kubevirt-manager",
Expand Down Expand Up @@ -308,6 +302,7 @@ def deploy_openunison(
def wait_for_dashboard_release_names():
return ou_helm_values


orchesrta_login_portal_helm_values = kubernetes_dashboard_release.name.apply(lambda _: wait_for_dashboard_release_names())

# Fetch the latest version from the helm chart index
Expand Down

0 comments on commit 865866d

Please sign in to comment.