You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal is to only set the health on a resource when some conditions are, and not set any health on the object if the Lua script does not report any status.
resource.customizations.health.Secret: |
hs = {}
if obj.metadata.annotations ~= nil and obj.metadata.annotations["my-annotation"] ~= nil and obj.metadata.annotations["my-annotation"] == "foo" then
hs.status = "Healthy"
hs.message = ""
return hs
end
if obj.metadata.annotations ~= nil and obj.metadata.annotations["my-annotation"] ~= nil and obj.metadata.annotations["my-annotation"] == "bar" then
hs.status = "Healthy"
hs.message = ""
return hs
end
if obj.metadata.annotations ~= nil and obj.metadata.annotations["my-annotation"] ~= nil then
hs.status = "Degraded"
hs.message = "this is an example"
return hs
end
-- Here we want to return nil or empty object so that the health is not set
return hs
When a health check on a resource is returning empty or nil from a Lua script, Argo is not able to ignore the Health of that resource.
then it will return expect table output from Lua script, not nil
If we set it instead to the following
resource.customizations.health.Secret: |
-- A script that does not return anything
then it will return expect table output from Lua script, not nil
Expected behavior
hs = {} should be unmarshaled correctly and not set (and remove) any health status in ArgoCD return nil should be valid and not set (and remove) any health status in ArgoCD return should be valid and not set (and remove) any health status in ArgoCD
hi, I have created a PR trying to fix this issue without using the workaround, not sure if this is the direction @agaudreault intended.
I would love if someone could check it out.
Describe the bug
The goal is to only set the health on a resource when some conditions are, and not set any health on the object if the Lua script does not report any status.
When a health check on a resource is returning empty or nil from a Lua script, Argo is not able to ignore the Health of that resource.
To Reproduce
Setting the following script in argo-cm
then it will return
json: cannot unmarshal array into Go value of type health.HealthStatus
If we set it instead to the following
then it will return
expect table output from Lua script, not nil
If we set it instead to the following
then it will return
expect table output from Lua script, not nil
Expected behavior
hs = {}
should be unmarshaled correctly and not set (and remove) any health status in ArgoCDreturn nil
should be valid and not set (and remove) any health status in ArgoCDreturn
should be valid and not set (and remove) any health status in ArgoCDScreenshots
Version
2.11.2
Workaround
We can set the health status to healthy
The text was updated successfully, but these errors were encountered: