Skip to content

Commit

Permalink
Refactor tests to drop hard otel dependency
Browse files Browse the repository at this point in the history
Since v0.16.0 (#2407), there is an import for all users of various
opentelemetry libraries. This is caused by manager test ->
pkg/metrics/filters -> k8s.io/apiserver -> otel-go.

The issue is API server users a otel-go library from >1 year ago. This
makes it impossible to import a modern otel-go library and a modern
controller-runtime library together.

Go is unable to prune the dependency *even though its only used in
tests* (TBH, this surprised me!). By moving the tests that use
`filters` under the `filters` package, though, this drops the required
dependency on otel-go. Users that import the `filters` package will use
it, of course, but everyone does not need to.

So basically this refactors tests, but has user facing changes -- fewer
dependencies are required to import controller-runtime core, allowing
using the newer controller-runtime with newer otel-go.

In parallel I will attempt to get k/k to update their otel-go version,
but this will take months to ship at the earliest. IMO, this is worth
fixing in the meantime as a v0.16.x patch.
  • Loading branch information
howardjohn committed Aug 31, 2023
1 parent c1d71fc commit d17751f
Show file tree
Hide file tree
Showing 4 changed files with 355 additions and 376 deletions.

0 comments on commit d17751f

Please sign in to comment.