From 86f4bf89f8dac7baec5c867ca4b079716115c4e8 Mon Sep 17 00:00:00 2001 From: Bazmahou Date: Mon, 20 Oct 2025 16:01:36 +0100 Subject: [PATCH 1/3] feat: Implement health checks for Service resources Add custom health check logic for Services in Argo CD. --- argocd.yaml.tpl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/argocd.yaml.tpl b/argocd.yaml.tpl index eba89d1..e9a4b83 100644 --- a/argocd.yaml.tpl +++ b/argocd.yaml.tpl @@ -176,6 +176,32 @@ configs: # https://github.com/argoproj/argo-cd/issues/3781 # enables health check assessment for argocd applications as we are using sync-waves # @ignored + + resource.customizations.health.Service: | + hs = {} + + if obj.spec.externalIPs ~= nil and #obj.spec.externalIPs > 0 then + hs.status = "Healthy" + hs.message = "Service is exposed via externalIPs" + return hs + end + + if obj.spec.type == "LoadBalancer" then + if obj.status.loadBalancer ~= nil and obj.status.loadBalancer.ingress ~= nil and #obj.status.loadBalancer.ingress > 0 then + hs.status = "Healthy" + hs.message = "LoadBalancer has been provisioned" + else + -- If no ingress IP, the LoadBalancer is still being created. + hs.status = "Progressing" + hs.message = "Waiting for LoadBalancer to be provisioned" + end + else + hs.status = "Healthy" + hs.message = "Service is ready" + end + + return hs + resource.customizations.health.argoproj.io_Application: | hs = {} hs.status = "Progressing" From e9c49f43d9a75a18851565edb5509ba09bec71cb Mon Sep 17 00:00:00 2001 From: Bazmahou Date: Tue, 21 Oct 2025 11:57:07 +0100 Subject: [PATCH 2/3] feat: change checking condition Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- argocd.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argocd.yaml.tpl b/argocd.yaml.tpl index e9a4b83..36d6f3d 100644 --- a/argocd.yaml.tpl +++ b/argocd.yaml.tpl @@ -180,7 +180,7 @@ configs: resource.customizations.health.Service: | hs = {} - if obj.spec.externalIPs ~= nil and #obj.spec.externalIPs > 0 then + if obj.spec and obj.spec.externalIPs and #obj.spec.externalIPs > 0 then hs.status = "Healthy" hs.message = "Service is exposed via externalIPs" return hs From 7c597a8c144baedd06dfe9d98a3637613847b7af Mon Sep 17 00:00:00 2001 From: Bazmahou Date: Tue, 21 Oct 2025 12:00:38 +0100 Subject: [PATCH 3/3] fix: change condition checking Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- argocd.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argocd.yaml.tpl b/argocd.yaml.tpl index 36d6f3d..d657be1 100644 --- a/argocd.yaml.tpl +++ b/argocd.yaml.tpl @@ -187,7 +187,7 @@ configs: end if obj.spec.type == "LoadBalancer" then - if obj.status.loadBalancer ~= nil and obj.status.loadBalancer.ingress ~= nil and #obj.status.loadBalancer.ingress > 0 then + if obj.status ~= nil and obj.status.loadBalancer ~= nil and obj.status.loadBalancer.ingress ~= nil and #obj.status.loadBalancer.ingress > 0 then hs.status = "Healthy" hs.message = "LoadBalancer has been provisioned" else