argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.19k stars 5.23k forks source link

Separate out client and type files from rest of project #14727

Open cehoffman opened 1 year ago

cehoffman commented 1 year ago

Summary

The client APIs needed for consumers of ArgoCD to interact with the types and the GRPC API should exist in a separate module from the other golang sources.

Motivation

To use the types and generated clients for ArgoCD, your golang module will depend on all of the sources required by the operator, gitops-engine, and other components of ArgoCD. This makes integrating the client with a toolchain that has other version dependencies sometimes impossible. Right now the latest ArgoCD go.mod has replacement directives to use Kubernetes APIs from 1.24.2. This makes it challenging and sometimes impossible to use newer client-go and related packages than that Kubernetes version due to transitive dependencies.

Proposal

Use go workspaces introduced in 1.18 to allow iterating on ArgoCD source in the single repository in a seamless manner while allowing the client and type source files to exist in their own go modules. Workspaces are in use on the kustomize project if you want to see a more in depth real world use.

crenshaw-dev commented 3 months ago

I spent a little time trying to make a types module. It's gonna require some restructuring to move business logic outside of the type definitions to avoid dependencies back to the main module.