github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/numaflow.numaproj.io/Pipeline/actions/discovery.lua (about)

     1  local actions = {}
     2  actions["pause"] = {
     3    ["disabled"] = true,
     4    ["iconClass"] = "fa-solid fa-fw fa-pause"
     5  }
     6  actions["unpause-gradual"] = {
     7    ["disabled"] = true,
     8    ["displayName"] = "Unpause (gradual)",
     9    ["iconClass"] = "fa-solid fa-fw fa-play"
    10  }
    11  actions["unpause-fast"] = {
    12    ["disabled"] = true,
    13    ["displayName"] = "Unpause (fast)",
    14    ["iconClass"] = "fa-solid fa-fw fa-play"
    15  }
    16  actions["force-promote"] = {
    17    ["disabled"] = true,
    18    ["displayName"] = "Force Promote",
    19    ["iconClass"] = "fa-solid fa-fw fa-forward"
    20  }
    21  
    22  -- pause/unpause
    23  local paused = false
    24  if obj.spec.lifecycle ~= nil and obj.spec.lifecycle.desiredPhase ~= nil and obj.spec.lifecycle.desiredPhase == "Paused" then
    25    paused = true
    26  end
    27  if paused then
    28    if obj.spec.metadata ~= nil and  obj.spec.metadata.annotations ~= nil and obj.spec.metadata.annotations["numaflow.numaproj.io/allowed-resume-strategies"] ~= nil then
    29      -- determine which unpausing strategies will be enabled
    30      -- if annotation not found, default will be resume slow
    31      if obj.spec.metadata.annotations["numaflow.numaproj.io/allowed-resume-strategies"] == "fast" then
    32        actions["unpause-fast"]["disabled"] = false
    33      elseif obj.spec.metadata.annotations["numaflow.numaproj.io/allowed-resume-strategies"] == "slow, fast" then
    34        actions["unpause-gradual"]["disabled"] = false
    35        actions["unpause-fast"]["disabled"] = false
    36      else
    37        actions["unpause-gradual"]["disabled"] = false
    38      end
    39    else
    40      actions["unpause-gradual"]["disabled"] = false
    41    end
    42  else
    43    actions["pause"]["disabled"] = false
    44  end
    45  
    46  -- force-promote
    47  local forcePromote = false
    48  if (obj.metadata.labels ~= nil and obj.metadata.labels["numaplane.numaproj.io/upgrade-state"] == "in-progress") then
    49    forcePromote = true
    50  end
    51  if (obj.metadata.labels ~= nil and obj.metadata.labels["numaplane.numaproj.io/force-promote"] == "true") then
    52    forcePromote = false
    53  end
    54  if forcePromote then
    55    actions["force-promote"]["disabled"] = false
    56  else
    57    actions["force-promote"]["disabled"] = true
    58  end
    59  
    60  return actions