Integrating SmartInstall with Red Hat OpenShift GitOps

Configure an existing Argo CD instance managed by the Red Hat OpenShift GitOps Operator for use with SmartInstall on OpenShift. These instructions are intended for the team responsible for the OpenShift and Argo CD configuration.

The Requirements for customer-provided Argo CD also apply, including the supported Argo CD version.

SmartInstall integration with the Red Hat OpenShift GitOps Operator is still experimental and should not be used in production environments.

Prerequisites

Before installing SmartInstall, ensure that the following requirements are met.

CRD permissions

The Argo CD application-controller service account must have cluster-level permissions to install and update the CustomResourceDefinitions (CRDs) required by SmartInstall and PAS-X MES. For the required OpenShift resource permissions and routing capabilities, see OpenShift compatibility.

Network access

Network policies must allow SmartInstall workloads in <pasx-namespace> to reach the Argo CD API server. If outbound traffic is restricted, allow the corresponding egress.

Kubernetes API discovery

Argo CD must be able to discover the APIs available on the target cluster. SmartInstall Helm charts use .Capabilities.APIVersions to detect OpenShift through the presence of security.openshift.io/v1 and select the appropriate resources.

Technical account

An Argo CD technical account with the apiKey capability must be available to SmartInstall. Configure the account and its permissions as described below. Before bootstrapping PAS-X MES, generate its API token and store it as described in Deployment Account Token Secret.

TLS certificate trust

Certificates presented by the OpenShift Routes must be valid for their hostnames and trusted by the systems and workloads connecting to them, including SmartInstall. If a private certificate authority is used, include its root and intermediate certificates in the relevant trust stores. For Route certificate requirements, see OpenShift edge Route certificates.

If the OpenShift Route or an intermediate proxy does not support HTTP/2, the workflows may need --grpc-web to connect to Argo CD. Add this flag to the Argo CD CLI options in the mes-workflows Helm values. See PAS-X MES Workflows configuration for the available settings.

Argo CD instance configuration

Apply the configuration through the existing ArgoCD resource. The Red Hat OpenShift GitOps Operator can overwrite direct changes to the ConfigMaps it manages.

Merge the following fragments into spec, preserving existing settings, list entries, and RBAC policy rules.

apiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
  name: <argocd-instance-name>
  namespace: <argocd-namespace>
spec:
  # Add the configuration fragments here.

Replace <pasx-namespace> with the OpenShift namespace (project) used for PAS-X MES. Use the API version and fields supported by the installed Red Hat OpenShift GitOps Operator.

Resource health checks

SmartInstall uses the Instance and GenericService custom resources to manage the PAS-X MES lifecycle. Argo CD needs custom health checks to interpret their status.phase values and report the current deployment state. The Application check propagates a child application’s reported health to its parent.

  resourceHealthChecks:
    - group: argoproj.io
      kind: Application
      check: |
        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
    - group: pasx.io
      kind: Instance
      check: |
        local hs = {}
        if obj.status ~= nil and obj.status.phase == "RUNNING" then
          hs.status = "Healthy"
          hs.message = "Instance reached '" .. obj.status.phase .. "' phase"
        elseif obj.status ~= nil and (obj.status.phase == "DEPLOYING" or obj.status.phase == "MIGRATING" or obj.status.phase == "MIGRATED" or obj.status.phase == "UNDEPLOYING") then
          hs.status = "Progressing"
          hs.message = "The instance is still reconciling, current phase: '" .. obj.status.phase .. "'"
        elseif obj.status ~= nil and obj.status.phase == "UNDEPLOYED" then
          hs.status = "Suspended"
          hs.message = "The instance is suspended, current phase: '" .. obj.status.phase .. "'"
        elseif obj.status ~= nil and obj.status.phase == "ERROR" then
          hs.status = "Degraded"
          hs.message = "The instance is in an error phase, current phase: '" .. obj.status.phase .. "'"
        else
          hs.status = "Unknown"
          hs.message = "Something went wrong..."
        end
        return hs
    - group: pasx.io
      kind: GenericService
      check: |
        local hs = {}
        if obj.status ~= nil and obj.status.phase == "RUNNING" then
          hs.status = "Healthy"
          hs.message = "GenericService reached '" .. obj.status.phase .. "' state"
        elseif obj.status ~= nil and (obj.status.phase == "DEPLOYING" or obj.status.phase == "MIGRATING" or obj.status.phase == "MIGRATED" or obj.status.phase == "UNDEPLOYING") then
          hs.status = "Progressing"
          hs.message = "The GenericService is still reconciling, current state: '" .. obj.status.phase .. "'"
        elseif obj.status ~= nil and obj.status.phase == "UNDEPLOYED" then
          hs.status = "Healthy"
          hs.message = "The GenericService is 'UNDEPLOYED'"
        elseif obj.status ~= nil and obj.status.phase == "ERROR" then
          hs.status = "Degraded"
          hs.message = "The GenericService is in an error state, current state: '" .. obj.status.phase .. "'"
        else
          hs.status = "Unknown"
          hs.message = "Something went wrong..."
        end
        return hs

An undeployed Instance is reported as Suspended. An undeployed GenericService is reported as Healthy, because this is a valid completed state for that resource.

CRD comparison settings

Printer-column priorities can be omitted from the CRDs stored by the Kubernetes API server. Exclude this difference from comparison so that Argo CD does not report equivalent CRD definitions as OutOfSync.

  resourceIgnoreDifferences:
    resourceIdentifiers:
      - group: apiextensions.k8s.io
        kind: CustomResourceDefinition
        customization:
          jqPathExpressions:
            - .spec.versions[].additionalPrinterColumns[].priority | select(. == 0)

ApplicationSet Progressive Syncs and source namespaces

SmartInstall uses the ApplicationSet RollingSync strategy to synchronize applications in a defined order. Enable Progressive Syncs in the ApplicationSet controller with --enable-progressive-syncs.

If PAS-X MES runs in a different namespace from Argo CD, add that namespace to both source namespace lists. The top-level setting allows Argo CD to watch Application resources. The ApplicationSet setting allows its controller to watch ApplicationSet resources.

  sourceNamespaces:
    - <pasx-namespace>

  applicationSet:
    extraCommandArgs:
      - --enable-progressive-syncs
    sourceNamespaces:
      - <pasx-namespace>

Local deployment account

If a technical account is not already available, add a local pasx-deployment account. This example enables API tokens and disables interactive login.

  localUsers:
    - name: pasx-deployment
      login: false
      apiKey: true
      tokenLifetime: "0"

The example sets tokenLifetime to "0" for tokens without expiration. Adjust the lifetime to the customer’s token-management policy.

Deployment account permissions

If the deployment account does not already have the required permissions, add the following rules to the instance’s RBAC policy. They allow the account to read and synchronize applications and read Argo CD projects.

  rbac:
    policy: |
      p, role:deployonly, applications, get, *, allow
      p, role:deployonly, applications, sync, *, allow
      p, role:deployonly, projects, get, *, allow
      g, pasx-deployment, role:deployonly

The * scope applies these permissions to all applications and projects. For a shared instance, scope the rules to the applications and projects used by SmartInstall. If a different technical account is used, replace pasx-deployment in the role mapping.

Verify the configuration

Before bootstrapping PAS-X MES, check that:

  • The ArgoCD resource is reconciled without configuration errors.

  • The ApplicationSet controller has Progressive Syncs enabled and both controllers watch the PAS-X MES namespace.

  • SmartInstall workloads can reach the Argo CD API server and trust its certificate.

  • The deployment account can read and synchronize the relevant applications and read their projects.

After bootstrapping, check that Argo CD discovers the PAS-X MES Application and ApplicationSet resources. During installation, verify that the Instance and GenericService health states match their status.phase values.