---
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cm
  namespace: argocd
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
data:
  resource.customizations.health.operators.coreos.com_Subscription: |
    hs = {}
    hs.status = "Progressing"
    hs.message = ""
    if obj.status ~= nil then
      hs.status = "Healthy"
      hs.message = obj.status.state
    end
    return hs
  resource.customizations.health.operators.coreos.com_ClusterServiceVersion: |
    hs = {}
    hs.status = "Progressing"
    hs.message = ""
    if obj.status ~= nil then
      if obj.status.phase == "Succeeded" then
        hs.status = "Healthy"
      end
      hs.message = obj.status.message
    end
    return hs
  resource.customizations.health.elasticsearch.k8s.elastic.co_Elasticsearch: |
    hs = {}
    hs.status = "Progressing"
    hs.message = ""
    if obj.status ~= nil and obj.status.health ~= nil and obj.status.phase ~= nil then
      if obj.status.health == "green" and obj.status.phase == "Ready" then
        hs.status = "Healthy"
      end
      hs.message = "health = " .. obj.status.health .. " phase = " .. obj.status.phase
    end
    return hs
  resource.customizations.health.kibana.k8s.elastic.co_Kibana: |
    hs = {}
    hs.status = "Progressing"
    hs.message = ""
    if obj.status ~= nil and obj.status.health ~= nil and obj.status.associationStatus ~= nil then
      if obj.status.health == "green" and obj.status.associationStatus == "Established" then
        hs.status = "Healthy"
      end
      hs.message = "health = " .. obj.status.health .. " associationStatus = " .. obj.status.associationStatus
    end
    return hs
  resource.customizations.health.kubernetes.crossplane.io_Object: |
    hs = {}
    hs.status = "Progressing"
    hs.message = ""
    if obj.status ~= nil and obj.status.atProvider ~= nil then
      kind = obj.spec.forProvider.manifest.kind
      res = obj.status.atProvider.manifest
      if res ~= nil then
        if kind == "Subscription" then
          if res.status ~= nil then
            hs.status = "Healthy"
            hs.message = res.status.state
          end
        elseif kind == "ClusterServiceVersion" then
          if res.status ~= nil then
            if res.status.phase == "Succeeded" then
              hs.status = "Healthy"
            end
            hs.message = res.status.message
          end
        elseif kind == "Elasticsearch" then
          if res.status ~= nil and res.status.health ~= nil and res.status.phase ~= nil then
            if res.status.health == "green" and res.status.phase == "Ready" then
              hs.status = "Healthy"
            end
            hs.message = "health = " .. res.status.health .. " phase = " .. res.status.phase
          end
        elseif kind == "Kibana" then
          if res.status ~= nil and res.status.health ~= nil and res.status.associationStatus ~= nil then
            if res.status.health == "green" and res.status.associationStatus == "Established" then
              hs.status = "Healthy"
            end
            hs.message = "health = " .. res.status.health .. " associationStatus = " .. res.status.associationStatus
          end
        end
      end
    end
    return hs
