GalleyBytes / terraform-operator

A Kubernetes CRD to handle terraform operations
http://tf.galleybytes.com
Apache License 2.0
357 stars 47 forks source link

Feature: ArgoCD health assesment #146

Closed davhdavh closed 12 months ago

davhdavh commented 1 year ago

ArgoCD has the capability to monitor health based on lua scripts.

Here is the appropriate script to monitor the terraform operator:

      # Enable the health assessment of terraform
      resource.customizations.health.tf.galleybytes.com_Terraform: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.phase ~= nil then
            if obj.status.phase == "initializing" or obj.status.phase == "running" or obj.status.phase == "initializing-delete" or obj.status.phase == "deleting" then
              if obj.status.stage.state == "failed" then
                hs.status = "Degraded"
              else
                hs.status = "Progressing"
              end
            elseif obj.status.phase == "completed" then
              hs.status = "Healthy"
            else
              hs.status = "Degraded"
            end
          end
          if obj.status.stage ~= nil then
            if obj.status.stage.message ~= nil then
              hs.message = obj.status.stage.message
            end
          end
        end
        return hs

image image

PS. Still cannot find the doc repo to make PR to add to docs.