-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add config for namespace-scoped in-mem channel (#2555)
* add config for namespace-scoped in-mem channel * fix link * add warning about having only one in-mem controller installed * code review changes * fix build * add cleanup instruction
- Loading branch information
1 parent
72cee55
commit 2f88069
Showing
16 changed files
with
270 additions
and
28 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
config/channels/in-memory-channel-ns/100-config-event-dispatcher.yaml
This file contains 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 @@ | ||
../in-memory-channel/100-config-event-dispatcher.yaml |
1 change: 1 addition & 0 deletions
1
config/channels/in-memory-channel-ns/200-addressable-resolver-clusterrole.yaml
This file contains 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 @@ | ||
../in-memory-channel/200-addressable-resolver-clusterrole.yaml |
1 change: 1 addition & 0 deletions
1
config/channels/in-memory-channel-ns/200-channelable-manipulator-clusterrole.yaml
This file contains 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 @@ | ||
../in-memory-channel/200-channelable-manipulator-clusterrole.yaml |
90 changes: 90 additions & 0 deletions
90
config/channels/in-memory-channel-ns/200-controller-clusterrole.yaml
This file contains 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,90 @@ | ||
# Copyright 2019 The Knative Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: imc-controller | ||
labels: | ||
eventing.knative.dev/release: devel | ||
rules: | ||
- apiGroups: | ||
- messaging.knative.dev | ||
resources: | ||
- inmemorychannels | ||
- inmemorychannels/status | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- update | ||
- apiGroups: | ||
- messaging.knative.dev | ||
resources: | ||
- inmemorychannels/finalizers | ||
verbs: | ||
- update | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- services | ||
- serviceaccounts | ||
verbs: &everything | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- update | ||
- patch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- endpoints | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "rbac.authorization.k8s.io" | ||
resources: | ||
- rolebindings | ||
verbs: *everything | ||
- apiGroups: | ||
- apps | ||
resources: | ||
- deployments | ||
verbs: *everything | ||
- apiGroups: | ||
- apps | ||
resources: | ||
- deployments/status | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- configmaps | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- events | ||
verbs: | ||
- create | ||
- patch |
1 change: 1 addition & 0 deletions
1
config/channels/in-memory-channel-ns/200-dispatcher-clusterrole.yaml
This file contains 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 @@ | ||
../in-memory-channel/200-dispatcher-clusterrole.yaml |
This file contains 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 @@ | ||
../in-memory-channel/200-serviceaccount.yaml |
1 change: 1 addition & 0 deletions
1
config/channels/in-memory-channel-ns/201-clusterrolebinding.yaml
This file contains 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 @@ | ||
../in-memory-channel/201-clusterrolebinding.yaml |
1 change: 1 addition & 0 deletions
1
config/channels/in-memory-channel-ns/300-in-memory-channel.yaml
This file contains 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 @@ | ||
../in-memory-channel/300-in-memory-channel.yaml |
This file contains 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,59 @@ | ||
# Copyright 2019 The Knative Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: imc-controller | ||
namespace: knative-eventing | ||
labels: | ||
eventing.knative.dev/release: devel | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: &labels | ||
messaging.knative.dev/channel: in-memory-channel | ||
messaging.knative.dev/role: controller | ||
template: | ||
metadata: | ||
labels: *labels | ||
spec: | ||
serviceAccountName: imc-controller | ||
containers: | ||
- name: controller | ||
image: knative.dev/eventing/cmd/in_memory/channel_controller | ||
|
||
env: | ||
- name: CONFIG_LOGGING_NAME | ||
value: config-logging | ||
- name: CONFIG_OBSERVABILITY_NAME | ||
value: config-observability | ||
- name: METRICS_DOMAIN | ||
value: knative.dev/inmemorychannel-controller | ||
- name: SYSTEM_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: DISPATCHER_SCOPE | ||
value: namespace | ||
- name: DISPATCHER_IMAGE | ||
value: knative.dev/eventing/cmd/in_memory/channel_dispatcher | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
|
||
ports: | ||
- name: metrics | ||
containerPort: 9090 | ||
- name: profiling | ||
containerPort: 8008 |
This file contains 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,60 @@ | ||
# Namespace-Scoped In-Memory Channels | ||
|
||
Namespace-scoped in-memory channels share the same characteristics as the | ||
[in-memory channels](../in-memory-channel/README.md). The only difference is the in-memory | ||
dispatcher is installed in the same namespace as the channel. | ||
|
||
### Deployment steps: | ||
|
||
1. Setup [Knative Eventing](../../../DEVELOPMENT.md). | ||
1. Apply the `InMemoryChannel` CRD and controller. | ||
```shell | ||
ko apply -f config/channels/in-memory-channel-ns | ||
``` | ||
1. Create InMemoryChannels | ||
|
||
```sh | ||
kubectl apply --filename - << END | ||
apiVersion: messaging.knative.dev/v1alpha1 | ||
kind: InMemoryChannel | ||
metadata: | ||
name: foo | ||
END | ||
``` | ||
IMPORTANT: make sure you don't have the [cluster-scoped in-memory channels](../in-memory-channel/README.md) | ||
configuration deployed in your cluster. Pick one or the other, but not both at the same time! | ||
### Components | ||
The major components are: | ||
- InMemoryChannel Controller | ||
- InMemoryChannel Dispatcher | ||
```shell | ||
kubectl get deployment -n knative-eventing imc-controller | ||
``` | ||
The InMemoryChannel Dispatcher receives and distributes all events. There is | ||
one Dispatcher per namespace. | ||
```shell | ||
kubectl get deployment -n default imc-dispatcher | ||
``` | ||
### Cleanup | ||
To remove the in-memory channel component, do: | ||
```shell | ||
kubectl delete -f config/channels/in-memory-channel-ns | ||
``` | ||
To remove the InMemoryChannel Dispatcher deployments, do: | ||
```shell | ||
kubectl delete deployments imc-dispatcher | ||
``` | ||
in all namespaces you installed channels. |
21 changes: 21 additions & 0 deletions
21
config/channels/in-memory-channel/200-dispatcher-serviceaccount.yaml
This file contains 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,21 @@ | ||
# Copyright 2020 The Knative Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: imc-dispatcher | ||
namespace: knative-eventing | ||
labels: | ||
eventing.knative.dev/release: devel |
This file contains 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 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
29 changes: 29 additions & 0 deletions
29
config/channels/in-memory-channel/201-dispatcher-clusterrolebinding.yaml
This file contains 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,29 @@ | ||
# Copyright 2020 The Knative Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: imc-dispatcher | ||
labels: | ||
eventing.knative.dev/release: devel | ||
subjects: | ||
- kind: ServiceAccount | ||
name: imc-dispatcher | ||
namespace: knative-eventing | ||
roleRef: | ||
kind: ClusterRole | ||
name: imc-dispatcher | ||
apiGroup: rbac.authorization.k8s.io | ||
|
This file contains 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 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