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

add Channel NatsJetStreamChannel to support JetStream #182

Merged
merged 17 commits into from
Aug 11, 2021

Conversation

zhaojizhuang
Copy link
Member

@zhaojizhuang zhaojizhuang commented Jul 7, 2021

Working in progress...

Part 1 of #145

Proposed Changes

add NatsJetStreamChannel support JetStream

  • Re-optimized the directory structure and file name to support streaming and jetstream
  • Add crds and controller for jetstream
  • Add dispatcher for jetstream

Release Note


Docs

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 7, 2021
@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2021
@zhaojizhuang
Copy link
Member Author

/wip

@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 7, 2021
@zhaojizhuang
Copy link
Member Author

zhaojizhuang commented Jul 7, 2021

/hold
work in progress

@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 Jul 7, 2021
@zhaojizhuang zhaojizhuang changed the title support JetStream [WIP]support JetStream Jul 7, 2021
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 7, 2021
@zhaojizhuang zhaojizhuang changed the title [WIP]support JetStream [WIP]support JetStream ,Part 1 of #145 Jul 8, 2021
@zhaojizhuang zhaojizhuang changed the title [WIP]support JetStream ,Part 1 of #145 [WIP]support JetStream ,Part 1 Jul 8, 2021
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 8, 2021
@zhaojizhuang zhaojizhuang changed the title [WIP]support JetStream ,Part 1 [WIP]support JetStream ,Part 1 ,Re-optimized the directory structure and file name Jul 8, 2021
@codecov
Copy link

codecov bot commented Jul 8, 2021

Codecov Report

Merging #182 (058c044) into main (2c87814) will decrease coverage by 3.82%.
The diff coverage is 64.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #182      +/-   ##
==========================================
- Coverage   77.25%   73.43%   -3.83%     
==========================================
  Files          10       17       +7     
  Lines         299      399     +100     
==========================================
+ Hits          231      293      +62     
- Misses         53       90      +37     
- Partials       15       16       +1     
Impacted Files Coverage Δ
...saging/v1alpha1/nats_jetstream_channel_defaults.go 0.00% <0.00%> (ø)
pkg/apis/messaging/v1alpha1/register.go 0.00% <0.00%> (ø)
pkg/natsutil/jetstreamutil.go 0.00% <0.00%> (ø)
pkg/natsutil/stanutil.go 71.42% <ø> (ø)
pkg/reconciler/controller/natss/natsschannel.go 79.62% <ø> (ø)
...g/reconciler/controller/natss/resources/service.go 100.00% <ø> (ø)
...ging/v1alpha1/nats_jetstream_channel_validation.go 57.14% <57.14%> (ø)
...pis/messaging/v1alpha1/nats_jetstream_lifecycle.go 95.45% <95.45%> (ø)
...kg/apis/messaging/v1alpha1/nats_jetstream_types.go 100.00% <100.00%> (ø)
...conciler/controller/jetstream/resources/service.go 100.00% <100.00%> (ø)
... and 10 more

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 2c87814...058c044. Read the comment docs.

@zhaojizhuang
Copy link
Member Author

/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 Jul 8, 2021
@zhaojizhuang zhaojizhuang changed the title [WIP]support JetStream ,Part 1 ,Re-optimized the directory structure and file name support JetStream ,Part 1 ,Re-optimized the directory structure and file name Jul 8, 2021
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 8, 2021
@zhaojizhuang
Copy link
Member Author

/assign @devguyio @matzew

@zhaojizhuang zhaojizhuang changed the title support JetStream ,Part 1 ,Re-optimized the directory structure and file name add Channel NatsJetStreamChannel to support JetStream Jul 9, 2021
@knative-prow-robot knative-prow-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 9, 2021
@zhaojizhuang zhaojizhuang force-pushed the rename branch 2 times, most recently from 469278c to 58cc8bd Compare July 9, 2021 09:10
@zhaojizhuang zhaojizhuang requested a review from vaikas July 12, 2021 02:46
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2021
@zhaojizhuang
Copy link
Member Author

ping @vaikas @devguyio

@@ -0,0 +1,32 @@
# Copyright 2019 The Knative Authors
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Some of these files have the wrong copyright year. Copy/paste leftover?

name: jetstream-ch-dispatcher
namespace: knative-eventing
labels:
nats.eventing.knative.dev/release: devel
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

@zhaojizhuang zhaojizhuang Aug 9, 2021

Choose a reason for hiding this comment

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

@vaikas Or we should be nats(include natss and natsjsm)? We release both to together. What do you think about?

name: nats-jsm-ch-controller
namespace: knative-eventing
labels:
nats.eventing.knative.dev/release: devel
Copy link
Contributor

Choose a reason for hiding this comment

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

name: nats-jsm-ch-dispatcher
namespace: knative-eventing
labels:
nats.eventing.knative.dev/release: devel
Copy link
Contributor

Choose a reason for hiding this comment

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

And here, natsjsm?

@@ -0,0 +1,44 @@
# Copyright 2019 The Knative Authors
Copy link
Contributor

Choose a reason for hiding this comment

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

2021?

metadata:
name: natsjetstreamchannels.messaging.knative.dev
labels:
nats.eventing.knative.dev/release: devel
Copy link
Contributor

Choose a reason for hiding this comment

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

natsjsm?

Copy link
Member Author

Choose a reason for hiding this comment

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

nats

name: jetstream-ch-controller
namespace: knative-eventing
labels:
nats.eventing.knative.dev/release: devel
Copy link
Contributor

Choose a reason for hiding this comment

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

natsjsm?

Copy link
Member Author

@zhaojizhuang zhaojizhuang Aug 9, 2021

Choose a reason for hiding this comment

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

same as above

name: jetstream-ch-dispatcher
namespace: knative-eventing
labels:
nats.eventing.knative.dev/release: devel
Copy link
Contributor

Choose a reason for hiding this comment

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

natsjsm?

Copy link
Member Author

Choose a reason for hiding this comment

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

nats

echo "Tagged release, updating release labels to natss.eventing.knative.dev/release: \"${TAG}\""
LABEL_YAML_CMD=(sed -e "s|natss.eventing.knative.dev/release: devel|natss.eventing.knative.dev/release: \"${TAG}\"|")
echo "Tagged release, updating release labels to nats.eventing.knative.dev/release: \"${TAG}\""
LABEL_YAML_CMD=(sed -e "s|nats.eventing.knative.dev/release: devel|nats.eventing.knative.dev/release: \"${TAG}\"|")
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably need to add something about replacing the natsjsm.eventing release labels too?

FilterFunc: filterFunc,
Handler: controller.HandleAll(grCh),
})
serviceInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I'm wrong. But this sets up the (what looks to be a single dispatcher for all the channels?) and that causes a global resync, which I think makes sense since if the dispatcher is used by all the channels, they all need to be reconciled. However, there's another Service thats created here (obvs if it doesn't exist):
https://github.com/knative-sandbox/eventing-natss/pull/182/files#diff-a9bd98b0e5248a4625de7f3a112db792e398a7fd49924ac9bd40bec7f0a788fdR20

For that I'd expect us to set up a tracker so that only one channel get's reconciled when that Service changes.

@zhaojizhuang
Copy link
Member Author

Updated, add service eventhandler

@vaikas
Copy link
Contributor

vaikas commented Aug 10, 2021

/lgtm
/approve
/hold

Looks like a great start, I reckon we should get this in and continue as per the PR description, this is only the first part. I added a hold since today is a release day and seems like a major change that we wouldn't want to go in at the last minute (esp, since there are no e2e tests (future work as per the issue)). Feel free to remove the hold once the release is cut.

@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 Aug 10, 2021
@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 10, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vaikas, zhaojizhuang

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

@zhaojizhuang
Copy link
Member Author

zhaojizhuang commented Aug 10, 2021

/lgtm
/approve
/hold

Looks like a great start, I reckon we should get this in and continue as per the PR description, this is only the first part. I added a hold since today is a release day and seems like a major change that we wouldn't want to go in at the last minute (esp, since there are no e2e tests (future work as per the issue)). Feel free to remove the hold once the release is cut.

@vaikas OK, thank you. It's ok to aprove after release day. I have already tracked the things to be done in the issue task #145

@vaikas
Copy link
Contributor

vaikas commented Aug 10, 2021

@zhaojizhuang it's already been approved so you can just remove the hold label after the release has been cut, you can do this yourself (or should be able to :) ) so just do it at will.

@zhaojizhuang
Copy link
Member Author

/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 Aug 11, 2021
@knative-prow-robot knative-prow-robot merged commit 4080495 into knative-extensions:main Aug 11, 2021
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants