Skip to content

Commit

Permalink
Merge pull request #1005 from alphagov/argo-env
Browse files Browse the repository at this point in the history
Add environment banner to ArgoCD
  • Loading branch information
csutter authored Nov 9, 2023
2 parents a58691a + 29ccfc9 commit 69be415
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
22 changes: 22 additions & 0 deletions terraform/deployments/cluster-services/argo.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ locals {
namespace = local.monitoring_ns
}
}
argo_environment_banner_background_colors = {
test = "#5694ca"
integration = "#ffdd00"
staging = "#f47738"
production = "#d4351c"
}
argo_environment_banner_foreground_colors = {
test = "#000000"
integration = "#000000"
staging = "#000000"
production = "#ffffff"
}
}

resource "kubernetes_namespace" "apps" {
Expand Down Expand Up @@ -63,6 +75,16 @@ resource "helm_release" "argo_cd" {
g, ${var.github_read_write_team}, role:admin
EOT
}

# Adds some hacky custom CSS that inserts an environment banner into the ArgoCD UI to make it
# easier to differentiate between environments. May break if there are major changes to the
# ArgoCD UI.
styles = templatefile("${path.module}/templates/argo-custom-css.tpl", {
env_name = title(var.govuk_environment)
env_abbreviation = upper(substr(var.govuk_environment, 0, 1))
env_background_color = local.argo_environment_banner_background_colors[var.govuk_environment]
env_foreground_color = local.argo_environment_banner_foreground_colors[var.govuk_environment]
})
}

controller = { metrics = local.argo_metrics_config }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.sidebar__container::before {
content: '${env_name}';
display: block;
background-color: ${env_background_color};
color: ${env_foreground_color};
text-align: center;
font-weight: bold;
padding: 10px 4px;
overflow: hidden;
white-space: nowrap;
margin-top: 20px;
}
.sidebar--collapsed .sidebar__container::before {
content: '${env_abbreviation}';
font-size: 140%;
padding: 4px;
}

0 comments on commit 69be415

Please sign in to comment.