If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a
question in argocd slack channel.
Checklist:
argocd version. (I'm including the types from 1.6.2)Describe the bug
The ArgoCD go.mod file requires k8s.io/kubernetes instead of individually published kubernetes packages.
https://github.com/argoproj/argo-cd/blob/master/go.mod#L80
https://github.com/kubernetes/kubernetes/issues/79384#issuecomment-505725449
According to the issue linked above, this is not supported behavior, and leads to issues with including argocd types for use with go-client.
To Reproduce
Add argocd to an external project's go.mod.
module my-module
require (
github.com/argoproj/argo-cd v1.6.2
...
Import the argocd types and client into your package.
package my-package
import (
argocd "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
argocdclient "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
)
Attempt to go build.
$ go build
go: finding module for package github.com/argoproj/argo-cd/pkg/client/clientset/versioned
go: found github.com/argoproj/argo-cd/pkg/client/clientset/versioned in github.com/argoproj/argo-cd v1.6.2
go: github.com/argoproj/[email protected] requires
k8s.io/[email protected] requires
k8s.io/[email protected]: reading k8s.io/api/go.mod at revision v0.0.0: unknown revision v0.0.0
Notice you can't go build, because k8s.io/[email protected] is an unknown revision.
Expected behavior
Including argocd types is supported and compiles successfully with go build
Usage of this solution is fairly widespread, we could do the same
https://github.com/kubernetes/kubernetes/issues/79384#issuecomment-505632294
We've been using the above linked workaround but ideally we would not need replace directives in every project where we import Argo code. Argo projects should only require and import k8s.io modules as needed.
@jwelch92 , yeah, that would be ideal. I agree.
Argo CD imports k8s.io/kubernetes package to perform client-side diffing and execute kubectl apply/auth reconcile programmatically instead of using fork exec.
kubectl apply/auth reconcile reduces the amount of used memory. https://github.com/kubernetes/enhancements/issues/1020 is supposed to solve this issue.Hi, I am trying to import "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" on client side to populate v1alpha1.AppProjectSpec{} and then json marshal it and send the data using rest api. I am hitting this exact same issue.
How do I get it working with this bug being open.
I saw the workaround recommended above but was wondering if we are looking at a better solution any time soon. Thanks.
Hi, I am trying to import
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"on client side to populate v1alpha1.AppProjectSpec{} and then json marshal it and send the data using rest api. I am hitting this exact same issue.
How do I get it working with this bug being open.
@sidheshdivekar29 What did you end up doing? I'm also having the same issue.
Hi Adarsh,
I ended up not importing the library.
Since rest apis just post json body, I just defined my own structures for
required rest api.
On Mon, Nov 9, 2020 at 12:06 PM Adarsh Shah notifications@github.com
wrote:
Hi, I am trying to import "
github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" on client side
to populate v1alpha1.AppProjectSpec{} and then json marshal it and send the
data using rest api. I am hitting this exact same issue.
How do I get it working with this bug being open.@sidheshdivekar29 https://github.com/sidheshdivekar29 What did you end
up doing? I'm also having the same issue.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/argoproj/argo-cd/issues/4055#issuecomment-724248413,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADYCOPO3FQQCMXPAESJC2Q3SPBDTVANCNFSM4PV7WFYQ
.
--
-Siddhesh.
Hi Adarsh, I ended up not importing the library. Since rest apis just post json body, I just defined my own structures for required rest api.
…
On Mon, Nov 9, 2020 at 12:06 PM Adarsh Shah @.*> wrote: Hi, I am trying to import " github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" on client side to populate v1alpha1.AppProjectSpec{} and then json marshal it and send the data using rest api. I am hitting this exact same issue. How do I get it working with this bug being open. @sidheshdivekar29 https://github.com/sidheshdivekar29 What did you end up doing? I'm also having the same issue. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#4055 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYCOPO3FQQCMXPAESJC2Q3SPBDTVANCNFSM4PV7WFYQ .
-- -Siddhesh.
@sidheshdivekar29 Thanks. I was actually able to make it work with v1.5.5.
Added following:
replace (
github.com/argoproj/argo-cd => github.com/argoproj/argo-cd v1.5.5
)
Great Adarsh, Thanks for letting me know.
On Fri, Nov 13, 2020 at 8:41 AM Adarsh Shah notifications@github.com
wrote:
Hi Adarsh, I ended up not importing the library. Since rest apis just post
json body, I just defined my own structures for required rest api.
… <#m_3495484218996143026_>
On Mon, Nov 9, 2020 at 12:06 PM Adarsh Shah @.*> wrote: Hi, I am
trying to import "
github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" on client side
to populate v1alpha1.AppProjectSpec{} and then json marshal it and send the
data using rest api. I am hitting this exact same issue. How do I get it
working with this bug being open. @sidheshdivekar29
https://github.com/sidheshdivekar29 https://github.com/sidheshdivekar29
What did you end up doing? I'm also having the same issue. — You are
receiving this because you were mentioned. Reply to this email directly,
view it on GitHub <#4055 (comment)
https://github.com/argoproj/argo-cd/issues/4055#issuecomment-724248413>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADYCOPO3FQQCMXPAESJC2Q3SPBDTVANCNFSM4PV7WFYQ
.
-- -Siddhesh.@sidheshdivekar29 https://github.com/sidheshdivekar29 Thanks. I was
actually able to make it work with v1.5.5.Added following:
replace (
github.com/argoproj/argo-cd => github.com/argoproj/argo-cd v1.5.5
)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/argoproj/argo-cd/issues/4055#issuecomment-726867355,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADYCOPJ7CURE5XL6WPMIXC3SPVOSDANCNFSM4PV7WFYQ
.
--
-Siddhesh.
Most helpful comment
Argo CD imports k8s.io/kubernetes package to perform client-side diffing and execute
kubectl apply/auth reconcileprogrammatically instead of using fork exec.kubectl apply/auth reconcilereduces the amount of used memory. https://github.com/kubernetes/enhancements/issues/1020 is supposed to solve this issue.