-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: adding more resources in the lua script #202
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,35 @@ configs: | |
message = "Provisioning ..." | ||
} | ||
|
||
local function contains (table, val) | ||
for i, v in ipairs(table) do | ||
if v == val then | ||
return true | ||
end | ||
end | ||
return false | ||
end | ||
|
||
local has_no_status = { | ||
"ProviderConfig", | ||
"ProviderConfigUsage" | ||
} | ||
|
||
if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.kind) then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is up-to-date." | ||
return health_status | ||
end | ||
|
||
if obj.status == nil or next(obj.status) == nil or obj.status.conditions == nil then | ||
if obj.kind == "ProviderConfig" and obj.status.users ~= nil then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is in use." | ||
return health_status | ||
end | ||
return health_status | ||
end | ||
|
||
if obj.status == nil or obj.status.conditions == nil then | ||
return health_status | ||
end | ||
|
@@ -158,6 +187,39 @@ configs: | |
message = "Provisioning ..." | ||
} | ||
|
||
local function contains (table, val) | ||
for i, v in ipairs(table) do | ||
if v == val then | ||
return true | ||
end | ||
end | ||
return false | ||
end | ||
|
||
local has_no_status = { | ||
"Composition", | ||
"CompositionRevision", | ||
"DeploymentRuntimeConfig", | ||
"ControllerConfig", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question |
||
"ProviderConfig", | ||
"ProviderConfigUsage" | ||
} | ||
|
||
if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.kind) then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is up-to-date." | ||
return health_status | ||
end | ||
|
||
if obj.status == nil or next(obj.status) == nil or obj.status.conditions == nil then | ||
if obj.kind == "ProviderConfig" and obj.status.users ~= nil then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is in use." | ||
return health_status | ||
end | ||
return health_status | ||
end | ||
|
||
if obj.status == nil or obj.status.conditions == nil then | ||
return health_status | ||
end | ||
|
@@ -198,6 +260,110 @@ configs: | |
message = "Provisioning ..." | ||
} | ||
|
||
local function contains (table, val) | ||
for i, v in ipairs(table) do | ||
if v == val then | ||
return true | ||
end | ||
end | ||
return false | ||
end | ||
|
||
local has_no_status = { | ||
"Composition", | ||
"CompositionRevision", | ||
"DeploymentRuntimeConfig", | ||
"ControllerConfig", | ||
Comment on lines
+195
to
+198
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question here? |
||
"ProviderConfig", | ||
"ProviderConfigUsage" | ||
} | ||
|
||
if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.kind) then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is up-to-date." | ||
return health_status | ||
end | ||
|
||
if obj.status == nil or next(obj.status) == nil or obj.status.conditions == nil then | ||
if obj.kind == "ProviderConfig" and obj.status.users ~= nil then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is in use." | ||
return health_status | ||
end | ||
return health_status | ||
end | ||
|
||
if obj.status == nil or obj.status.conditions == nil then | ||
return health_status | ||
end | ||
|
||
for i, condition in ipairs(obj.status.conditions) do | ||
if condition.type == "LastAsyncOperation" then | ||
if condition.status == "False" then | ||
health_status.status = "Degraded" | ||
health_status.message = condition.message | ||
return health_status | ||
end | ||
end | ||
|
||
if condition.type == "Synced" then | ||
if condition.status == "False" then | ||
health_status.status = "Degraded" | ||
health_status.message = condition.message | ||
return health_status | ||
end | ||
end | ||
|
||
if condition.type == "Ready" then | ||
if condition.status == "True" then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is up-to-date." | ||
return health_status | ||
end | ||
end | ||
end | ||
|
||
return health_status | ||
"helm.crossplane.io/*": | ||
health.lua: | | ||
health_status = { | ||
status = "Progressing", | ||
message = "Provisioning ..." | ||
} | ||
|
||
local function contains (table, val) | ||
for i, v in ipairs(table) do | ||
if v == val then | ||
return true | ||
end | ||
end | ||
return false | ||
end | ||
|
||
local has_no_status = { | ||
"Composition", | ||
"CompositionRevision", | ||
"DeploymentRuntimeConfig", | ||
"ControllerConfig", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
"ProviderConfig", | ||
"ProviderConfigUsage" | ||
} | ||
|
||
if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.kind) then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is up-to-date." | ||
return health_status | ||
end | ||
|
||
if obj.status == nil or next(obj.status) == nil or obj.status.conditions == nil then | ||
if obj.kind == "ProviderConfig" and obj.status.users ~= nil then | ||
health_status.status = "Healthy" | ||
health_status.message = "Resource is in use." | ||
return health_status | ||
end | ||
return health_status | ||
end | ||
|
||
if obj.status == nil or obj.status.conditions == nil then | ||
return health_status | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are compositions and compositionrevisions
*.apiextensions.crossplane.io
, not*.aws.crossplane.io
?