Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
health_check = {}
local health_check = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil and obj.status.replicas ~= nil then
numTrue = 0
local numTrue = 0
for i, condition in pairs(obj.status.conditions) do
if (condition.type == "Available" or (condition.type == "Progressing" and condition.reason == "NewReplicationControllerAvailable")) and condition.status == "True" then
numTrue = numTrue + 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
actions = {}
local actions = {}
actions["restart"] = {}
return actions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
actions = {}
local actions = {}
actions["restart"] = {}

local paused = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
actions = {}
local actions = {}
actions["restart"] = {}
return actions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
actions = {}
local actions = {}
actions["terminate"] = {["disabled"] = (obj.spec.terminate or
obj.status.phase == "Successful" or
obj.status.phase == "Failed" or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}

function messageOrDefault(field, default)
if field ~= nil then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}

if obj.status ~= nil then
if obj.status.conditions ~= nil then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function deepCopy(object)
return _copy(object)
end

workflow = {}
local workflow = {}
workflow.apiVersion = "argoproj.io/v1alpha1"
workflow.kind = "Workflow"

Expand Down Expand Up @@ -63,7 +63,7 @@ if (obj.spec.workflowMetadata ~= nil and obj.spec.workflowMetadata.finalizers ~=
end
end

ownerRef = {}
local ownerRef = {}
ownerRef.apiVersion = obj.apiVersion
ownerRef.kind = obj.kind
ownerRef.name = obj.metadata.name
Expand All @@ -73,10 +73,10 @@ workflow.metadata.ownerReferences[1] = ownerRef

workflow.spec = deepCopy(obj.spec.workflowSpec)

impactedResource = {}
local impactedResource = {}
impactedResource.operation = "create"
impactedResource.resource = workflow
result = {}
local result = {}
result[1] = impactedResource

return result
return result
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
actions = {}
local actions = {}
actions["create-workflow"] = {
["iconClass"] = "fa fa-fw fa-play",
["displayName"] = "Create Workflow"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}

if obj.status ~= nil then
if obj.status.conditions ~= nil then
Expand Down
2 changes: 1 addition & 1 deletion resource_customizations/argoproj.io/EventBus/health.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs={ status = "Progressing", message = "Waiting for initialization" }
local hs={ status = "Progressing", message = "Waiting for initialization" }

if obj.status ~= nil then
if obj.status.conditions ~= nil then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.phase == "Pending" then
hs.status = "Progressing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
actions = {}
local actions = {}
actions["restart"] = {["disabled"] = false}

local paused = false
Expand All @@ -9,13 +9,13 @@ elseif obj.spec.paused ~= nil then
end
actions["resume"] = {["disabled"] = not(paused)}

fullyPromoted = obj.status.currentPodHash == obj.status.stableRS
local fullyPromoted = obj.status.currentPodHash == obj.status.stableRS
actions["abort"] = {["disabled"] = fullyPromoted or obj.status.abort}
actions["retry"] = {["disabled"] = fullyPromoted or not(obj.status.abort)}

actions["promote-full"] = {["disabled"] = true}
if obj.status ~= nil and not(fullyPromoted) then
generation = tonumber(obj.status.observedGeneration)
local generation = tonumber(obj.status.observedGeneration)
if generation == nil or generation > obj.metadata.generation then
-- rollouts v0.9 - full promotion only supported for canary
actions["promote-full"] = {["disabled"] = obj.spec.strategy.blueGreen ~= nil}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if obj.status ~= nil then
generation = tonumber(obj.status.observedGeneration)
local generation = tonumber(obj.status.observedGeneration)
if generation == nil or generation > obj.metadata.generation then
-- rollouts v0.9 and below
obj.status.abort = nil
Expand Down
18 changes: 9 additions & 9 deletions resource_customizations/argoproj.io/Rollout/health.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function checkReplicasStatus(obj)
hs = {}
desiredReplicas = getNumberValueOrDefault(obj.spec.replicas, 1)
local hs = {}
local desiredReplicas = getNumberValueOrDefault(obj.spec.replicas, 1)
statusReplicas = getNumberValueOrDefault(obj.status.replicas, 0)
updatedReplicas = getNumberValueOrDefault(obj.status.updatedReplicas, 0)
availableReplicas = getNumberValueOrDefault(obj.status.availableReplicas, 0)
local availableReplicas = getNumberValueOrDefault(obj.status.availableReplicas, 0)

if updatedReplicas < desiredReplicas then
hs.status = "Progressing"
Expand Down Expand Up @@ -38,7 +38,7 @@ function getNumberValueOrDefault(field, default)
end

function checkPaused(obj)
hs = {}
local hs = {}
hs.status = "Suspended"
hs.message = "Rollout is paused"
if obj.status.pauseConditions ~= nil and table.getn(obj.status.pauseConditions) > 0 then
Expand Down Expand Up @@ -73,12 +73,12 @@ function isWorkloadGenerationObserved(obj)
-- rollout is v1.0 or earlier
return true
end
workloadGen = tonumber(obj.metadata.annotations["rollout.argoproj.io/workload-generation"])
observedWorkloadGen = tonumber(obj.status.workloadObservedGeneration)
local workloadGen = tonumber(obj.metadata.annotations["rollout.argoproj.io/workload-generation"])
local observedWorkloadGen = tonumber(obj.status.workloadObservedGeneration)
return workloadGen == observedWorkloadGen
end

hs = {}
local hs = {}
if not isGenerationObserved(obj) or not isWorkloadGenerationObserved(obj) then
hs.status = "Progressing"
hs.message = "Waiting for rollout spec update to be observed"
Expand Down Expand Up @@ -115,7 +115,7 @@ for _, condition in ipairs(obj.status.conditions) do
end
end

isPaused = checkPaused(obj)
local isPaused = checkPaused(obj)
if isPaused ~= nil then
return isPaused
end
Expand All @@ -132,7 +132,7 @@ if replicasHS ~= nil then
end


stableRS = getStableRS(obj)
local stableRS = getStableRS(obj)

if obj.spec.strategy.blueGreen ~= nil then
if obj.status.blueGreen == nil or obj.status.blueGreen.activeSelector ~= obj.status.currentPodHash then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local os = require("os")
-- This code is written to mimic what the Argo Workflows API server does to create a Workflow from a WorkflowTemplate.
-- https://github.com/argoproj/argo-workflows/blob/873a58de7dd9dad76d5577b8c4294a58b52849b8/workflow/common/convert.go#L34

workflow = {}
local workflow = {}
workflow.apiVersion = "argoproj.io/v1alpha1"
workflow.kind = "Workflow"

Expand All @@ -22,18 +22,18 @@ workflow.spec = {}
workflow.spec.workflowTemplateRef = {}
workflow.spec.workflowTemplateRef.name = obj.metadata.name

ownerRef = {}
local ownerRef = {}
ownerRef.apiVersion = obj.apiVersion
ownerRef.kind = obj.kind
ownerRef.name = obj.metadata.name
ownerRef.uid = obj.metadata.uid
workflow.metadata.ownerReferences = {}
workflow.metadata.ownerReferences[1] = ownerRef

impactedResource = {}
local impactedResource = {}
impactedResource.operation = "create"
impactedResource.resource = workflow
result = {}
local result = {}
result[1] = impactedResource

return result
return result
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
actions = {}
local actions = {}
actions["create-workflow"] = {
["iconClass"] = "fa fa-fw fa-play",
["displayName"] = "Create Workflow"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function deepCopy(object)
return _copy(object)
end

job = {}
local job = {}
job.apiVersion = "batch/v1"
job.kind = "Job"

Expand All @@ -39,7 +39,7 @@ end
job.metadata.name = obj.metadata.name .. "-" ..os.date("!%Y%m%d%H%M")
job.metadata.namespace = obj.metadata.namespace

ownerRef = {}
local ownerRef = {}
ownerRef.apiVersion = obj.apiVersion
ownerRef.kind = obj.kind
ownerRef.name = obj.metadata.name
Expand All @@ -53,10 +53,10 @@ job.spec.template = {}
job.spec.template.metadata = deepCopy(obj.spec.jobTemplate.spec.template.metadata)
job.spec.template.spec = deepCopy(obj.spec.jobTemplate.spec.template.spec)

impactedResource = {}
local impactedResource = {}
impactedResource.operation = "create"
impactedResource.resource = job
result = {}
local result = {}
result[1] = impactedResource

return result
return result
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
actions = {}
local actions = {}
actions["create-job"] = {
["iconClass"] = "fa fa-fw fa-play",
["displayName"] = "Create Job"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
health_status={}
local health_status={}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.racks ~= nil then
all_racks_good = true
local all_racks_good = true
for key, value in pairs(obj.status.racks) do
if all_racks_good and value.members ~= nil and value.readyMembers ~= nil and value.members ~= value.readyMembers then
all_racks_good = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = { status="Progressing", message="No status available"}
local hs = { status="Progressing", message="No status available"}
if obj.status ~= nil then
if obj.status.phase ~= nil then
hs.message = obj.status.phase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {
local hs = {
status = "Progressing",
message = "Update in progress"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {
local hs = {
status = "Progressing",
message = "Update in progress"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function getReadyContitionStatus(obj, hs)
return hs
end

hs = {}
local hs = {}
if obj.spec.paused ~= nil and obj.spec.paused then
hs.status = "Suspended"
hs.message = "Cluster is paused"
Expand Down
4 changes: 2 additions & 2 deletions resource_customizations/cluster.x-k8s.io/Machine/health.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function getStatusBasedOnPhase(obj)
hs = {}
local hs = {}
hs.status = "Progressing"
hs.message = "Waiting for machines"
if obj.status ~= nil and obj.status.phase ~= nil then
Expand All @@ -26,7 +26,7 @@ function getReadyContitionMessage(obj)
return "Condition is unknown"
end

hs = getStatusBasedOnPhase(obj)
local hs = getStatusBasedOnPhase(obj)
if hs.status ~= "Healthy" then
hs.message = getReadyContitionMessage(obj)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
hs.status = "Progressing"
hs.message = "Waiting for machines"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}

hs.status = "Progressing"
hs.message = ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {
local hs = {
status = "Progressing",
message = "Update in progress"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.availableNodes ~= nil then
local sum = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
-- For ClusterExternalSecret, new statuses are appended to the end of the list
lastStatus = obj.status.conditions[#obj.status.conditions]
local lastStatus = obj.status.conditions[#obj.status.conditions]
if lastStatus.type == "Ready" and lastStatus.status == "True" then
hs.status = "Healthy"
hs.message = lastStatus.message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hs = {}
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
actions = {}
local actions = {}
actions["refresh"] = {["disabled"] = false}
return actions
Loading