gitops-operator icon indicating copy to clipboard operation
gitops-operator copied to clipboard

Allow Volumes/VolumeMounts to pass through to the Deployment

Open aboukhal opened this issue 1 year ago • 4 comments

When trying to apply custom styling to ArgoCD, for example to color the banners as an easy distinction on which Cluster one is currently on, there is a documentation to be found here: https://argo-cd.readthedocs.io/en/stable/operator-manual/custom-styles/

The documentation contains two alternatives on how to achieve that goal:

  1. Manually change the argocd-server-Deployment to mount the additional CSS-File to the file system and use it from there.
  2. Configure an external URL for the CSS file, spin up a web server, service and route just for a single file.

Alternative 1 does not work with the operator because the Deployment gets overwritten by it immediately. Alternative 2 is not a sensible solution unless there is already some central storage for look-and-feels throughout a company. I'm not sure if this actually exists anywhere.

Describe the solution you'd like There should be an option to declare Volumes and VolumeMounts directly in the ArgoCD resource. They should be automatically propagated to the argocd-server Deployment. Since the Deployment only contains one container, it could even be simplified further to a single object in the CRD, that contains all options for Deployment.spec.template.spec.volumes plus the field mountPath. In a first step, ConfigMap and Secret support might even cover the vast majority of use cases.

Describe alternatives you've considered Alternatively, the Operator should not consider added Volumes or VolumeMounts a difference and should not overwrite them, even if something else in the ArgoCD resource has changed that necessitates a change to the Deployment. I believe this solution is worse than the one I suggested but it would still be much better than the Alternative 2 above.

aboukhal avatar Feb 13 '24 13:02 aboukhal

We're currently trying to implement exactly the same functionality but are unable to do so, due to the current limitations. Following the issue...

coder-david avatar Jun 28 '24 06:06 coder-david

Our current work-around is to use a repository in our internal Git server that's set to public and contains the CSS files we need. It is very hacky, though.

aboukhal avatar Jun 28 '24 11:06 aboukhal

What property did you use to setup the connection to this url? Could not find it.

We even tried banner content to already have some distinction, but not showing for us (the content itself is not there, the place is reserved onscreen)

Jenson3210 avatar Jun 28 '24 11:06 Jenson3210

Mounting extra volumes to repo-server is already supported by the operator. Maybe something similar can be implemented to mount volumes for argocd-server aswell.

Example to mount volumes to repo-server:

apiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
  name: argocd-sample
spec:
  repo:
    volumes:
    - name: repo-pv-storage
      persistentVolumeClaim:
        claimName: repo-pv-claim
    volumeMounts:
    - mountPath: /tmp
      name: repo-pv-storage

We also have ongoing efforts to support adding sidecar containers to argocd-server & application-controller deployments. Not sure if that could help in any way for this use case.

svghadi avatar Jul 23 '24 13:07 svghadi

What property did you use to setup the connection to this url? Could not find it.

We even tried banner content to already have some distinction, but not showing for us (the content itself is not there, the place is reserved onscreen) @Jenson3210

In your ArgoCD resource under spec.extraconfig add a key ui.cssurl and a value of the css file that should be loaded. It must be hosted in a way that your ArgoCD can access it without authentication.

Also there was a bug (that should be fixed in the current version) where the banner appeared empty if the ui.bannerposition wasn't set. The default of top was broken. By setting it explicitly to top it worked fine.

aboukhal avatar Aug 06 '24 12:08 aboukhal

Hi @aboukhal, the volume/volumeMount enhancement has been implemented in upstream operator (https://github.com/argoproj-labs/argocd-operator/pull/1477). Users can now add new vols and vol mounts to argocd-server and application-controller deployment via ArgoCD CR. It will be available in next release of gitops-operator i.e v1.14.0. I will share the documentation once the release it out.

svghadi avatar Aug 07 '24 03:08 svghadi

Amazing, thanks a lot @svghadi

aboukhal avatar Aug 08 '24 07:08 aboukhal

Great! Thanks a lot! We will wait for newest version to have both (volume+banner)

Jenson3210 avatar Aug 08 '24 07:08 Jenson3210

GitOps Operator 1.14.0 is released now. Two new fields .volumes & .volumeMounts are introduced in ArgoCD CR to add vols to argocd-server & application-controller deployments.

doc: https://argocd-operator.readthedocs.io/en/latest/reference/argocd/ Example:

apiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
  name: argocd-sample
spec:
  # argocd-server deployment
  server:
    volumes:
    - name: custom-storage
      persistentVolumeClaim:
        claimName: pv-claim
    volumeMounts:
    - mountPath: /tmp/custom
      name: custom-storage

  # application-controller deployment
  controller:
    volumes:
    - name: custom-tools
      emptyDir: {}
    volumeMounts:
    - mountPath: /usr/local/bin/helm
      name: custom-tools
      subPath: helm

I am closing this issue. Feel free to re-open if the feature is not working as expected.

You can read about other new features in 1.14 here: https://developers.redhat.com/blog/2024/09/20/whats-new-red-hat-openshift-gitops-114

svghadi avatar Sep 23 '24 04:09 svghadi