#
#  Author: Hari Sekhon
#  Date: 2021-06-29 16:25:42 +0100 (Tue, 29 Jun 2021)
#
#  vim:ts=2:sts=2:sw=2:et
#
#  https://github.com/HariSekhon/Kubernetes-configs
#
#  License: see accompanying Hari Sekhon LICENSE file
#
#  If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
#  https://www.linkedin.com/in/HariSekhon
#

# ============================================================================ #
#      A r g o C D   S e t t i n g s   S t a t u s   B a d g e   P a t c h
# ============================================================================ #

# https://argo-cd.readthedocs.io/en/stable/user-guide/status-badge/

# Patch to configure ArgoCD settings configmap to enable status badge

# Status badge is unauthenticated available at:
#
#   $ARGOCD_SERVER_URL/api/badge?name=$APP_NAME

# Download argocd CLI:
#
#   curl -sSL https://raw.githubusercontent.com/HariSekhon/DevOps-Bash-tools/master/setup/install_argocd.sh | bash
#
# Validate:
#
#   argocd admin settings validate --argocd-cm-path ./argocd-cm.statusbadge.patch.yaml
#
# Apply:
#
#   run: kubectl patch configmap argocd-cm --namespace argocd --patch "$(cat argocd-cm.statusbadge.patch.yaml)"
#

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cm
  #namespace: argocd  # breaks kustomize patching of argocd base, see argocd-cm.repos.patch.yaml for details
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd  # necessary for configmap to be picked up my ArgoCD
data:
  statusbadge.enabled: "true"  # not enabled by default due to being unauthenticated
