feat(argo): add more informations for argocd play well with crossplane (#627)

This commit is contained in:
Christopher Haar 2023-11-27 17:45:51 +01:00 committed by GitHub
parent 4b76eb541a
commit bb4b044f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 83 additions and 4 deletions

View File

@ -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.