-
Notifications
You must be signed in to change notification settings - Fork 630
Add NATS Streaming provisioner #624
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
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
8408d06
Add natss provisioner: initial commit
050d484
Cleanup code, add more log messages
2259b1e
Remove unused code related to the configmap
2b156f9
Update vendor and gopkg.toml
d9ea8c4
Remove sample applicatoin
61efb16
Update Gopkg.lock
767d39e
Update VENDOR-LICENSE
634becd
Update vendor
7012ca8
Add README.md
d556456
Update based on running update-deps.sh
32433fb
Update based on running update-codegen.sh
330441f
Add the omited files generated by update-codegen.sh
806a843
Update README.md with NATSS configuration link
fd017f1
Add first unit tests for controller/channel
e41a19b
Update after rebase
da50050
Fix missed import in test
809615f
Solve some of requested changes
a38e62b
Unsubscribe NATSS subscriptions if the related channel is simply deleted
7df51d4
Update unit tests to not use finalizers
6d4428c
Run NATS Streaming in "natss" namespace instead of "knative-eventing"…
1ac2018
Add more unit tests
c9a70e2
Update after rebase
98807bf
Update based on running update-deps.sh
aff8faa
Add test "Update Subscriptions" for dispatcher
961082b
Update after running update-deps.sh
ad8b23c
Move NATS Streaming installation in a subdirectory.
6dc52bc
Add subscription's namespace to DispatchDefault at calling DispatchMe…
f188a52
Use channel's finalizer to cleanup NATSS subscriptions
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # NATS Streaming Channels | ||
|
|
||
|
|
||
| ### Deployment steps: | ||
|
|
||
| 1. Setup [Knative Eventing](../../../DEVELOPMENT.md). | ||
| 1. If not done already, install a [NATS Streaming](natss) | ||
| 1. Apply the 'natss' ClusterChannelProvisioner, Controller, and Dispatcher. | ||
| ```shell | ||
| ko apply -f config/provisioners/natss/provisioner.yaml | ||
| ```` | ||
| 1. Create Channels that reference the 'natss'. | ||
|
|
||
| ```yaml | ||
| apiVersion: eventing.knative.dev/v1alpha1 | ||
| kind: Channel | ||
| metadata: | ||
| name: foo | ||
| spec: | ||
| provisioner: | ||
| apiVersion: eventing.knative.dev/v1alpha1 | ||
| kind: ClusterChannelProvisioner | ||
| name: natss | ||
| ``` | ||
|
|
||
| ### Components | ||
|
|
||
| The major components are: | ||
| * NATS Streaming | ||
| * ClusterChannelProvisioner Controller | ||
| * Channel Controller | ||
| * Channel Dispatcher | ||
|
|
||
| The ClusterChannelProvisioner Controller and the Channel Controller are colocated in one Pod. | ||
| ```shell | ||
| kubectl get deployment -n knative-eventing natss-controller | ||
| ``` | ||
|
|
||
| The Channel Dispatcher receives and distributes all events. There is a single Dispatcher for all | ||
| natss Channels. | ||
| ```shell | ||
| kubectl get deployment -n knative-eventing natss-dispatcher | ||
| ``` | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # NATS Streaming - simple installation | ||
|
|
||
| 1. For an installation of a simple NATS Streaming server, a setup is provided: | ||
| ```sbtshell | ||
| kubectl create namespace natss | ||
| kubectl label namespace natss istio-injection=enabled | ||
| kubectl apply -n natss -f config/provisioners/natss/natss/natss.yaml | ||
| ``` | ||
| NATS Streaming is deployed as a StatefulSet, using "nats-streaming" ConfigMap in the namespace "natss". | ||
|
|
||
| For tuning NATS Streaming, see: | ||
| https://github.com/nats-io/nats-streaming-server#configuring |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| labels: | ||
| app: nats-streaming | ||
| name: nats-streaming | ||
| namespace: natss | ||
| data: | ||
| gnatsd.conf: | | ||
| # configuration file used to override default NATS server settings | ||
| stan.conf: | | ||
| # content of configuration file used to override default NATS Streaming server settings | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: nats-streaming | ||
| namespace: natss | ||
| labels: | ||
| app: nats-streaming | ||
| spec: | ||
| type: ClusterIP | ||
| ports: | ||
| - name: client | ||
| port: 4222 | ||
| protocol: TCP | ||
| targetPort: client | ||
| selector: | ||
| app: nats-streaming | ||
| sessionAffinity: None | ||
| --- | ||
| apiVersion: apps/v1beta1 | ||
| kind: StatefulSet | ||
| metadata: | ||
| name: nats-streaming | ||
| namespace: natss | ||
| labels: | ||
| app: nats-streaming | ||
| spec: | ||
| serviceName: nats-streaming | ||
| replicas: 1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does 1 replica have durability implications? Can this number be changed on the fly? |
||
| selector: | ||
| matchLabels: | ||
| app: nats-streaming | ||
| template: | ||
| metadata: | ||
| annotations: | ||
| sidecar.istio.io/inject: "true" | ||
| labels: | ||
| app: nats-streaming | ||
| spec: | ||
| containers: | ||
| - name: nats-streaming | ||
| image: nats-streaming:0.11.0 | ||
| imagePullPolicy: IfNotPresent | ||
| args: | ||
| - -D | ||
| - -SD | ||
| - --cluster_id=knative-nats-streaming | ||
| - --http_port=8222 | ||
| - --max_age=24h | ||
| - --store=FILE | ||
| - --dir=/var/lib/nats-streaming/core-nats-streaming/$(POD_NAME) | ||
| - --port=4222 | ||
| - --config=/etc/nats-streaming/core-nats-streaming/gnatsd.conf | ||
| - --stan_config=/etc/nats-streaming/core-nats-streaming/stan.conf | ||
| env: | ||
| - name: POD_NAME | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: metadata.name | ||
| ports: | ||
| - containerPort: 4222 | ||
| name: client | ||
| protocol: TCP | ||
| - containerPort: 8222 | ||
| name: monitoring | ||
| protocol: TCP | ||
| volumeMounts: | ||
| - mountPath: /var/lib/nats-streaming/core-nats-streaming | ||
| name: datadir | ||
| - mountPath: /etc/nats-streaming/core-nats-streaming | ||
| name: config-volume | ||
| resources: | ||
| requests: | ||
| cpu: "100m" | ||
| limits: | ||
| memory: "32M" | ||
| volumes: | ||
| - configMap: | ||
| name: nats-streaming | ||
| name: config-volume | ||
| volumeClaimTemplates: | ||
| - metadata: | ||
| name: datadir | ||
| spec: | ||
| accessModes: | ||
| - "ReadWriteOnce" | ||
| resources: | ||
| requests: | ||
| storage: "1Gi" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth providing a quick overview here of the benefits of NATS Streaming:
Approx throughput?
Durability / chance of data loss?
Resource requirements?
Ordering guarantees?