Argo CD provides built-in health checks for standard Kubernetes resources. For custom resources or specialized health logic, you can write custom health checks in Lua.
Built-in Health ChecksArgo CD includes health checks for:
apiVersion: v1kind: ConfigMapmetadata: name: argocd-cm namespace: argocddata: resource.customizations.health.cert-manager.io_Certificate: | hs = {} if obj.status ~= nil then if obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" and condition.status == "False" then hs.status = "Degraded" hs.message = condition.message return hs end if condition.type == "Ready" and condition.status == "True" then hs.status = "Healthy" hs.message = condition.message return hs end end end end hs.status = "Progressing" hs.message = "Waiting for certificate" return hs
The customization key format is resource.customizations.health.<apiGroup>_<kind>.
hs = {}hs.status = "Progressing"hs.message = "Waiting for resource to be ready"if obj.status ~= nil and obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" then if condition.status == "True" then hs.status = "Healthy" hs.message = "Resource is ready" elseif condition.status == "False" then hs.status = "Degraded" hs.message = condition.message or "Resource is not ready" end return hs end endendreturn hs
hs = {}if obj.status ~= nil and obj.status.conditions ~= nil then local ready = false local available = false for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" and condition.status == "True" then ready = true end if condition.type == "Available" and condition.status == "True" then available = true end end if ready and available then hs.status = "Healthy" hs.message = "All conditions met" else hs.status = "Progressing" hs.message = "Waiting for conditions" endelse hs.status = "Progressing" hs.message = "No status available"endreturn hs
resource.customizations: | ec2.aws.crossplane.io/*: health.lua: | # Health check for all EC2 resources hs = {} if obj.status ~= nil and obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" and condition.status == "True" then hs.status = "Healthy" return hs end end end hs.status = "Progressing" return hs
Wildcards only work with the resource.customizations key format. The resource.customizations.health.<group>_<kind> format doesn’t support wildcards.
Standard Lua libraries are disabled by default for security. Enable only for trusted scripts.
data: resource.customizations.useOpenLibs.cert-manager.io_Certificate: "true" resource.customizations.health.cert-manager.io_Certificate: | # Lua standard libraries are enabled for this script hs = {} # ... your health check logic return hs
The health check for argoproj.io/Application was removed in v1.8. Restore it for app-of-apps patterns:
resource.customizations.health.argoproj.io_Application: | hs = {} hs.status = "Progressing" hs.message = "" if obj.status ~= nil then if obj.status.health ~= nil then hs.status = obj.status.health.status if obj.status.health.message ~= nil then hs.message = obj.status.health.message end end end return hs
Argo CD Application health is the worst health of its immediate child resources:Priority (most to least healthy): Healthy → Suspended → Progressing → Missing → Degraded → Unknown
Example: If an App has a Missing resource and a Degraded resource, the App’s health will be Degraded.
hs = {}hs.status = "Progressing"hs.message = ""if obj.status ~= nil then if obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" then hs.message = condition.message if condition.status == "True" then hs.status = "Healthy" else hs.status = "Degraded" end return hs end if condition.type == "Synced" and condition.status == "False" then hs.status = "Degraded" hs.message = condition.message return hs end end endendreturn hs