diff --git a/gatus/backup-check.yaml b/gatus/backup-check.yaml index bc22ab3..5192b2d 100644 --- a/gatus/backup-check.yaml +++ b/gatus/backup-check.yaml @@ -11,6 +11,8 @@ # younger than 26h (detached volumes are skipped; the recurring job skips # them too) # - vault-unsealed: all Vault pods report vault-sealed=false +# - argocd-apps: every Argo CD application is Synced and Healthy +# - postgres: every CloudNativePG cluster is in a healthy state # # The token is generated by ESO and never leaves the cluster; Gatus reads # it from the same Secret. @@ -63,6 +65,12 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["list"] + - apiGroups: ["argoproj.io"] + resources: ["applications"] + verbs: ["list"] + - apiGroups: ["postgresql.cnpg.io"] + resources: ["clusters"] + verbs: ["list"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -170,6 +178,24 @@ data: return f"sealed: {', '.join(sealed)}" if sealed else None + def argocd(): + bad = [] + for a in items("/apis/argoproj.io/v1alpha1/namespaces/argocd/applications"): + s = a.get("status", {}) + sync = s.get("sync", {}).get("status") + health = s.get("health", {}).get("status") + if sync != "Synced" or health != "Healthy": + bad.append(f"{a['metadata']['name']} {sync}/{health}") + return "; ".join(bad) or None + + + def postgres(): + bad = [f"{c['metadata']['namespace']}/{c['metadata']['name']}: {c.get('status', {}).get('phase')}" + for c in items("/apis/postgresql.cnpg.io/v1/clusters") + if c.get("status", {}).get("phase") != "Cluster in healthy state"] + return "; ".join(bad) or None + + def push(key, error): query = {"success": "false" if error else "true"} if error: @@ -185,6 +211,8 @@ data: "cluster_velero-weekly": lambda: velero("weekly-backup", 8 * 24 + 2), "cluster_longhorn": lambda: longhorn(26), "cluster_vault-unsealed": vault, + "cluster_argocd-apps": argocd, + "cluster_postgres": postgres, } failed_pushes = 0 for key, check in checks.items(): diff --git a/gatus/config.yaml b/gatus/config.yaml index 6d8bc05..ab6b729 100644 --- a/gatus/config.yaml +++ b/gatus/config.yaml @@ -169,3 +169,15 @@ external-endpoints: heartbeat: interval: 3h alerts: *cluster-alert + - name: argocd-apps + group: cluster + token: ${BACKUP_CHECK_TOKEN} + heartbeat: + interval: 3h + alerts: *cluster-alert + - name: postgres + group: cluster + token: ${BACKUP_CHECK_TOKEN} + heartbeat: + interval: 3h + alerts: *cluster-alert