crossplane-contrib/provider-argocd

[Feature Request] Have Argo CD to support Crossplane natively

morningspace opened this issue · 3 comments

What problem are you facing?

When using Argo CD with Helm in GitOps, I can customize the parameters exposed by Helm values.yaml either from Argo CD UI or command line. Essentially, it exposes helm specific options via Application.argoproj.io so that can override default configuration in values.yaml.

image

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
  namespace: argocd
spec:
  destination:
    namespace: dev
    server: 'https://kubernetes.default.svc'
  source:
    path: path/to/your/config
    repoURL: 'https://github.com/<account>/<repo>'
    targetRevision: HEAD
    helm:
      parameters:
        - name: path.to.foo
          value: bar
  project: default

Crossplane on the other hand supports defining Composition, CompositeResourceDefinition (XRD), CompositeResource (XR) and CompositeResourceClaim (XRC) which is very similar to what Helm does. These resources can be checked in git to support GitOps. Below is a table that summarizes the side-by-side comparison between Crossplane and Helm. More details can be found here.

Crossplane Helm Description
Composition Templates Both to compose a set of Kubernetes resources, but Composition uses patch to override while Helm uses template.
CompositeResource(Claim) values.yaml Both to allow user input as configurable settings. Argo CD has better support on Helm, e.g: to specify values in Argo Application resource.
CompositeResourceDefinition n/a CompositeResourceDefinition as a schema has better user input control.

With XRD, XR/XRC, Crossplane is more reliable than Helm for user input as custom options. e.g.: to define a type for each option, mark it as required or optional, give it a description text, etc.

However, there is no such support as Helm does in Argo CD for UI and Application.argoproj.io integration.

How could Crossplane help solve your problem?

I know it may not be a good place to raise it here. We should ask a feature request in Argo CD community since this is more on Argo CD side to address such an issue. Also, it may not be easy to implement given the Crossplane design nature from tech perspective. But before that, just to make sure if that generally makes sense from Crossplane community side.

Ideally, I would like to see Crossplane could be taken as first-class citizen in Argo CD just as Helm, Kustomize, and other tools. We can attach custom options in Application.argoproj.io resource to override the default settings defined by XR/XRC as below. And this can also be supported via Argo CD web UI, as Helm does.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
  namespace: argocd
spec:
  destination:
    namespace: dev
    server: 'https://kubernetes.default.svc'
  source:
    path: path/to/your/config
    repoURL: 'https://github.com/<account>/<repo>'
    targetRevision: HEAD
    crossplane:
      SomeXRC:
        - name: path.to.foo
          value: bar
  project: default

Does it make sense?

Hey @morningspace, thanks for describing your thoughts here!

I believe what you are trying to achieve should be possible with helm and kustomize. ArgoCD has native support for both.

Please note that while it's possible to kubectl apply compositions and XRDs the intended mechanism for crossplane to deploy these is a configuration package. More background information can be found in this blog post by @hasheddan.

The documentation for v1.6 has since been taken offline. An up to date link to the configuration package documentation could be:

Closing this since it is not really related to provider-argocd. The sole purpose of this project is to represent the ArgoCD API as Crossplane managed resources.

If you want to use Crossplane's Composition feature, it is recommended to install Crossplane on your cluster.
If you want to use ArgoCD to install XRDs and Compositions on a cluster with Crossplane, it is recommended to use Crossplane's package mechanism as mentioned in the comment above.
If you want to make use of Compositions you can simply create a new claim that matches the schema of one of your XRDs and deploy this claim with ArgoCD like any other K8s resource.