---
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cm
  namespace: argocd
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
  annotations:
    argocd.argoproj.io/sync-wave: "-1"
data:
  application.instanceLabelKey: "argocd.argoproj.io/instance"
  resource.customizations: |
    argoproj.io/Application:
      ignoreDifferences: |
        jsonPointers:
        - /metadata/labels
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.health ~= nil then
            hs.status = obj.status.health.status
            if obj.status.health.message ~= nil then
              hs.message = obj.status.health.message
            end
          end
        end
        return hs
    ceph.rook.io/CephCluster:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.state == "Created" and obj.status.phase == "Ready" then
            hs.status = "Healthy"
          end
          if obj.status.message ~= nil then
            hs.message = obj.status.message
          end
        end
        return hs
    ceph.rook.io/CephFilesystem:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.phase == "Ready" then
            hs.status = "Healthy"
            hs.message = obj.status.phase
          end
        end
        return hs
    orchestrator.aiops.ibm.com/Installation:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.phase == "Running" and obj.status.locations.cloudPakUiUrl ~= nil and obj.status.locations.csAdminHubUrl ~= nil then
            hs.status = "Healthy"
          end
        end
        return hs
    core.ir.aiops.ibm.com/IssueResolutionCore:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.conditions ~= nil then
            for i, condition in ipairs(obj.status.conditions) do
              if condition.type == "Ready" and condition.status == "False" then
                hs.status = "Degraded"
                hs.message = condition.message
                return hs
              end
              if condition.type == "Ready" and condition.status == "True" then
                hs.status = "Healthy"
                hs.message = condition.message
                return hs
              end
            end
          end
        end
        return hs
    ai.ir.aiops.ibm.com/AIOpsAnalyticsOrchestrator:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.conditions ~= nil then
            for i, condition in ipairs(obj.status.conditions) do
              if condition.type == "Ready" and condition.status == "False" then
                hs.status = "Degraded"
                hs.message = condition.message
                return hs
              end
              if condition.type == "Ready" and condition.status == "True" then
                hs.status = "Healthy"
                hs.message = condition.message
                return hs
              end
            end
          end
        end
        return hs
    lifecycle.ir.aiops.ibm.com/LifecycleService:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.conditions ~= nil then
            for i, condition in ipairs(obj.status.conditions) do
              if condition.type == "Lifecycle Service Ready" and condition.status == "False" then
                hs.status = "Degraded"
                hs.message = condition.message
                return hs
              end
              if condition.type == "Lifecycle Service Ready" and condition.status == "True" then
                hs.status = "Healthy"
                hs.message = condition.message
                return hs
              end
            end
          end
        end
        return hs
    consoleui.aiops.ibm.com/BaseUI:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.conditions ~= nil then
            for i, condition in ipairs(obj.status.conditions) do
              if condition.type == "Ready" and condition.status == "False" then
                hs.status = "Degraded"
                hs.message = condition.message
                return hs
              end
              if condition.type == "Ready" and condition.status == "True" then
                hs.status = "Healthy"
                hs.message = condition.message
                return hs
              end
            end
          end
        end
        return hs
    ai-manager.watson-aiops.ibm.com/AIManager:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.phase == "Completed" then
            hs.status = "Healthy"
            hs.message = obj.status.message
          end
        end
        return hs
    connectors.aiops.ibm.com/AIOpsEdge:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.phase == "Configured" then
            hs.status = "Healthy"
            hs.message = obj.status.phase
          end
        end
        return hs
    asm.ibm.com/ASM:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.phase == "OK" then
            hs.status = "Healthy"
            hs.message = obj.status.phase
          end
        end
        return hs
    maistra.io/ServiceMeshControlPlane:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.conditions ~= nil then
            for i, condition in ipairs(obj.status.conditions) do
              if condition.type == "Ready" and condition.status == "True" then
                hs.status = "Healthy"
                hs.message = condition.message
                return hs
              end
            end
          end
        end
        return hs
    maistra.io/ServiceMeshMemberRoll:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.conditions ~= nil then
            for i, condition in ipairs(obj.status.conditions) do
              if condition.type == "Ready" and condition.status == "True" then
                hs.status = "Healthy"
                hs.message = condition.message
                return hs
              end
            end
          end
        end
        return hs
    clusters.ibm.com/OpenShiftFyre:
      health.lua: |
        hs = {}
        hs.status = "Progressing"
        hs.message = ""
        if obj.status ~= nil then
          if obj.status.cluster ~= nil then
            if obj.status.cluster.status ~= nil then
              if obj.status.cluster.status == "deployed" then
                hs.status = "Healthy"
              end
              hs.message = obj.status.cluster.status
            end
          end
        end
        return hs
