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

Rework the way eventing-rabbitmq does Rabbit codegen #378

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

mattmoor
Copy link
Contributor

Today we rerun codegen for the Rabbit clients to get injection, but because they use kubebuilder their layout is a bit strange. There's a hack to temporarily copy the api types into the right structure, and then undo it, which is a bit fragile (if codegen references that package, then it won't build!). We also try to contort so that we can use their existing client/informer/lister codegen, which isn't really necessary.

With this change, we instead permanently copy the types into a suitable structure under third_party/pkg/apis and generate all of the clients we need under third_party/pkg/client. This is a slight superset of what Istio and Contour are already doing (we don't need to copy those types), and feels a bit simpler (and less fragile) than what we are currently doing.

/kind cleanup
/assign @n3wscott

Release Note


Docs


@knative-prow-robot knative-prow-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Aug 17, 2021
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Aug 17, 2021
@knative-prow-robot knative-prow-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 17, 2021
Today we rerun codegen for the Rabbit clients to get injection, but because they use kubebuilder their layout is a bit strange.  There's a hack to temporarily copy the api types into the right structure, and then undo it, which is a bit fragile (if codegen references that package, then it won't build!).  We also try to contort so that we can use their existing client/informer/lister codegen, which isn't really necessary.

With this change, we instead permanently copy the types into a suitable structure under `third_party/pkg/apis` and generate all of the clients we need under `third_party/pkg/client`.  This is a slight superset of what Istio and Contour are already doing (we don't need to copy those types), and feels a bit simpler (and less fragile) than what we are currently doing.

/kind cleanup
@n3wscott
Copy link

This seems like a fine way to handle out of tree codegen for oddly layed out apis.

👍

@codecov
Copy link

codecov bot commented Aug 17, 2021

Codecov Report

Merging #378 (f5bf069) into main (9bfb7b2) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #378   +/-   ##
=======================================
  Coverage   75.54%   75.54%           
=======================================
  Files          44       44           
  Lines        2781     2781           
=======================================
  Hits         2101     2101           
  Misses        548      548           
  Partials      132      132           
Impacted Files Coverage Δ
pkg/reconciler/broker/broker.go 80.88% <ø> (ø)
pkg/reconciler/broker/controller.go 97.14% <ø> (ø)
pkg/reconciler/broker/resources/exchange.go 100.00% <ø> (ø)
pkg/reconciler/trigger/controller.go 73.01% <ø> (ø)
pkg/reconciler/trigger/resources/binding.go 94.80% <ø> (ø)
pkg/reconciler/trigger/resources/queue.go 100.00% <ø> (ø)
pkg/reconciler/trigger/trigger.go 52.85% <ø> (ø)

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 9bfb7b2...f5bf069. Read the comment docs.

mattmoor added a commit to mattmoor/eventing-autoscaler-keda that referenced this pull request Aug 17, 2021
Today we rerun codegen for the Rabbit clients to get injection, but because they use kubebuilder their layout is a bit strange. There's a hack to temporarily copy the api types into the right structure, and then undo it, which is a bit fragile (if codegen references that package, then it won't build!). We also try to contort so that we can use their existing client/informer/lister codegen, which isn't really necessary.

With this change, we instead permanently copy the types into a suitable structure under third_party/pkg/apis and generate all of the clients we need under third_party/pkg/client. This is a slight superset of what Istio and Contour are already doing (we don't need to copy those types), and feels a bit simpler (and less fragile) than what we are currently doing.

/kind cleanup

Ref (same for rabbitmq): knative-extensions/eventing-rabbitmq#378
mattmoor added a commit to mattmoor/eventing-autoscaler-keda that referenced this pull request Aug 17, 2021
Today we rerun codegen for the Rabbit clients to get injection, but because they use kubebuilder their layout is a bit strange. There's a hack to temporarily copy the api types into the right structure, and then undo it, which is a bit fragile (if codegen references that package, then it won't build!). We also try to contort so that we can use their existing client/informer/lister codegen, which isn't really necessary.

With this change, we instead permanently copy the types into a suitable structure under third_party/pkg/apis and generate all of the clients we need under third_party/pkg/client. This is a slight superset of what Istio and Contour are already doing (we don't need to copy those types), and feels a bit simpler (and less fragile) than what we are currently doing.

/kind cleanup

Ref (same for rabbitmq): knative-extensions/eventing-rabbitmq#378
mattmoor added a commit to mattmoor/eventing-autoscaler-keda that referenced this pull request Aug 17, 2021
Today we rerun codegen for the Rabbit clients to get injection, but because they use kubebuilder their layout is a bit strange. There's a hack to temporarily copy the api types into the right structure, and then undo it, which is a bit fragile (if codegen references that package, then it won't build!). We also try to contort so that we can use their existing client/informer/lister codegen, which isn't really necessary.

With this change, we instead permanently copy the types into a suitable structure under third_party/pkg/apis and generate all of the clients we need under third_party/pkg/client. This is a slight superset of what Istio and Contour are already doing (we don't need to copy those types), and feels a bit simpler (and less fragile) than what we are currently doing.

/kind cleanup

Ref (same for rabbitmq): knative-extensions/eventing-rabbitmq#378
@n3wscott
Copy link

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, n3wscott

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 17, 2021
@knative-prow-robot knative-prow-robot merged commit 3893975 into knative-extensions:main Aug 17, 2021
@mattmoor mattmoor deleted the rework-codegen branch August 17, 2021 21:33
knative-prow-robot pushed a commit to knative-extensions/eventing-autoscaler-keda that referenced this pull request Aug 17, 2021
Today we rerun codegen for the Rabbit clients to get injection, but because they use kubebuilder their layout is a bit strange. There's a hack to temporarily copy the api types into the right structure, and then undo it, which is a bit fragile (if codegen references that package, then it won't build!). We also try to contort so that we can use their existing client/informer/lister codegen, which isn't really necessary.

With this change, we instead permanently copy the types into a suitable structure under third_party/pkg/apis and generate all of the clients we need under third_party/pkg/client. This is a slight superset of what Istio and Contour are already doing (we don't need to copy those types), and feels a bit simpler (and less fragile) than what we are currently doing.

/kind cleanup

Ref (same for rabbitmq): knative-extensions/eventing-rabbitmq#378
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants