Uploaded image for project: 'OpenShift GitOps'
  1. OpenShift GitOps
  2. GITOPS-5879

Use a default Argo CD image if '.spec.repo.sidecarContainers[*].image' is empty

XMLWordPrintable

    • GitOps Scarlet - Sprint 7/3266

      Story (Required)

      See parent epic for details.

      Background and Approach (Required)

      Argo CD users may add additional Argo CD config management plugins (CMPs) via a sidecar on the repo server component of Argo CD. This is described here: https://argo-cd.readthedocs.io/en/stable/operator-manual/config-management-plugins/

      Using this functionality requires adding a new 'sidecar' container that runs within the Argo CD repo server Pod, alongside the existing repo-server container.

      In some cases, users may provide their own fully custom CMP container image to use here, but as described in the epic, in many cases users are happy just using the existing openshift gitops argocd image.

      • Even though a user is using an existing image, they can still use kustomize/helm from within this issue, alongside additional bash scripting.

      In order to support this use case, we can detect when the user has provided a sideCarContainer container with an empty ("") image field, and substitute in the standard OpenShift GitOps Argo CD image.

      For example:

      kind: ArgoCD
      spec:
        repo:
          sidecarContainers:
            - name: my-plugin
              command: [/var/run/argocd/argocd-cmp-server] # Entrypoint should be Argo CD lightweight CMP server i.e. argocd-cmp-server
              image: "" # Image field is blank
              # (... see doc link above ..)
            volumes:
            - configMap:
                name: my-plugin-config
              name: my-plugin-config
              # (... see doc link above ..)
      

      In this case, we would substitute empty string with the standard OpenShift GitOps Argo CD image, for example, 'registry.redhat.io/openshift-gitops-1/argocd-rhel8@sha256: (...) ...)'

      NOTE: ArgoCD CR's '.spec.configManagementPlugins' field is deprecated and is not related to this functionality.

      Acceptance Criteria (Mandatory)

      • When '.spec.repo.sidecarContainers[*].image' is an empty string, we should substitute in the defaul Argo CD image. (This would likely be the image coming from the call to 'getRepoServerContainerImage')
        • In the case where we do detect that the image field is empty, we should output something like 'log.Info(".spec.repo.sidecarContainers entry does not have image field specified, substituting default Argo CD image")'
      • Openshift docs for this behaviour? AFAICT, .spec.repo.sidecarContainers is not currently documented.
      • Unit tests for functionality
      • E2E test (kuttl) that verifies this works as expected.
        • We already have a kuttl test for this (it uses busybox as the image), we could either modify the existing test, or create a new one

              jpitman63 John Pitman
              jgwest Jonathan West
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: