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

Set DeadLetterTopic when it and subScriptionName are empty #595

Merged
merged 6 commits into from
Mar 14, 2023

Conversation

jiangpengcheng
Copy link
Member

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #593

(or if this PR is one task of a github issue, please add Master Issue: #<xyz> to link to the master issue.)

Master Issue: #

Motivation

Explain here the context, and why you're making that change. What is the problem you're trying to solve.

Modifications

Describe the modifications you've done.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Documentation

Check the box below.

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@jiangpengcheng jiangpengcheng requested review from nlu90, freeznet and a team as code owners March 3, 2023 04:01
@github-actions github-actions bot added the no-need-doc This pr does not need any document label Mar 3, 2023
tpiperatgod
tpiperatgod previously approved these changes Mar 3, 2023
Copy link
Contributor

@tpiperatgod tpiperatgod left a comment

Choose a reason for hiding this comment

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

lgtm, but I wonder if we need to do handle the case without webhook enabled...

@@ -88,6 +88,12 @@ func (r *Function) Default() {
r.Spec.Namespace = DefaultNamespace
}

if r.Spec.SubscriptionName == "" && r.Spec.DeadLetterTopic == "" {
Copy link
Member

Choose a reason for hiding this comment

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

We will need to set the subs name only if maxMessageRetry is set, which means the RetryDetails will provide to the function runtime.

Copy link
Member Author

@jiangpengcheng jiangpengcheng Mar 9, 2023

Choose a reason for hiding this comment

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

if function is created without maxMessageRetry or DeadLetterTopic, then sub is set to tenant-namespace-name, but when function is updated with maxMessageRetry and DeadLetterTopic provided, then the sub will be changed to tenant/namespace/name, which will make function consume from input topics again?

look like we should set the SubscriptionName(like tenant-namespace-name) once it is not defined

Copy link
Member Author

Choose a reason for hiding this comment

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

We may need to consider the backward compatibility as well, if we change the default sub name and released, when users upgrade function-mesh, their existing function pods may change the sub name and cause duplicate consumption

looks like the better way is to set the deadLetterTopic name

Copy link
Member

Choose a reason for hiding this comment

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

agree, we should set the deadLetterTopic when

  1. maxMessageRetry is provided
  2. DeadLetterTopic is empty
  3. SubscriptionName is empty or contains /

@jiangpengcheng jiangpengcheng changed the title Set subName when it and deadLetterTopic are empty Set DeadLetterTopic when it and subScriptionName are empty Mar 10, 2023
freeznet
freeznet previously approved these changes Mar 13, 2023
Copy link
Member

@freeznet freeznet left a comment

Choose a reason for hiding this comment

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

lgtm, but we may need to address this change via doc as well.

@jiangpengcheng
Copy link
Member Author

lgtm, but I wonder if we need to do handle the case without webhook enabled...

make sense, maybe it's better to do it without webhook enabled

@freeznet freeznet merged commit 908906a into streamnative:master Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
m/2023-03 no-need-doc This pr does not need any document
Projects
None yet
Development

Successfully merging this pull request may close these issues.

failed enable messages retry when not setting subscriptionName and deadLetterTopic
3 participants