Skip to content

Commit

Permalink
for ContainerCraft#79 moved result group into the helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
mlbiam committed Oct 11, 2024
1 parent 865866d commit e76537a
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 83 deletions.
11 changes: 11 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ tasks:
- source .envrc && pulumi stack select --create {{.pulumi_stack_identifier}} || true
- source .envrc && pulumi config set --path kubevirt_manager.enabled true

enable-prometheus:
desc: Enables Prometheus
cmds:
- task: install-gum
- task: install-pen
- pen 14443 127.0.0.1:10443
- pen 15443 127.0.0.1:10443
- pen 16443 127.0.0.1:10443
- source .envrc && pulumi stack select --create {{.pulumi_stack_identifier}} || true
- source .envrc && pulumi config set --path prometheus.enabled true



iac-deploy:
Expand Down
4 changes: 2 additions & 2 deletions pulumi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ def run_prometheus():
openunison_enabled
)

versions["prometheus"] = {"enabled": prometheus_enabled, "version": prometheus[0]}
versions["prometheus"] = {"enabled": prometheus_enabled, "version": prometheus[0],"release":prometheus[1]}
prometheus_release = prometheus[1]

safe_append(depends, prometheus_release)
safe_append(openunison_depends, prometheus_release)

return prometheus, prometheus_release
return None, None
Expand Down
2 changes: 1 addition & 1 deletion pulumi/src/helm/openunison-kargo/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0
version: 0.3.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: openunison.tremolo.io/v1
kind: ResultGroup
metadata:
name: grafana-header
namespace: openunison
spec:
- resultType: header
source: static
value: X-WEBAUTH-GROUPS=Admin
- resultType: header
source: user
value: X-WEBAUTH-USER=uid
131 changes: 51 additions & 80 deletions pulumi/src/openunison/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def deploy_openunison(
k8sdb_host = ""
api_server_host = ""
kubevirt_manager_host = ""
prometheus_host = ""
alertmanager_host = ""
grafana_host = ""

running_in_gh_spaces = os.getenv("GITHUB_USER") or None

Expand All @@ -103,11 +106,18 @@ def deploy_openunison(
k8sdb_host = os.getenv("CODESPACE_NAME") + '-11443.app.github.dev'
api_server_host = os.getenv("CODESPACE_NAME") + '-12443.app.github.dev'
kubevirt_manager_host = os.getenv("CODESPACE_NAME") + '-13443.app.github.dev'
prometheus_host = os.getenv("CODESPACE_NAME") + '-14443.app.github.dev'
alertmanager_host = os.getenv("CODESPACE_NAME") + '-15443.app.github.dev'
grafana_host = os.getenv("CODESPACE_NAME") + '-16443.app.github.dev'
else:
ou_host = f"k8sou.{domain_suffix}"
k8sdb_host = f"k8sdb.{domain_suffix}"
api_server_host = f"k8sapi.{domain_suffix}"
kubevirt_manager_host = f"kubevirt-manager.{domain_suffix}"
prometheus_host = f"prometheus.{domain_suffix}"
alertmanager_host = f"alertmanager.{domain_suffix}"
grafana_host = f"grafana.{domain_suffix}"


ou_helm_values = {
"enable_wait_for_job": True,
Expand Down Expand Up @@ -251,46 +261,46 @@ def deploy_openunison(
}
)

# if enabled["prometheus"] and enabled["prometheus"]["enabled"]:
# ou_helm_values["openunison"]["apps"].append(
# {
# "name": "prometheus",
# "label": "Prometheus",
# "org": "b1bf4c92-7220-4ad2-91af-ee0fe0af7312",
# "badgeUrl": f"https://prometheus.{domain_suffix}/",
# "injectToken": False,
# "proxyTo": "http://prometheus.monitoring.svc:9090${fullURI}",
# "az_groups": az_groups,
# "icon": f"{prometheus_icon_json}",
# }
# )

# ou_helm_values["openunison"]["apps"].append(
# {
# "name": "alertmanager",
# "label": "Alert Manager",
# "org": "b1bf4c92-7220-4ad2-91af-ee0fe0af7312",
# "badgeUrl": "https://alertmanager." + domain_suffix + "/",
# "injectToken": False,
# "proxyTo": "http://alertmanager.monitoring.svc:9093${fullURI}",
# "az_groups": az_groups,
# "icon": f"{alertmanager_icon_json}",
# }
# )

# ou_helm_values["openunison"]["apps"].append(
# {
# "name": "grafana",
# "label": "Grafana",
# "org": "b1bf4c92-7220-4ad2-91af-ee0fe0af7312",
# "badgeUrl": "https://grafana." + domain_suffix + "/",
# "injectToken": False,
# "azSuccessResponse":"grafana",
# "proxyTo": "http://grafana.monitoring.svc${fullURI}",
# "az_groups": az_groups,
# "icon": f"{grafana_icon_json}",
# }
# )
if "prometheus" in enabled and enabled["prometheus"]["enabled"]:
ou_helm_values["openunison"]["apps"].append(
{
"name": "prometheus",
"label": "Prometheus",
"org": "b1bf4c92-7220-4ad2-91af-ee0fe0af7312",
"badgeUrl": f"https://{prometheus_host}",
"injectToken": False,
"proxyTo": "http://prometheus.monitoring.svc:9090${fullURI}",
"az_groups": az_groups,
"icon": f"{prometheus_icon_json}",
}
)

ou_helm_values["openunison"]["apps"].append(
{
"name": "alertmanager",
"label": "Alert Manager",
"org": "b1bf4c92-7220-4ad2-91af-ee0fe0af7312",
"badgeUrl": f"https://{alertmanager_host}",
"injectToken": False,
"proxyTo": "http://alertmanager.monitoring.svc:9093${fullURI}",
"az_groups": az_groups,
"icon": f"{alertmanager_icon_json}",
}
)

ou_helm_values["openunison"]["apps"].append(
{
"name": "grafana",
"label": "Grafana",
"org": "b1bf4c92-7220-4ad2-91af-ee0fe0af7312",
"badgeUrl": f"https://{grafana_host}/",
"injectToken": False,
"azSuccessResponse":"grafana-header",
"proxyTo": "http://grafana.monitoring.svc${fullURI}",
"az_groups": az_groups,
"icon": f"{grafana_icon_json}",
}
)

ou_helm_values["dashboard"]["service_name"] = kubernetes_dashboard_release.name.apply(lambda name: sanitize_name(name))
ou_helm_values["dashboard"]["auth_service_name"] = kubernetes_dashboard_release.name.apply(lambda name: sanitize_name(name + '-auth'))
Expand Down Expand Up @@ -498,47 +508,8 @@ def update_values(name):
)
)
)

return version, operator_release
#
#
# if prometheus_enabled:
# # create the Grafana ResultGroup
# ou_grafana_resultgroup = CustomResource(
# "openunison-grafana",
# api_version="openunison.tremolo.io/v1",
# kind="ResultGroup",
# metadata={
# "labels": {
# "app.kubernetes.io/component": "openunison-resultgroups",
# "app.kubernetes.io/instance": "openunison-orchestra-login-portal",
# "app.kubernetes.io/name": "openunison",
# "app.kubernetes.io/part-of": "openunison"
# },
# "name": "grafana",
# "namespace": "openunison"
# },
# spec=[
# {
# "resultType": "header",
# "source": "static",
# "value": "X-WEBAUTH-GROUPS=Admin"
# },
# {
# "resultType": "header",
# "source": "user",
# "value": "X-WEBAUTH-USER=uid"
# }
# ],
# opts=pulumi.ResourceOptions(
# provider = k8s_provider,
# depends_on=[ou_orchestra_release],
# custom_timeouts=pulumi.CustomTimeouts(
# create="5m",
# update="10m",
# delete="10m"
# )
# )
# )



Expand Down

0 comments on commit e76537a

Please sign in to comment.