Skip to content

Commit

Permalink
feat: install argocd widget on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonemms committed Dec 7, 2024
1 parent 4aef3df commit a0df0c8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repos:
- --no-sort-keys
- id: check-json
- id: check-yaml
exclude: ^modules
args:
- --allow-multiple-documents
- id: end-of-file-fixer
Expand Down
27 changes: 22 additions & 5 deletions modules/kubernetes/argocd.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

locals {
additional_users = {
"homepage" = {
cap = "apiKey"
role = "readonly"
}
}
}

resource "kubernetes_namespace_v1" "argocd" {
metadata {
name = "argocd"
Expand Down Expand Up @@ -56,6 +65,9 @@ resource "helm_release" "argocd" {

values = [
templatefile("${path.module}/files/argocd.yaml", {
additional_users = yamlencode({
for group, user in local.additional_users : "accounts.${group}" => user.cap
})
cluster_issuer = var.cluster_issuer
domain = "argocd.${var.domain}"
oidc_config = {
Expand Down Expand Up @@ -83,11 +95,16 @@ resource "helm_release" "argocd" {
] : "p, role:org-admin, ${resource}, *, *, allow"
],
# Assign GitHub org
flatten([
for role, teams in var.argocd_github_teams : [
for team in teams : "g, ${var.argocd_github_org}:${team}, role:${role}"
]
])
flatten(
concat(
[
for role, teams in var.argocd_github_teams : [
for team in teams : "g, ${var.argocd_github_org}:${team}, role:${role}"
]
],
[for group, user in local.additional_users : "g, ${group}, role:${user.role}"]
)
)
))
})
]
Expand Down
4 changes: 4 additions & 0 deletions modules/kubernetes/files/argocd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ server:
gethomepage.dev/group: Cluster
gethomepage.dev/icon: argocd
gethomepage.dev/name: ArgoCD
gethomepage.dev/widget.type: argocd
gethomepage.dev/widget.url: http://argocd-server.argocd.svc.cluster.local
gethomepage.dev/widget.key: "{{HOMEPAGE_VAR_ARGOCD_KEY}}"
tls: true
extraTLS:
- hosts:
Expand All @@ -44,6 +47,7 @@ configs:
oidc.tls.insecure.skip.verify: ${oidc_tls_skip_verify}
statusbadge.enabled: true
url: https://${domain}
${indent(4, additional_users)}
params:
server.insecure: true
rbac:
Expand Down
3 changes: 3 additions & 0 deletions registry/components/homepage/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ spec:
target:
name: homepage-secrets
data:
- secretKey: HOMEPAGE_VAR_ARGOCD_KEY
remoteRef:
key: ARGOCD_HOMEPAGE_TOKEN
- secretKey: HOMEPAGE_VAR_CALENDAR_SIMONEMMS_GMAIL_COM
remoteRef:
key: CALENDAR_SIMONEMMS_GMAIL_COM
Expand Down

0 comments on commit a0df0c8

Please sign in to comment.