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

Backwards incompatible client-go/testing across major versions makes it hard to use generated fakes for vendored CRD clients #76305

Closed
fejta opened this issue Apr 9, 2019 · 7 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@fejta
Copy link
Contributor

fejta commented Apr 9, 2019

test-infra uses:

  • core kubernetes client code to manage things like pods
  • a generated prow client to manage prowjob CRD resources
  • a generated knative/build client to manage build CRD resources

We use the generated fake_build client for some of our unit testing. However, the signature for many of the methods in action.go in k8s.io/client-go/testing changed to include a PatchType method (added in #69330).

This makes it unnecessarily hard for me to update the client-go version test-infra, as I either have to:

  • Wait for CRD clients to upgrade client-go and regenerate their fakes
  • Regenerate clients in vendored code
  • Refactor my unit testing to avoid using generated fakes.

One solution here might be to start tagging our modules with major releases, which should allow the vendored knative/build to continue using the older version of client-go while the code under my control starts using the new version.

/usr/local/google/home/fejta/.cache/bazel/_bazel_fejta/b0ebb806f871834291964fdb37490052/sandbox/linux-sandbox/31/execroot/io_k8s_test_infra/vendor/github.com/knative/build/pkg/client/clientset/versioned/typed/build/v1alpha1/fake/fake_build.go:131:44: not enough arguments in call to testing.NewPatchSubresourceAction
	have (schema.GroupVersionResource, string, string, []byte, []string...)
	want (schema.GroupVersionResource, string, string, types.PatchType, []byte, ...string)
/usr/local/google/home/fejta/.cache/bazel/_bazel_fejta/b0ebb806f871834291964fdb37490052/sandbox/linux-sandbox/31/execroot/io_k8s_test_infra/vendor/github.com/knative/build/pkg/client/clientset/versioned/typed/build/v1alpha1/fake/fake_buildtemplate.go:119:44: not enough arguments in call to testing.NewPatchSubresourceAction
	have (schema.GroupVersionResource, string, string, []byte, []string...)
	want (schema.GroupVersionResource, string, string, types.PatchType, []byte, ...string)
/usr/local/google/home/fejta/.cache/bazel/_bazel_fejta/b0ebb806f871834291964fdb37490052/sandbox/linux-sandbox/31/execroot/io_k8s_test_infra/vendor/github.com/knative/build/pkg/client/clientset/versioned/typed/build/v1alpha1/fake/fake_clusterbuildtemplate.go:112:48: not enough arguments in call to testing.NewRootPatchSubresourceAction
	have (schema.GroupVersionResource, string, []byte, []string...)
	want (schema.GroupVersionResource, string, types.PatchType, []byte, ...string)

FYI @sttts @lavalamp @caesarxuchao @liggitt
@kubernetes/sig-api-machinery-bugs

ref kubernetes/test-infra#12107

@fejta fejta added the kind/bug Categorizes issue or PR as related to a bug. label Apr 9, 2019
@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Apr 9, 2019
@liggitt
Copy link
Member

liggitt commented Apr 9, 2019

One solution here might be to start tagging our modules with major releases, which should allow the vendored knative/build to continue using the older version of client-go while the code under my control starts using the new version.

We would have to go all the way to semantic import versioning for multiple versions to coexist in a build as you describe. Some of the implications of that are described at https://github.com/kubernetes/enhancements/blob/master/keps/sig-architecture/2019-03-19-go-modules.md#alternative-versioning-strategies

I am in favor of major version tagging the other k8s.io components to match client-go

/remove-kind bug
/kind feature

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Apr 9, 2019
@liggitt liggitt changed the title Backwards incompatible client-go/testing make it hard to use generated fakes for vendored CRD clients Backwards incompatible client-go/testing across major versions makes it hard to use generated fakes for vendored CRD clients Apr 9, 2019
@stevekuznetsov
Copy link
Contributor

Would it be hard to go to those projects and send them PRs to regenerate with the newest code? In an off-line conversation, it did not seem like there were any immediate pressing reasons to update our dependencies, so barring that I feel like an approach that:

Refactor my unit testing to avoid using generated fakes.

is not desirable as it's going to make testing hard, especially if we are using the full power of the fakes to drive listers/informers/watchers.

@fejta
Copy link
Contributor Author

fejta commented May 15, 2019

especially if we are using the full power of the fakes to drive listers/informers/watchers.

Not convinced the trade-off is worth it here until kubernetes can prove it is a better citizen about following semver correctly.

If dependencies are cause maintenance/upgrade pain and we can remove them it is strongly in our interest to do so.

Faking object lists and object change notifications is not hard, and not worth getting stuck forever on a single version.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 13, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 12, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

5 participants