Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use Argo CD clientset with K8s 1.28 #17935

Closed
3 tasks done
Bondza opened this issue Apr 23, 2024 · 9 comments
Closed
3 tasks done

Cannot use Argo CD clientset with K8s 1.28 #17935

Bondza opened this issue Apr 23, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@Bondza
Copy link

Bondza commented Apr 23, 2024

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

We use the Argo CD Go library and generated clientset to manage Applications in our cluster. When trying to update to K8s dependencies like k8s.io/kubectl to version v0.28.8 it fails to build because a function has changed signature:

# github.com/argoproj/gitops-engine/pkg/utils/kube
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:269:39: too many arguments in call to apply.NewApplyFlags
	have ("k8s.io/kubectl/pkg/cmd/util".Factory, genericiooptions.IOStreams)
	want (genericiooptions.IOStreams)
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:272:22: cannot use sets.NewString() (value of type "k8s.io/apimachinery/pkg/util/sets".String) as "k8s.io/apimachinery/pkg/util/sets".Set["k8s.io/apimachinery/pkg/types".UID] value in struct literal
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:273:22: cannot use sets.NewString() (value of type "k8s.io/apimachinery/pkg/util/sets".String) as "k8s.io/apimachinery/pkg/util/sets".Set[string] value in struct literal
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:290:4: o.DryRunVerifier undefined (type *apply.ApplyOptions has no field or method DryRunVerifier)
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:290:74: k.fact.OpenAPIGetter undefined (type "k8s.io/kubectl/pkg/cmd/util".Factory has no field or method OpenAPIGetter)
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:290:100: undefined: resource.QueryParamDryRun
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:291:4: o.FieldValidationVerifier undefined (type *apply.ApplyOptions has no field or method FieldValidationVerifier)
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:291:83: k.fact.OpenAPIGetter undefined (type "k8s.io/kubectl/pkg/cmd/util".Factory has no field or method OpenAPIGetter)
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:296:59: o.DryRunVerifier undefined (type *apply.ApplyOptions has no field or method DryRunVerifier)
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:360:74: k.fact.OpenAPIGetter undefined (type "k8s.io/kubectl/pkg/cmd/util".Factory has no field or method OpenAPIGetter)
/home/codespace/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/utils/kube/resource_ops.go:360:74: too many errors

The version skew policy for kubectl states:

kubectl is supported within one minor version (older or newer) of kube-apiserver

And Argo CD is on v0.26.4 for k8s.io/kubectl, so 1.28 for example is not officially supported with the current version.

To Reproduce

Try to build an application with these dependencies in go.mod:

	github.com/argoproj/argo-cd/v2 v2.10.1
	k8s.io/kubectl v0.28.8

Expected behavior

It builds successfully.

Screenshots

N/A

Version

argocd: v2.10.1+a79e0ea
  BuildDate: 2024-02-14T17:56:39Z
  GitCommit: a79e0eaca415461dc36615470cecc25d6d38cefb
  GitTreeState: clean
  GoVersion: go1.21.7
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.10.1+a79e0ea

Logs

N/A

@Bondza Bondza added the bug Something isn't working label Apr 23, 2024
@Bondza Bondza changed the title Cannot use argocd clientset with K8s 1.28 Cannot use Argo CD clientset with K8s 1.28 Apr 23, 2024
@jannfis
Copy link
Member

jannfis commented Apr 23, 2024

Unfortunately, you need to pin the Kubernetes version in your consumer to the same version that Argo CD uses. This is done using replace rules in your go.mod.

PTAL here:

argo-cd/go.mod

Lines 310 to 338 in b060053

k8s.io/api => k8s.io/api v0.26.11
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.26.11
k8s.io/apimachinery => k8s.io/apimachinery v0.26.11
k8s.io/apiserver => k8s.io/apiserver v0.26.11
k8s.io/cli-runtime => k8s.io/cli-runtime v0.26.11
k8s.io/client-go => k8s.io/client-go v0.26.11
k8s.io/cloud-provider => k8s.io/cloud-provider v0.26.11
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.26.11
k8s.io/code-generator => k8s.io/code-generator v0.26.11
k8s.io/component-base => k8s.io/component-base v0.26.11
k8s.io/component-helpers => k8s.io/component-helpers v0.26.11
k8s.io/controller-manager => k8s.io/controller-manager v0.26.11
k8s.io/cri-api => k8s.io/cri-api v0.26.11
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.26.11
k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.26.11
k8s.io/kms => k8s.io/kms v0.26.11
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.26.11
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.26.11
k8s.io/kube-proxy => k8s.io/kube-proxy v0.26.11
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.26.11
k8s.io/kubectl => k8s.io/kubectl v0.26.11
k8s.io/kubelet => k8s.io/kubelet v0.26.11
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.26.11
k8s.io/metrics => k8s.io/metrics v0.26.11
k8s.io/mount-utils => k8s.io/mount-utils v0.26.11
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.26.11
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.26.11
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.26.11
k8s.io/sample-controller => k8s.io/sample-controller v0.26.11

@Bondza
Copy link
Author

Bondza commented Apr 24, 2024

We do pin the Kubernetes version at the moment and this works since we use v0.26.10 today. But we are moving to Kubernetes 1.28 and this is why we would like to update the version.

The issue is that we have other dependencies to update but they require newer versions of Kubernetes. Pinning the version means that we are not able to update other dependencies that require a newer version of the Kubernetes dependencies.

Is there a plan to update the Kubernetes version that Argo CD uses?

@joselitofilho
Copy link

joselitofilho commented Apr 24, 2024

I am moving to Kubernetes 1.28/1.29. So I would also like to update the Argo CD version.

I have the same issue and question as @Bondza:

Is there a plan to update the Kubernetes version that Argo CD uses?

@blakepettersson
Copy link
Member

There's an going effort in #17491, but seems to have stalled for now.

@sivchari
Copy link
Contributor

sivchari commented May 1, 2024

@Bondza @joselitofilho @blakepettersson
Hi all.
I'm sorry that I was late.
I'd work on left task. Only what I do is to pass the CI 👍

@blakepettersson
Copy link
Member

@sivchari no worries, there is no deadline. You have been doing a great job so far, keep it up! 😄

@joselitofilho
Copy link

@sivchari no worries. Thank you for your initiative and great work! 👏

@sivchari
Copy link
Contributor

sivchari commented May 2, 2024

I've completed all required tasks. So It's ready to be merged. Thanks.

@blakepettersson
Copy link
Member

Fixed with #17491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants