mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
Signed-off-by: vikasrao23 <vikasrao23@users.noreply.github.com> Co-authored-by: vikasrao23 <vikasrao23@users.noreply.github.com>
23 lines
606 B
Lua
23 lines
606 B
Lua
if obj.spec == nil then
|
|
obj.spec = {}
|
|
end
|
|
if obj.spec.syncPolicy == nil then
|
|
obj.spec.syncPolicy = {}
|
|
end
|
|
|
|
local automated = obj.spec.syncPolicy.automated
|
|
local isEnabled = automated ~= nil and (automated.enabled == true or automated.enabled == nil)
|
|
|
|
if isEnabled then
|
|
-- Currently ENABLED (enabled=true or enabled=nil): disable it
|
|
automated.enabled = false
|
|
else
|
|
-- Currently DISABLED (automated absent or enabled=false): enable it
|
|
if automated == nil then
|
|
obj.spec.syncPolicy.automated = { enabled = true }
|
|
else
|
|
automated.enabled = true
|
|
end
|
|
end
|
|
|
|
return obj
|