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

[release-0.25] Default dead letter sink namespace to the object namespace #5906

Conversation

pierDipi
Copy link
Member

@pierDipi pierDipi commented Nov 15, 2021

This is a cherry-pick of #5748

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

The automated cherry-pick is broken due to Go 1.17

Reproducer:

---
apiVersion: v1
kind: Namespace
metadata:
  labels:
    bindings.knative.dev/include: "true"
  name: broker-v1-dlq
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: event-display
  namespace: broker-v1-dlq
spec:
  template:
    spec:
      containers:
      - image: quay.io/openshift-knative/knative-eventing-sources-event-display:v0.13.2
---
apiVersion: messaging.knative.dev/v1
kind: Channel
metadata:
  name: dlq-channel
  namespace: broker-v1-dlq
---
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
  name: broker
  namespace: broker-v1-dlq
spec:
  delivery:
    backoffDelay: PT1S
    backoffPolicy: linear
    deadLetterSink:
      ref:
        apiVersion: messaging.knative.dev/v1
        kind: Channel
        name: dlq-channel
    retry: 5
---
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
  name: subscription
  namespace: broker-v1-dlq
spec:
  broker: broker
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: event-display
---
apiVersion: sources.knative.dev/v1
kind: SinkBinding
metadata:
  name: bind-heartbeat
  namespace: broker-v1-dlq
spec:
  subject:
    apiVersion: apps/v1
    kind: Deployment
    selector:
      matchLabels:
        app: heartbeat
  sink:
    ref:
      apiVersion: eventing.knative.dev/v1
      kind: Broker
      name: broker
  ceOverrides:
    extensions:
      sink: bound
---
apiVersion: eventing.knative.dev/v1beta1
kind: EventType
metadata:
  name: dev.knative.eventing.samples.heartbeat
  namespace: broker-v1-dlq
spec:
  type: dev.knative.eventing.samples.heartbeat
  source: https://knative.dev/eventing-contrib/cmd/heartbeats/#broker-v1/heartbeat
  broker: broker
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hearbeat
  namespace: broker-v1-dlq
  labels:
   app: heartbeat
   bindings.knative.dev/include: "true"
spec:
  selector:
    matchLabels:
      app: heartbeat
  template:
    metadata:
      labels:
        app: heartbeat
    spec:
      containers:
      - name: single-heartbeat
        image: quay.io/openshift-knative/knative-eventing-sources-heartbeats:v0.13.2
        args:
        - --period=1
        env:
        - name: POD_NAME
          value: heartbeat
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace

Output:

    - lastTransitionTime: "2021-11-15T08:19:19Z"
      message: channels.messaging.knative.dev "dlq-channel" not found
      reason: Unable to get the dead letter sink's URI
      status: "False"
      type: DeadLetterSinkResolved

pierDipi and others added 3 commits November 15, 2021 10:25
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 15, 2021
@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 Nov 15, 2021
@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/reconciler/broker/trigger/trigger.go 88.5% 88.0% -0.5

@codecov
Copy link

codecov bot commented Nov 15, 2021

Codecov Report

❗ No coverage uploaded for pull request base (release-0.25@4b3c52f). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##             release-0.25    #5906   +/-   ##
===============================================
  Coverage                ?   82.79%           
===============================================
  Files                   ?      201           
  Lines                   ?     6278           
  Branches                ?        0           
===============================================
  Hits                    ?     5198           
  Misses                  ?      749           
  Partials                ?      331           

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 4b3c52f...3e7066c. Read the comment docs.

Copy link
Contributor

@odacremolbap odacremolbap left a comment

Choose a reason for hiding this comment

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

just noticed the channel_default_test cases for DLS are missing at the original PR.

Not a blocker for this.

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: odacremolbap, 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 merged commit efb397c into knative:release-0.25 Nov 15, 2021
@pierDipi
Copy link
Member Author

just noticed the channel_default_test cases for DLS are missing at the original PR.

Good catch!

@pierDipi
Copy link
Member Author

just noticed the channel_default_test cases for DLS are missing at the original PR.

Good catch!

PTAL at #5908

@pierDipi pierDipi deleted the cherry-pick-5748-to-release-0.25 branch November 15, 2021 20:55
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.

4 participants