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

Drop dependency on k8s.io/kubernetes

Open cehoffman opened this issue 1 year ago • 4 comments

This fixes #56 and helps on the path to addressing https://github.com/argoproj/argo-cd/issues/14727

The go.mod and go.sum changes are from running go mod tidy.

I misunderstood the initial output and now see that gitops-engine is using the private conversion functions of k8s.io/kubernetes. I'm now looking how it is being used since flux does not depend on that.

It looks like the conversion is used in one place in order to avoid a round trip to the Kubernetes API server to perform the conversion. Given that immediately above this section the same API server round trip is done to get the resource and it is only avoided if the cluster cache has a copy of the resource already, it seems to me the conversion functionality imposes more burden on the wider ecosystem than is warranted to maintain.

The other usage is in diff for getting the default values for types. As is, defaulting isn't fully covered by these imports as types continue to evolve and gain new fields and types unknown to the system, e.g. CRDs. We use a few CRDs which make heavy use of field defaulting and they for sure are not known to the gitops-engine, i.e those types from GCP Config Connector. In practice we have not encountered anything impacting our usage of ArgoCD with these types.

cehoffman avatar Jul 26 '23 20:07 cehoffman

Thanks a lot for PR @cehoffman ! Removing conversion will affect PR but probably we can do something about it. E.g. cache converted version as well. Let me please test and see if significantly affects performance

alexmt avatar Aug 11 '23 20:08 alexmt

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Aug 29 '23 09:08 sonarqubecloud[bot]

@cehoffman @alexmt is this PR still active? We would benefit from it also - happy to help where I can.

majolo avatar Nov 21 '23 18:11 majolo

@cehoffman @alexmt is this PR still active? We would benefit from it also - happy to help where I can.

Same here!

mikejoh avatar Dec 06 '23 22:12 mikejoh