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

Default dead letter sink namespace to the object namespace #5748

Merged

Conversation

pierDipi
Copy link
Member

@pierDipi pierDipi commented Sep 21, 2021

Dead letter sink namespace is not defaulted to the object namespace for:

  • Broker
  • Trigger
  • Channel
  • Subscription

Forcing every implementation to define the logic:

"If spec.delivery.deadLetterSink.ref.namespace is empty, use metadata.namespace"

Fixes #5747 #5639

Proposed Changes

  • Default dead letter sink namespace to the object namespace

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

The field `spec.delivery.deadLetterSink.ref.namespace` for Broker, Trigger, Channel and Subscription if not specified is defaulted to `metadata.namespace`.

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Sep 21, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pierDipi

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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 21, 2021
@pierDipi pierDipi force-pushed the KNATIVE-5747_Default-dls-namespace branch from 0a628c9 to 1b448d3 Compare September 21, 2021 18:02
@codecov
Copy link

codecov bot commented Sep 21, 2021

Codecov Report

Merging #5748 (7aed22b) into main (e05ccfc) will increase coverage by 0.00%.
The diff coverage is 86.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5748   +/-   ##
=======================================
  Coverage   82.51%   82.52%           
=======================================
  Files         202      203    +1     
  Lines        6360     6374   +14     
=======================================
+ Hits         5248     5260   +12     
- Misses        767      768    +1     
- Partials      345      346    +1     
Impacted Files Coverage Δ
pkg/apis/messaging/v1/subscription_defaults.go 71.42% <66.66%> (-28.58%) ⬇️
pkg/apis/duck/v1/delivery_defaults.go 100.00% <100.00%> (ø)
pkg/apis/eventing/v1/broker_defaults.go 100.00% <100.00%> (ø)
pkg/apis/eventing/v1/trigger_defaults.go 100.00% <100.00%> (ø)
pkg/apis/messaging/v1/channel_defaults.go 100.00% <100.00%> (ø)
...kg/apis/messaging/v1/in_memory_channel_defaults.go 100.00% <100.00%> (ø)

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 e05ccfc...7aed22b. Read the comment docs.

@pierDipi
Copy link
Member Author

/hold waiting for @duglin to comment

@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 Sep 22, 2021
@lionelvillard
Copy link
Member

this breaks eventing-rabbitmq

/cc @benmoss

@duglin
Copy link

duglin commented Sep 22, 2021

can't comment on the code change, but I'm ok with the concept!

benmoss pushed a commit to benmoss/eventing-rabbitmq that referenced this pull request Sep 23, 2021
With upcoming changes to eventing DLQs will be defaulted to the
namespace of their parent object if the namespace isn't specified in the
ref. For some reason this causes a panic from the fake dynamic client
that doesn't occur if the namespace isn't specified.

It happens because ksvcs have been registered with the fake dynamic
client as a type, but I'm not really sure why they only panic when a
namespace is present.

xref knative/eventing#5748 for the namespace
defaulting change
xref knative/eventing#5185 for more discussion of
the changed behavior of client-go fake dynamic clients.
knative-prow-robot pushed a commit to knative-extensions/eventing-rabbitmq that referenced this pull request Sep 23, 2021
With upcoming changes to eventing DLQs will be defaulted to the
namespace of their parent object if the namespace isn't specified in the
ref. For some reason this causes a panic from the fake dynamic client
that doesn't occur if the namespace isn't specified.

It happens because ksvcs have been registered with the fake dynamic
client as a type, but I'm not really sure why they only panic when a
namespace is present.

xref knative/eventing#5748 for the namespace
defaulting change
xref knative/eventing#5185 for more discussion of
the changed behavior of client-go fake dynamic clients.
@benmoss
Copy link
Member

benmoss commented Sep 23, 2021

@pierDipi @lionelvillard downstream rabbit should be good now with knative-extensions/eventing-rabbitmq#433

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
@pierDipi pierDipi force-pushed the KNATIVE-5747_Default-dls-namespace branch from 1b448d3 to 7aed22b Compare September 23, 2021 17:49
@pierDipi
Copy link
Member Author

Thanks! Let's see how this run goes!

@knative-metrics-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/duck/v1/delivery_defaults.go Do not exist 100.0%
pkg/apis/messaging/v1/subscription_defaults.go 100.0% 85.7% -14.3

@pierDipi
Copy link
Member Author

@benmoss
Copy link
Member

benmoss commented Sep 23, 2021

Oh of course, we have the same test copy and pasted into two different packages, how silly of me to forget to replicate the changes 😄

@benmoss
Copy link
Member

benmoss commented Sep 23, 2021

@pierDipi try again 😄

@pierDipi
Copy link
Member Author

Thanks Ben, it works!

/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 Sep 23, 2021
imc.Spec.SetDefaults(ctx)
}

func (imcs *InMemoryChannelSpec) SetDefaults(ctx context.Context) {
// TODO: Nothing to default here...
imcs.Delivery.SetDefaults(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

@pierDipi should we do that on other downstream channels too?

Copy link
Member

Choose a reason for hiding this comment

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

Original issue came up in here: knative-extensions/eventing-kafka-broker#1254

Not sure if it is done in other places too

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll do it.

@matzew
Copy link
Member

matzew commented Sep 24, 2021

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2021
@pierDipi
Copy link
Member Author

/retest

@knative-prow-robot knative-prow-robot merged commit 384523f into knative:main Sep 24, 2021
@pierDipi
Copy link
Member Author

/cherry-pick release-0.26

@pierDipi
Copy link
Member Author

/cherry-pick release-0.25

@knative-prow-robot
Copy link
Contributor

@pierDipi: new pull request created: #5904

In response to this:

/cherry-pick release-0.26

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.

@knative-prow-robot
Copy link
Contributor

@pierDipi: new pull request created: #5905

In response to this:

/cherry-pick release-0.25

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
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.

Default dead letter sink namespace to the object namespace
8 participants