Skip to content
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

feat: enable crossplane health checks #1106

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jkleinlercher
Copy link
Contributor

No description provided.

Signed-off-by: Johannes Kleinlercher <johannes.kleinlercher@suxess-it.com>
Copy link
Contributor

github-actions bot commented Mar 3, 2025

Changes Rendered Chart
diff -U 4 -r out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-application-controller/statefulset.yaml out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-application-controller/statefulset.yaml
--- out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-application-controller/statefulset.yaml	2025-03-03 17:16:43.734639467 +0000
+++ out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-application-controller/statefulset.yaml	2025-03-03 17:16:07.267369443 +0000
@@ -24,9 +24,9 @@
   template:
     metadata:
       annotations:
         checksum/cmd-params: 021657bca0b768f07802318ce7d0b20b3d5045c2feedf146761230e3127d1a38
-        checksum/cm: 092e4b68676523e0791c5a3260457f72fb09b529679b11d8e23fa30c7ac50527
+        checksum/cm: d8729e9013919be081e3d3c170bb4bcf7375eb3f4283a8bc4ceb2f3e4d1f3fd3
       labels:
         helm.sh/chart: argo-cd-7.8.5
         app.kubernetes.io/name: argocd-application-controller
         app.kubernetes.io/instance: release-name
diff -U 4 -r out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml
--- out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml	2025-03-03 17:16:43.730639437 +0000
+++ out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml	2025-03-03 17:16:07.263369411 +0000
@@ -34,8 +34,123 @@
             end
           end
         end
         return hs
+  
+    "*.upbound.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 = {
+          "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
+        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
+    "*.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",
+          "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
+        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 contains({"Ready", "Healthy", "Offered", "Established"}, condition.type) 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
   server.rbac.log.enforce.enable: "false"
   statusbadge.enabled: "false"
   timeout.hard.reconciliation: 0s
   timeout.reconciliation: 20s
diff -U 4 -r out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-repo-server/deployment.yaml out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-repo-server/deployment.yaml
--- out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-repo-server/deployment.yaml	2025-03-03 17:16:43.734639467 +0000
+++ out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-repo-server/deployment.yaml	2025-03-03 17:16:07.267369443 +0000
@@ -23,9 +23,9 @@
   template:
     metadata:
       annotations:
         checksum/cmd-params: 021657bca0b768f07802318ce7d0b20b3d5045c2feedf146761230e3127d1a38
-        checksum/cm: 092e4b68676523e0791c5a3260457f72fb09b529679b11d8e23fa30c7ac50527
+        checksum/cm: d8729e9013919be081e3d3c170bb4bcf7375eb3f4283a8bc4ceb2f3e4d1f3fd3
       labels:
         helm.sh/chart: argo-cd-7.8.5
         app.kubernetes.io/name: argocd-repo-server
         app.kubernetes.io/instance: release-name
diff -U 4 -r out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-server/deployment.yaml out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-server/deployment.yaml
--- out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-server/deployment.yaml	2025-03-03 17:16:43.734639467 +0000
+++ out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-server/deployment.yaml	2025-03-03 17:16:07.267369443 +0000
@@ -23,9 +23,9 @@
   template:
     metadata:
       annotations:
         checksum/cmd-params: 021657bca0b768f07802318ce7d0b20b3d5045c2feedf146761230e3127d1a38
-        checksum/cm: 092e4b68676523e0791c5a3260457f72fb09b529679b11d8e23fa30c7ac50527
+        checksum/cm: d8729e9013919be081e3d3c170bb4bcf7375eb3f4283a8bc4ceb2f3e4d1f3fd3
       labels:
         helm.sh/chart: argo-cd-7.8.5
         app.kubernetes.io/name: argocd-server
         app.kubernetes.io/instance: release-name

Copy link
Contributor

github-actions bot commented Mar 3, 2025

Changes Default Values

Copy link
Contributor

github-actions bot commented Mar 3, 2025

Changes Default Values

Copy link
Contributor

github-actions bot commented Mar 3, 2025

Changes Rendered Chart
diff -U 4 -r out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-application-controller/statefulset.yaml out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-application-controller/statefulset.yaml
--- out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-application-controller/statefulset.yaml	2025-03-03 19:55:12.615651188 +0000
+++ out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-application-controller/statefulset.yaml	2025-03-03 19:54:44.366624949 +0000
@@ -24,9 +24,9 @@
   template:
     metadata:
       annotations:
         checksum/cmd-params: 021657bca0b768f07802318ce7d0b20b3d5045c2feedf146761230e3127d1a38
-        checksum/cm: 092e4b68676523e0791c5a3260457f72fb09b529679b11d8e23fa30c7ac50527
+        checksum/cm: d8729e9013919be081e3d3c170bb4bcf7375eb3f4283a8bc4ceb2f3e4d1f3fd3
       labels:
         helm.sh/chart: argo-cd-7.8.5
         app.kubernetes.io/name: argocd-application-controller
         app.kubernetes.io/instance: release-name
diff -U 4 -r out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml
--- out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml	2025-03-03 19:55:12.611651188 +0000
+++ out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml	2025-03-03 19:54:44.361624948 +0000
@@ -34,8 +34,123 @@
             end
           end
         end
         return hs
+  
+    "*.upbound.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 = {
+          "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
+        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
+    "*.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",
+          "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
+        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 contains({"Ready", "Healthy", "Offered", "Established"}, condition.type) 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
   server.rbac.log.enforce.enable: "false"
   statusbadge.enabled: "false"
   timeout.hard.reconciliation: 0s
   timeout.reconciliation: 20s
diff -U 4 -r out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-repo-server/deployment.yaml out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-repo-server/deployment.yaml
--- out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-repo-server/deployment.yaml	2025-03-03 19:55:12.615651188 +0000
+++ out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-repo-server/deployment.yaml	2025-03-03 19:54:44.365624949 +0000
@@ -23,9 +23,9 @@
   template:
     metadata:
       annotations:
         checksum/cmd-params: 021657bca0b768f07802318ce7d0b20b3d5045c2feedf146761230e3127d1a38
-        checksum/cm: 092e4b68676523e0791c5a3260457f72fb09b529679b11d8e23fa30c7ac50527
+        checksum/cm: d8729e9013919be081e3d3c170bb4bcf7375eb3f4283a8bc4ceb2f3e4d1f3fd3
       labels:
         helm.sh/chart: argo-cd-7.8.5
         app.kubernetes.io/name: argocd-repo-server
         app.kubernetes.io/instance: release-name
diff -U 4 -r out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-server/deployment.yaml out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-server/deployment.yaml
--- out/target/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-server/deployment.yaml	2025-03-03 19:55:12.615651188 +0000
+++ out/pr/argocd/values-k3d.yaml/argocd/charts/argo-cd/templates/argocd-server/deployment.yaml	2025-03-03 19:54:44.366624949 +0000
@@ -23,9 +23,9 @@
   template:
     metadata:
       annotations:
         checksum/cmd-params: 021657bca0b768f07802318ce7d0b20b3d5045c2feedf146761230e3127d1a38
-        checksum/cm: 092e4b68676523e0791c5a3260457f72fb09b529679b11d8e23fa30c7ac50527
+        checksum/cm: d8729e9013919be081e3d3c170bb4bcf7375eb3f4283a8bc4ceb2f3e4d1f3fd3
       labels:
         helm.sh/chart: argo-cd-7.8.5
         app.kubernetes.io/name: argocd-server
         app.kubernetes.io/instance: release-name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant