github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/numaplane.numaproj.io/PipelineRollout/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["allow-data-loss"] = {
    17    ["disabled"] = true,
    18    ["displayName"] = "Allow (Possible) Data Loss",
    19    ["iconClass"] = "fa-solid fa-fw fa-unlock"
    20  }
    21  actions["disallow-data-loss"] = {
    22    ["disabled"] = true,
    23    ["displayName"] = "Disallow Data Loss",
    24    ["iconClass"] = "fa-solid fa-fw fa-lock"
    25  }
    26  
    27  -- pause/unpause
    28  local paused = false
    29  if obj.spec.pipeline.spec.lifecycle ~= nil and obj.spec.pipeline.spec.lifecycle.desiredPhase ~= nil and obj.spec.pipeline.spec.lifecycle.desiredPhase == "Paused" then
    30    paused = true
    31  end
    32  if paused then
    33    if obj.spec.pipeline.metadata ~= nil and  obj.spec.pipeline.metadata.annotations ~= nil and obj.spec.pipeline.metadata.annotations["numaflow.numaproj.io/allowed-resume-strategies"] ~= nil then
    34      -- determine which unpausing strategies will be enabled
    35      -- if annotation not found, default will be resume slow
    36      if obj.spec.pipeline.metadata.annotations["numaflow.numaproj.io/allowed-resume-strategies"] == "fast" then
    37        actions["unpause-fast"]["disabled"] = false
    38      elseif obj.spec.pipeline.metadata.annotations["numaflow.numaproj.io/allowed-resume-strategies"] == "slow, fast" then
    39        actions["unpause-gradual"]["disabled"] = false
    40        actions["unpause-fast"]["disabled"] = false
    41      else
    42        actions["unpause-gradual"]["disabled"] = false
    43      end
    44    else
    45      actions["unpause-gradual"]["disabled"] = false
    46    end
    47  else
    48    actions["pause"]["disabled"] = false
    49  end
    50  
    51  -- allow-data-loss/disallow-data-loss
    52  if obj.status ~= nil and obj.status.upgradeInProgress == "PipelinePauseAndDrain" then
    53    actions["allow-data-loss"]["disabled"] = false
    54  end
    55  if obj.metadata.annotations ~= nil and obj.metadata.annotations["numaplane.numaproj.io/allow-data-loss"] == "true" then
    56    actions["disallow-data-loss"]["disabled"] = false
    57  end
    58  
    59  return actions