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

Update k8s dependencies to v0.20.7 #1344

Merged
merged 7 commits into from
Jun 17, 2021

Conversation

dsimansk
Copy link
Contributor

Description

Update K8s dependencies to follow-up on knative/pkg#2145.

Changes

  • Update k8s version
  • Fix dynamic client tests

Reference

Fixes #

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 14, 2021
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 14, 2021
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsimansk: 1 warning.

In response to this:

Description

Update K8s dependencies to follow-up on knative/pkg#2145.

Changes

  • Update k8s version
  • Fix dynamic client tests

Reference

Fixes #

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.

@@ -26,6 +26,19 @@ import (
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
)

var GvrToListKind = map[schema.GroupVersionResource]string{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Golint comments: exported var GvrToListKind should have comment or be unexported. More info.

@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 14, 2021
@codecov
Copy link

codecov bot commented Jun 14, 2021

Codecov Report

Merging #1344 (ce625c7) into main (217df5c) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1344      +/-   ##
==========================================
- Coverage   72.97%   72.89%   -0.08%     
==========================================
  Files         160      160              
  Lines        8151     8151              
==========================================
- Hits         5948     5942       -6     
- Misses       1476     1480       +4     
- Partials      727      729       +2     
Impacted Files Coverage Δ
pkg/kn/commands/testing_helper.go 75.00% <100.00%> (ø)
pkg/kn/commands/channel/list_types.go 64.70% <0.00%> (-5.89%) ⬇️
pkg/kn/commands/source/list_types.go 56.86% <0.00%> (-5.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 217df5c...ce625c7. Read the comment docs.

@dsimansk
Copy link
Contributor Author

/test pull-knative-client-build-tests

1 similar comment
@dsimansk
Copy link
Contributor Author

/test pull-knative-client-build-tests

@navidshaikh
Copy link
Collaborator

/cc @dprotaso

{Group: "eventing.knative.dev", Version: "v1", Resource: "channels"}: "ChannelList",
{Group: "messaging.knative.dev", Version: "v1", Resource: "inmemorychannels"}: "InMemoryChannelsList",
}

// createFakeKnDynamicClient gives you a dynamic client for testing containing the given objects.
// See also the one in the fake package. Duplicated here to avoid a dependency loop.
func createFakeKnDynamicClient(testNamespace string, objects ...runtime.Object) KnDynamicClient {
scheme := runtime.NewScheme()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could technically drop the need for the gvrToListKind if you add the correct types to the scheme

ie. for k8s types invoke scheme.AddToScheme(scheme) from https://github.com/kubernetes/client-go/blob/1bccfc8c60977e2ce3235394daff128996818f7b/kubernetes/scheme/register.go#L135

You can do this with eventing and serving and save yourself from maintaining this list. Unsure if there's something that prevents you from importing those.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also had some issues where I couldn't provide unstructured types to the fake dynamic client. There would be an error with the way the fake client interacts with its object tracker

So I wrote some code for the fake injection client to rewire these schemes to use unstructured.* types
https://github.com/knative/pkg/pull/2145/files#diff-8438a08a79f266761b674dbf8748084e62be792ce56e7d7b598d148c069946e5L40

Unsure if you would need to do the same - if so maybe we pull that bit of logic out out injection and into some sort of fakedynamic package in knative.dev/pkg

@dsimansk dsimansk force-pushed the pr/k8s-update branch 2 times, most recently from f8d48fd to ae74c32 Compare June 15, 2021 22:58
sourcesv1.AddToScheme(scheme)
sourcesv1beta2.AddToScheme(scheme)
apiextensionsv1.AddToScheme(scheme)
_, dynamicClient := dynamicclientfake.With(context.TODO(), scheme, objects...)
Copy link
Contributor Author

@dsimansk dsimansk Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dprotaso @navidshaikh wdyt about the above change? It works for our test setup, I've gone through and changed various initialization of fake dynamic client to use the common function.

Indeed I had to use knative/pkg for unstructured object to get them converted properly.

Finally, Navid do you see any problem in bringing apiextensions-apiserver dependency for the scheme?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looks good - I might PR a change to k8s to fix this problem but it'll take weeks/months for us to switch over to it

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/commands/channel/list_types.go 81.0% 76.2% -4.8

Copy link
Collaborator

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 17, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dsimansk, navidshaikh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [dsimansk,navidshaikh]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot merged commit e23b4d6 into knative:main Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants