redhat-cop / rhel-edge-automation-arch

RHEL for Edge Automation Deployment Architecture
Apache License 2.0
44 stars 33 forks source link

Adding CNV chart with CR and Operator #164

Closed jordigilh closed 2 years ago

jordigilh commented 2 years ago

Combines the CNV subscription and hyperconverged CR into a single chart. The chart contains a job whose responsibility is to delay the deployment of the hyperconverged CR until the CSV has reached the Successful state. This is to avoid the situation where the CR is created before the CRD.

@sabre1041 @nasx please review at your discretion.

sabre1041 commented 2 years ago

@jordigilh we might be able to omit the need for a job by using this configuration in the resourceCustomizations section of the ArgoCD resource

    operators.coreos.com/Subscription:
      health.lua: |
        hs = {}
        if obj.status ~= nil then
          if obj.status.currentCSV ~= nil and (obj.status.state == "AtLatestKnown" or obj.status.state == "UpgradeAvailable" or obj.status.state == "UpgradePending") then
            hs.status = "Healthy"
            hs.message = "Subcription installed"
            return hs
          end
        end
        hs.status = "Progressing"
        hs.message = "Waiting for Subscription to complete."
        return hs
jordigilh commented 2 years ago

@jordigilh we might be able to omit the need for a job by using this configuration in the resourceCustomizations section of the ArgoCD resource

    operators.coreos.com/Subscription:
      health.lua: |
        hs = {}
        if obj.status ~= nil then
          if obj.status.currentCSV ~= nil and (obj.status.state == "AtLatestKnown" or obj.status.state == "UpgradeAvailable" or obj.status.state == "UpgradePending") then
            hs.status = "Healthy"
            hs.message = "Subcription installed"
            return hs
          end
        end
        hs.status = "Progressing"
        hs.message = "Waiting for Subscription to complete."
        return hs

Works great! thanks!. I've removed the job and it's resources and updated the argocd.yaml file to include the resourceCustomizations.

I've tested it without the helm pre-hooks and works fine as well. So they're gone :smile:

sabre1041 commented 2 years ago

@jordigilh This is really exciting! It worked great. we most likely want to add retries, but that can come later. a few small minor changes