From bb4b044f049b8827bd89f038d359dd3f5248485e Mon Sep 17 00:00:00 2001 From: Christopher Haar Date: Mon, 27 Nov 2023 17:45:51 +0100 Subject: [PATCH] feat(argo): add more informations for argocd play well with crossplane (#627) --- .../integrations/argo-cd-crossplane.md | 87 ++++++++++++++++++- 1 file changed, 83 insertions(+), 4 deletions(-) diff --git a/content/knowledge-base/integrations/argo-cd-crossplane.md b/content/knowledge-base/integrations/argo-cd-crossplane.md index 1e37d9ac..86d673a1 100644 --- a/content/knowledge-base/integrations/argo-cd-crossplane.md +++ b/content/knowledge-base/integrations/argo-cd-crossplane.md @@ -19,20 +19,99 @@ to use Annotation based resource tracking. See the [Argo CD docs](https://argo-c ### Configuring Argo CD with Crossplane -To configure Argo CD for Annotation resource tracking, edit the `argocd-cm` +To configure Argo CD for Annotation resource tracking and Health Status, edit the `argocd-cm` `ConfigMap` in the `argocd` `Namespace`. Add `application.resourceTrackingMethod: annotation` to the data section as below: ```yaml - apiVersion: v1 +kind: ConfigMap data: application.resourceTrackingMethod: annotation -kind: ConfigMap + resource.customizations: | + "*.upbound.io/*": + health.lua: | + health_status = { + status = "Progressing", + message = "Provisioning ..." + } + + if obj.status == nil or obj.status.conditions == nil then + return health_status + end + + for i, condition in ipairs(obj.status.conditions) do + if condition.type == "LastAsyncOperation" then + if condition.status == "False" then + health_status.status = "Degraded" + health_status.message = condition.message + return health_status + end + end + + if condition.type == "Synced" then + if condition.status == "False" then + health_status.status = "Degraded" + health_status.message = condition.message + return health_status + end + end + + if condition.type == "Ready" then + if condition.status == "True" then + health_status.status = "Healthy" + health_status.message = "Resource is up-to-date." + return health_status + end + end + end + + return health_status + + "*.crossplane.io/*": + health.lua: | + health_status = { + status = "Progressing", + message = "Provisioning ..." + } + + if obj.status == nil or obj.status.conditions == nil then + return health_status + end + + for i, condition in ipairs(obj.status.conditions) do + if condition.type == "LastAsyncOperation" then + if condition.status == "False" then + health_status.status = "Degraded" + health_status.message = condition.message + return health_status + end + end + + if condition.type == "Synced" then + if condition.status == "False" then + health_status.status = "Degraded" + health_status.message = condition.message + return health_status + end + end + + if condition.type == "Ready" then + if condition.status == "True" then + health_status.status = "Healthy" + health_status.message = "Resource is up-to-date." + return health_status + end + end + end + + return health_status ``` On the next Argo CD sync, Crossplane `Claims` and `Composite Resources` will -be considered synchronized and will not trigger auto-pruning. +be considered synchronized with status and will not trigger auto-pruning. + +Set the environment variable `ARGOCD_K8S_CLIENT_QPS` to `300` for improved compatibility with a large number of CRDs.