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

Splitting configmap package to avoid heavy dependencies #1851

Merged
merged 1 commit into from
Dec 22, 2020

Conversation

mattmoor
Copy link
Member

/hold

Abusing the downstream test to see what breaks 🤞

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 27, 2020
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 27, 2020
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 27, 2020
@mattmoor mattmoor force-pushed the try-splitting-configmap branch from 851bd5a to 7ded756 Compare October 27, 2020 04:07
@knative-prow-robot knative-prow-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 27, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor

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:

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

@codecov
Copy link

codecov bot commented Oct 27, 2020

Codecov Report

Merging #1851 (2635282) into master (e41409a) will decrease coverage by 1.03%.
The diff coverage is 84.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1851      +/-   ##
==========================================
- Coverage   69.06%   68.02%   -1.04%     
==========================================
  Files         209      223      +14     
  Lines        8786     9471     +685     
==========================================
+ Hits         6068     6443     +375     
- Misses       2448     2703     +255     
- Partials      270      325      +55     
Impacted Files Coverage Δ
tracing/setup.go 0.00% <ø> (ø)
configmap/manual_watcher.go 78.57% <57.14%> (-21.43%) ⬇️
configmap/informer/informed_watcher.go 94.20% <100.00%> (ø)
leaderelection/context.go 0.00% <0.00%> (-91.82%) ⬇️
depcheck/depcheck.go 50.00% <0.00%> (-32.15%) ⬇️
test/logstream/v2/stream.go 88.76% <0.00%> (-7.12%) ⬇️
tracing/config/tracing.go 70.31% <0.00%> (-4.69%) ⬇️
network/h2c.go 15.38% <0.00%> (-4.62%) ⬇️
leaderelection/config.go 72.72% <0.00%> (-4.55%) ⬇️
tracing/zipkin.go 68.42% <0.00%> (-3.01%) ⬇️
... and 48 more

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 e41409a...59aa3ca. Read the comment docs.

@mattmoor mattmoor force-pushed the try-splitting-configmap branch from 7ded756 to 05d0484 Compare October 27, 2020 04:44
Comment on lines 27 to 28
nodep.AssertNoDependency(t, map[string]sets.String{
"knative.dev/pkg/configmap": sets.NewString(
"k8s.io/client-go/informers",
),
})
Copy link
Member

Choose a reason for hiding this comment

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

  • how does this affect test duration?
  • can we avoid the package name knative.dev/pkg/configmap
  • do we have instances where binaries are depending on the configmap water interface but don't have informers?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Test took 17s

  2. Not AFAIK, I also specifically put this into package configmap_test to avoid polluting its dependencies (which might make this harder).

  3. What I eyeballed yesterday showed that this wasn't pulling in the configmap.Watcher, but other things like helper functions for parsing configmap keys, and constants. I need to pull this into Serving today and see how it affects the QP dep graph.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, is your feeling that exclusion list is going to be smaller, or the allow list? Just thinking about which way we think it's easier to create these tests. If we use exclusion list, then any new dependency is allowed by default. I wonder if just like we have test coverage, we could also in our actions do things like:

  • show the resulting binary size changes
  • show the resulting binary dep deltas
    etc.

Neat stuff indeed.

Copy link
Member Author

Choose a reason for hiding this comment

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

I renamed this package depcheck here: #1853

We can add other assertions about the dependency graph (e.g. AssertOnlyDeps), which I could see being very useful for our most widely used libraries. However, generally I think this will be prohibitive to maintain for non-leaf libraries.

@mattmoor mattmoor force-pushed the try-splitting-configmap branch 2 times, most recently from eab0438 to 3ad9fb1 Compare October 27, 2020 16:43
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 27, 2020
@mattmoor
Copy link
Member Author

Related: knative/serving#9957

@dprotaso
Copy link
Member

Test took 17s

$ time go list -f '{{ join .Deps "\n" }}'
...
real	0m0.255s
user	0m0.760s
sys	0m0.416s

@mattmoor
Copy link
Member Author

go test ./configmap/
ok      knative.dev/pkg/configmap       0.922s

🙃 I was going off of the test timing on Prow.

@dprotaso
Copy link
Member

lol that's not 17s

@dprotaso
Copy link
Member

why is prow so slow?

@vagababov
Copy link
Contributor

Has it ever been fast?

@dprotaso
Copy link
Member

also @mattmoor run go clean -testcache -cache ;)

@mattmoor
Copy link
Member Author

I've never run go clean in my life, why start now? What problem are we trying to solve...?

The test wasn't cached, or it wouldn't print the time. 🤷

@vagababov
Copy link
Contributor

-count=1 ensures it is not cached

@mattmoor
Copy link
Member Author

I'm going to wait on this until after the release cut because it contains breaking changes, and we won't unlock the bigger win until we remove k8s.io/client-go/kubernetes from knative.dev/metrics

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 29, 2020
@mattmoor mattmoor force-pushed the try-splitting-configmap branch from 3ad9fb1 to 59aa3ca Compare December 22, 2020 20:44
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 22, 2020
@mattmoor
Copy link
Member Author

/test pull-knative-pkg-unit-tests

prometheus export flake 🙃

mattmoor added a commit to mattmoor/serving that referenced this pull request Dec 22, 2020
mattmoor added a commit to mattmoor/eventing that referenced this pull request Dec 22, 2020
mattmoor added a commit to mattmoor/eventing-kafka that referenced this pull request Dec 22, 2020
@mattmoor
Copy link
Member Author

I staged PRs for the three broken downstream repositories.

Tekton has a couple places to fixup, but they are just in test code.

@mattmoor mattmoor changed the title Try splitting configmap package Splitting configmap package to avoid heavy dependencies Dec 22, 2020
@vagababov
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 22, 2020
mattmoor added a commit to mattmoor/serving that referenced this pull request Dec 22, 2020
@mattmoor
Copy link
Member Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 22, 2020
@knative-prow-robot knative-prow-robot merged commit e2d6b4f into knative:master Dec 22, 2020
@mattmoor mattmoor deleted the try-splitting-configmap branch December 22, 2020 21:58
mattmoor added a commit to mattmoor/serving that referenced this pull request Dec 22, 2020
mattmoor added a commit to mattmoor/eventing that referenced this pull request Dec 22, 2020
mattmoor added a commit to mattmoor/eventing-kafka that referenced this pull request Dec 22, 2020
knative-prow-robot pushed a commit to knative/eventing that referenced this pull request Dec 22, 2020
knative-prow-robot pushed a commit to knative/serving that referenced this pull request Dec 22, 2020
knative-prow-robot pushed a commit to knative-extensions/eventing-kafka that referenced this pull request Dec 22, 2020
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants