-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
- Loading branch information
Showing
2 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
130 changes: 130 additions & 0 deletions
130
patches-argo-cd-v2.8/20-add-health-message-for-helm.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
add health message for helm | ||
|
||
From: Chanwit Kaewkasi <chanwit@gmail.com> | ||
|
||
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com> | ||
--- | ||
.../HelmRelease/actions/discovery.lua | 3 ++ | ||
.../HelmRelease/actions/reconcile/action.lua | 9 +++++++ | ||
.../helm.toolkit.fluxcd.io/HelmRelease/health.lua | 25 ++++++++++++++++++++ | ||
.../HelmRepository/actions/discovery.lua | 3 ++ | ||
.../HelmRepository/actions/reconcile/action.lua | 9 +++++++ | ||
.../HelmRepository/health.lua | 25 ++++++++++++++++++++ | ||
6 files changed, 74 insertions(+) | ||
create mode 100644 resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/actions/discovery.lua | ||
create mode 100644 resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/actions/reconcile/action.lua | ||
create mode 100644 resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/health.lua | ||
create mode 100644 resource_customizations/source.toolkit.fluxcd.io/HelmRepository/actions/discovery.lua | ||
create mode 100644 resource_customizations/source.toolkit.fluxcd.io/HelmRepository/actions/reconcile/action.lua | ||
create mode 100644 resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua | ||
|
||
diff --git a/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/actions/discovery.lua b/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/actions/discovery.lua | ||
new file mode 100644 | ||
index 000000000..c7f895ffb | ||
--- /dev/null | ||
+++ b/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/actions/discovery.lua | ||
@@ -0,0 +1,3 @@ | ||
+actions = {} | ||
+actions["reconcile"] = {} | ||
+return actions | ||
diff --git a/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/actions/reconcile/action.lua b/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/actions/reconcile/action.lua | ||
new file mode 100644 | ||
index 000000000..f83651d3c | ||
--- /dev/null | ||
+++ b/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/actions/reconcile/action.lua | ||
@@ -0,0 +1,9 @@ | ||
+local os = require("os") | ||
+if obj.metadata == nil then | ||
+ obj.metadata = {} | ||
+end | ||
+if obj.metadata.annotations == nil then | ||
+ obj.metadata.annotations = {} | ||
+end | ||
+obj.metadata.annotations["reconcile.fluxcd.io/requestedAt"] = os.date("!%Y-%m-%dT%XZ") | ||
+return obj | ||
diff --git a/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/health.lua b/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/health.lua | ||
new file mode 100644 | ||
index 000000000..3c0bb1d04 | ||
--- /dev/null | ||
+++ b/resource_customizations/helm.toolkit.fluxcd.io/HelmRelease/health.lua | ||
@@ -0,0 +1,25 @@ | ||
+hs = {} | ||
+if obj.status ~= nil then | ||
+ if obj.status.conditions ~= nil then | ||
+ ready_status = "" | ||
+ for _, condition in ipairs(obj.status.conditions) do | ||
+ if condition.type == "Ready" then | ||
+ ready_status = condition.status | ||
+ ready_message = condition.message | ||
+ end | ||
+ end | ||
+ if ready_status == "True" then | ||
+ hs.status = "Healthy" | ||
+ elseif ready_status == "False" then | ||
+ hs.status = "Degraded" | ||
+ elseif ready_status == "Unknown" then | ||
+ hs.status = "Progressing" | ||
+ end | ||
+ hs.message = ready_message | ||
+ return hs | ||
+ end | ||
+end | ||
+ | ||
+hs.status = "Progressing" | ||
+hs.message = "Waiting for HelmRelease to reconcile ..." | ||
+return hs | ||
diff --git a/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/actions/discovery.lua b/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/actions/discovery.lua | ||
new file mode 100644 | ||
index 000000000..c7f895ffb | ||
--- /dev/null | ||
+++ b/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/actions/discovery.lua | ||
@@ -0,0 +1,3 @@ | ||
+actions = {} | ||
+actions["reconcile"] = {} | ||
+return actions | ||
diff --git a/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/actions/reconcile/action.lua b/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/actions/reconcile/action.lua | ||
new file mode 100644 | ||
index 000000000..f83651d3c | ||
--- /dev/null | ||
+++ b/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/actions/reconcile/action.lua | ||
@@ -0,0 +1,9 @@ | ||
+local os = require("os") | ||
+if obj.metadata == nil then | ||
+ obj.metadata = {} | ||
+end | ||
+if obj.metadata.annotations == nil then | ||
+ obj.metadata.annotations = {} | ||
+end | ||
+obj.metadata.annotations["reconcile.fluxcd.io/requestedAt"] = os.date("!%Y-%m-%dT%XZ") | ||
+return obj | ||
diff --git a/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua b/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua | ||
new file mode 100644 | ||
index 000000000..f5bd9b0bc | ||
--- /dev/null | ||
+++ b/resource_customizations/source.toolkit.fluxcd.io/HelmRepository/health.lua | ||
@@ -0,0 +1,25 @@ | ||
+hs = {} | ||
+if obj.status ~= nil then | ||
+ if obj.status.conditions ~= nil then | ||
+ ready_status = "" | ||
+ for _, condition in ipairs(obj.status.conditions) do | ||
+ if condition.type == "Ready" then | ||
+ ready_status = condition.status | ||
+ ready_message = condition.message | ||
+ end | ||
+ end | ||
+ if ready_status == "True" then | ||
+ hs.status = "Healthy" | ||
+ elseif ready_status == "False" then | ||
+ hs.status = "Degraded" | ||
+ elseif ready_status == "Unknown" then | ||
+ hs.status = "Progressing" | ||
+ end | ||
+ hs.message = ready_message | ||
+ return hs | ||
+ end | ||
+end | ||
+ | ||
+hs.status = "Progressing" | ||
+hs.message = "Waiting for HelmRepository to reconcile ..." | ||
+return hs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters