mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
chore(action): minor lua changes (#15580)
* chore(action): add newlines at eof Signed-off-by: Josh Soref <jsoref@gmail.com> * chore(action): fix whitespace indentation Signed-off-by: Josh Soref <jsoref@gmail.com> * chore(action): use local annotations Signed-off-by: Josh Soref <jsoref@gmail.com> --------- Signed-off-by: Josh Soref <jsoref@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["restart"] = {}
|
||||
return actions
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["restart"] = {}
|
||||
|
||||
local paused = false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["restart"] = {}
|
||||
return actions
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["terminate"] = {["disabled"] = (obj.spec.terminate or
|
||||
obj.status.phase == "Successful" or
|
||||
obj.status.phase == "Failed" or
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
|
||||
function messageOrDefault(field, default)
|
||||
if field ~= nil then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
|
||||
@@ -32,7 +32,7 @@ function deepCopy(object)
|
||||
return _copy(object)
|
||||
end
|
||||
|
||||
workflow = {}
|
||||
local workflow = {}
|
||||
workflow.apiVersion = "argoproj.io/v1alpha1"
|
||||
workflow.kind = "Workflow"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["create-workflow"] = {
|
||||
["iconClass"] = "fa fa-fw fa-play",
|
||||
["displayName"] = "Create Workflow"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase == "Pending" then
|
||||
hs.status = "Progressing"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["restart"] = {["disabled"] = false}
|
||||
|
||||
local paused = false
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -22,7 +22,7 @@ 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
|
||||
@@ -30,10 +30,10 @@ 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["create-workflow"] = {
|
||||
["iconClass"] = "fa fa-fw fa-play",
|
||||
["displayName"] = "Create Workflow"
|
||||
|
||||
@@ -28,7 +28,7 @@ function deepCopy(object)
|
||||
return _copy(object)
|
||||
end
|
||||
|
||||
job = {}
|
||||
local job = {}
|
||||
job.apiVersion = "batch/v1"
|
||||
job.kind = "Job"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["create-job"] = {
|
||||
["iconClass"] = "fa fa-fw fa-play",
|
||||
["displayName"] = "Create Job"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for machines"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
|
||||
hs.status = "Progressing"
|
||||
hs.message = ""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.availableNodes ~= nil then
|
||||
local sum = 0
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
actions = {}
|
||||
local actions = {}
|
||||
actions["refresh"] = {["disabled"] = false}
|
||||
return actions
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
sep = " --- "
|
||||
hs = {}
|
||||
local sep = " --- "
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
message = ""
|
||||
local message = ""
|
||||
if tonumber(obj.status.canaryWeight) > 0 then
|
||||
message = "Canary Weight: " .. obj.status.canaryWeight .. " %"
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
|
||||
if obj.status ~= nil and obj.status.reconciliationStatus ~= nil then
|
||||
if obj.status.reconciliationStatus.success or obj.status.reconciliationStatus.state == "DEPLOYED" then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.status ~= nil then
|
||||
if obj.status.status == 0 or obj.status.status == "NONE" then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase == "Running" then
|
||||
health_status.status = "Healthy"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.brokersState ~= nil then
|
||||
counter = 0
|
||||
brokerReady = 0
|
||||
local counter = 0
|
||||
local brokerReady = 0
|
||||
for i, broker in pairs(obj.status.brokersState) do
|
||||
if (brokerReady <= tonumber(i)) then
|
||||
brokerReady = tonumber(i)+1
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.status == "SUCCESS" then
|
||||
health_status.status = "Healthy"
|
||||
|
||||
@@ -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.conditions ~= nil then
|
||||
for i, condition in ipairs(obj.status.conditions) do
|
||||
@@ -13,7 +13,7 @@ if obj.status ~= nil then
|
||||
hs.message="Running"
|
||||
else
|
||||
if obj.status.created then
|
||||
hs.message = "Starting"
|
||||
hs.message = "Starting"
|
||||
else
|
||||
hs.status = "Suspended"
|
||||
hs.message = "Stopped"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status.status == "Succeeded" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "KeptnAppVersion is healthy"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status.overallStatus == "Succeeded" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "KeptnEvaluation is healthy"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status.status == "Succeeded" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "KeptnTask is healthy"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status.status == "Succeeded" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "KeptnWorkloadInstance is healthy"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
|
||||
if obj.status ~= nil and obj.status.conditions ~= nil then
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.currentState ~= nil then
|
||||
if obj.status.currentState == "Initialized" then
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
|
||||
if obj.status ~= nil then
|
||||
if obj.status.domainStatus ~= nil then
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
numTrue = 0
|
||||
numFalse = 0
|
||||
msg = ""
|
||||
local numTrue = 0
|
||||
local numFalse = 0
|
||||
local msg = ""
|
||||
for i, condition in pairs(obj.status.conditions) do
|
||||
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. "\n"
|
||||
if condition.type == "Ready" and condition.status == "True" then
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
numTrue = 0
|
||||
numFalse = 0
|
||||
msg = ""
|
||||
local numTrue = 0
|
||||
local numFalse = 0
|
||||
local msg = ""
|
||||
for i, condition in pairs(obj.status.conditions) do
|
||||
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. "\n"
|
||||
if condition.type == "Ready" and condition.status == "True" then
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- healthcheck for IngressController resources
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
-- if the status conditions are present, iterate over them and check their status
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
numDegraded = 0
|
||||
numPending = 0
|
||||
msg = ""
|
||||
local numDegraded = 0
|
||||
local numPending = 0
|
||||
local msg = ""
|
||||
for i, condition in pairs(obj.status.conditions) do
|
||||
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. "\n"
|
||||
if condition.type == "InstallPlanPending" and condition.status == "True" then
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
installed = false
|
||||
healthy = false
|
||||
local installed = false
|
||||
local healthy = false
|
||||
for i, condition in ipairs(obj.status.conditions) do
|
||||
if condition.type == "Installed" then
|
||||
installed = condition.status == "True"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "RUNNING" then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "RUNNING" then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "RUNNING" then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "RUNNING" then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "RUNNING" then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "RUNNING" then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
adopted = { status = "Unknown" }
|
||||
advertised = { status = "Unknown" }
|
||||
discovered = { status = "Unknown" }
|
||||
local adopted = { status = "Unknown" }
|
||||
local advertised = { status = "Unknown" }
|
||||
local discovered = { status = "Unknown" }
|
||||
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
|
||||
if obj.status.state == "initializing" then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.ingress ~= nil then
|
||||
numIngressRules = 0
|
||||
numTrue = 0
|
||||
numFalse = 0
|
||||
local numIngressRules = 0
|
||||
local numTrue = 0
|
||||
local numFalse = 0
|
||||
for _, ingressRules in pairs(obj.status.ingress) do
|
||||
numIngressRules = numIngressRules + 1
|
||||
if obj.status.ingress ~= nil then
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
health_status.status = "Progressing"
|
||||
health_status.message = "Waiting for status update."
|
||||
if obj.status ~= nil and obj.status.conditions ~= nil then
|
||||
status_true = 0
|
||||
status_false = 0
|
||||
status_unknown = 0
|
||||
local status_true = 0
|
||||
local status_false = 0
|
||||
local status_unknown = 0
|
||||
health_status.message = ""
|
||||
for i, condition in pairs(obj.status.conditions) do
|
||||
if condition.status == "True" and (condition.type == "ConfigurationsReady" or condition.type == "RoutesReady" or condition.type == "Ready") then
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
health_status.status = "Progressing"
|
||||
health_status.message = "Waiting for status update."
|
||||
if obj.status ~= nil and obj.status.conditions ~= nil then
|
||||
status_true = 0
|
||||
status_false = 0
|
||||
status_unknown = 0
|
||||
local status_true = 0
|
||||
local status_false = 0
|
||||
local status_unknown = 0
|
||||
health_status.message = ""
|
||||
for i, condition in pairs(obj.status.conditions) do
|
||||
if condition.status == "True" and (condition.type == "IngressReady" or condition.type == "PredictorConfigurationReady" or condition.type == "PredictorReady" or condition.type == "PredictorRouteReady" or condition.type == "Ready") then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
|
||||
if obj.status ~= nil and obj.status.readyToUse then
|
||||
hs.status = "Healthy"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
|
||||
if obj.status ~= nil and obj.status.readyToUse then
|
||||
hs.status = "Healthy"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
-- Can't use standard lib, math.huge equivalent
|
||||
infinity = 2^1024-1
|
||||
local infinity = 2^1024-1
|
||||
|
||||
local function executor_range_api()
|
||||
min_executor_instances = 0
|
||||
max_executor_instances = infinity
|
||||
local min_executor_instances = 0
|
||||
local max_executor_instances = infinity
|
||||
if obj.spec.dynamicAllocation.maxExecutors then
|
||||
max_executor_instances = obj.spec.dynamicAllocation.maxExecutors
|
||||
end
|
||||
@@ -15,8 +15,8 @@ local function executor_range_api()
|
||||
end
|
||||
|
||||
local function maybe_executor_range_spark_conf()
|
||||
min_executor_instances = 0
|
||||
max_executor_instances = infinity
|
||||
local min_executor_instances = 0
|
||||
local max_executor_instances = infinity
|
||||
if obj.spec.sparkConf["spark.streaming.dynamicAllocation.enabled"] ~= nil and
|
||||
obj.spec.sparkConf["spark.streaming.dynamicAllocation.enabled"] == "true" then
|
||||
if(obj.spec.sparkConf["spark.streaming.dynamicAllocation.maxExecutors"] ~= nil) then
|
||||
@@ -78,7 +78,7 @@ if obj.status ~= nil then
|
||||
health_status.message = "SparkApplication is Running"
|
||||
return health_status
|
||||
elseif maybe_executor_range() then
|
||||
min_executor_instances, max_executor_instances = maybe_executor_range()
|
||||
local min_executor_instances, max_executor_instances = maybe_executor_range()
|
||||
if count >= min_executor_instances and count <= max_executor_instances then
|
||||
health_status.status = "Healthy"
|
||||
health_status.message = "SparkApplication is Running"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
|
||||
if obj.status == nil or obj.status.conditions == nil then
|
||||
return hs
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Waiting for stack to be installed"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {
|
||||
local hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase == "Bound" and obj.status.lastOperationStatus == "Success" then
|
||||
hs.status = "Healthy"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hs = {}
|
||||
local hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.status == "Installed" then
|
||||
hs.status = "Healthy"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status == nil then
|
||||
health_status.status = "Progressing"
|
||||
health_status.message = "Current resource status is insufficient"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status == nil then
|
||||
health_status.status = "Progressing"
|
||||
health_status.message = "Current resource status is insufficient"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
health_status = {}
|
||||
local health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.readyReplicas ~= 0 and obj.status.readyReplicas == obj.status.replicas then
|
||||
health_status.status = "Healthy"
|
||||
|
||||
Reference in New Issue
Block a user