From 433d82f8ca5854fd66ba1175935ae0073a104e30 Mon Sep 17 00:00:00 2001 From: Serguei Bezverkhi Date: Fri, 4 Jan 2019 18:24:07 -0500 Subject: [PATCH 1/3] rename in-memory channel Signed-off-by: Serguei Bezverkhi --- .../README.md | 12 +++--- .../in-memoryl.yaml} | 39 ++++++++++--------- .../eventing/inmemory/channel/controller.go | 6 ++- .../inmemory/channel/reconcile_test.go | 4 +- .../clusterchannelprovisioner/reconcile.go | 4 +- 5 files changed, 35 insertions(+), 30 deletions(-) rename config/provisioners/{in-memory-channel => in-memory}/README.md (80%) rename config/provisioners/{in-memory-channel/in-memory-channel.yaml => in-memory/in-memoryl.yaml} (83%) diff --git a/config/provisioners/in-memory-channel/README.md b/config/provisioners/in-memory/README.md similarity index 80% rename from config/provisioners/in-memory-channel/README.md rename to config/provisioners/in-memory/README.md index 6e9dad56bfd..cee1f92fb3b 100644 --- a/config/provisioners/in-memory-channel/README.md +++ b/config/provisioners/in-memory/README.md @@ -18,12 +18,12 @@ They differ from most Channels in that they have: ### Deployment steps: 1. Setup [Knative Eventing](../../../DEVELOPMENT.md). -1. Apply the 'in-memory-channel' ClusterChannelProvisioner, Controller, and +1. Apply the 'in-memory' ClusterChannelProvisioner, Controller, and Dispatcher. ```shell - ko apply -f config/provisioners/in-memory-channel/in-memory-channel.yaml + ko apply -f config/provisioners/in-memory/in-memory.yaml ``` -1. Create Channels that reference the 'in-memory-channel'. +1. Create Channels that reference the 'in-memory'. ```yaml apiVersion: eventing.knative.dev/v1alpha1 @@ -34,7 +34,7 @@ They differ from most Channels in that they have: provisioner: apiVersion: eventing.knative.dev/v1alpha1 kind: ClusterChannelProvisioner - name: in-memory-channel + name: in-memory ``` ### Components @@ -50,14 +50,14 @@ The ClusterChannelProvisioner Controller and the Channel Controller are colocated in one Pod. ```shell -kubectl get deployment -n knative-eventing in-memory-channel-controller +kubectl get deployment -n knative-eventing in-memory-controller ``` The Channel Dispatcher receives and distributes all events. There is a single Dispatcher for all in-memory Channels. ```shell -kubectl get deployment -n knative-eventing in-memory-channel-dispatcher +kubectl get deployment -n knative-eventing in-memory-dispatcher ``` The Channel Dispatcher Config Map is used to send information about Channels and diff --git a/config/provisioners/in-memory-channel/in-memory-channel.yaml b/config/provisioners/in-memory/in-memoryl.yaml similarity index 83% rename from config/provisioners/in-memory-channel/in-memory-channel.yaml rename to config/provisioners/in-memory/in-memoryl.yaml index a2689acb54b..8acef3a0051 100644 --- a/config/provisioners/in-memory-channel/in-memory-channel.yaml +++ b/config/provisioners/in-memory/in-memoryl.yaml @@ -15,7 +15,7 @@ apiVersion: eventing.knative.dev/v1alpha1 kind: ClusterChannelProvisioner metadata: - name: in-memory-channel + name: in-memory spec: {} --- @@ -23,7 +23,7 @@ spec: {} apiVersion: v1 kind: ServiceAccount metadata: - name: in-memory-channel-controller + name: in-memory-controller namespace: knative-eventing --- @@ -31,7 +31,7 @@ metadata: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: in-memory-channel-controller + name: in-memory-controller rules: - apiGroups: - eventing.knative.dev @@ -64,7 +64,7 @@ rules: resources: - services resourceNames: - - in-memory-channel-clusterbus + - in-memory-clusterbus verbs: - delete - apiGroups: @@ -78,7 +78,9 @@ rules: resources: - configmaps resourceNames: +# Preserving ConfigMap name for the backward compatibility - in-memory-channel-dispatcher-config-map + - in-memory-dispatcher-config-map verbs: - update - apiGroups: @@ -97,15 +99,15 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: in-memory-channel-controller + name: in-memory-controller namespace: knative-eventing subjects: - kind: ServiceAccount - name: in-memory-channel-controller + name: in-memory-controller namespace: knative-eventing roleRef: kind: ClusterRole - name: in-memory-channel-controller + name: in-memory-controller apiGroup: rbac.authorization.k8s.io --- @@ -113,19 +115,19 @@ roleRef: apiVersion: apps/v1 kind: Deployment metadata: - name: in-memory-channel-controller + name: in-memory-controller namespace: knative-eventing spec: replicas: 1 selector: matchLabels: &labels - clusterChannelProvisioner: in-memory-channel + clusterChannelProvisioner: in-memory role: controller template: metadata: labels: *labels spec: - serviceAccountName: in-memory-channel-controller + serviceAccountName: in-memory-controller containers: - name: controller image: github.com/knative/eventing/pkg/controller/eventing/inmemory/controller @@ -135,7 +137,7 @@ spec: apiVersion: v1 kind: ServiceAccount metadata: - name: in-memory-channel-dispatcher + name: in-memory-dispatcher namespace: knative-eventing --- @@ -143,7 +145,7 @@ metadata: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: in-memory-channel-dispatcher + name: in-memory-dispatcher namespace: knative-eventing rules: - apiGroups: @@ -160,15 +162,15 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: in-memory-channel-dispatcher + name: in-memory-dispatcher namespace: knative-eventing subjects: - kind: ServiceAccount - name: in-memory-channel-dispatcher + name: in-memory-dispatcher namespace: knative-eventing roleRef: kind: ClusterRole - name: in-memory-channel-dispatcher + name: in-memory-dispatcher apiGroup: rbac.authorization.k8s.io --- @@ -176,13 +178,13 @@ roleRef: apiVersion: apps/v1 kind: Deployment metadata: - name: in-memory-channel-dispatcher + name: in-memory-dispatcher namespace: knative-eventing spec: replicas: 1 selector: matchLabels: &labels - clusterChannelProvisioner: in-memory-channel + clusterChannelProvisioner: in-memory role: dispatcher template: metadata: @@ -190,7 +192,7 @@ spec: sidecar.istio.io/inject: "true" labels: *labels spec: - serviceAccountName: in-memory-channel-dispatcher + serviceAccountName: in-memory-dispatcher containers: - name: dispatcher image: github.com/knative/eventing/cmd/fanoutsidecar @@ -198,4 +200,5 @@ spec: - --sidecar_port=8080 - --config_map_noticer=watcher - --config_map_namespace=knative-eventing +# Preserving ConfigMap name for the backward compatibility - --config_map_name=in-memory-channel-dispatcher-config-map diff --git a/pkg/controller/eventing/inmemory/channel/controller.go b/pkg/controller/eventing/inmemory/channel/controller.go index b139d622f2a..494df322b27 100644 --- a/pkg/controller/eventing/inmemory/channel/controller.go +++ b/pkg/controller/eventing/inmemory/channel/controller.go @@ -32,7 +32,9 @@ import ( const ( // controllerAgentName is the string used by this controller to identify // itself when creating events. - controllerAgentName = "in-memory-channel-controller" + controllerAgentName = "in-memory-controller" + + // TODO, change configmap name to "in-memory-dispatcher-config-map" post 0.4.0 // ConfigMapName is the name of the ConfigMap in the knative-eventing namespace that contains // the subscription information for all in-memory Channels. The Provisioner writes to it and the @@ -47,7 +49,7 @@ var ( } ) -// ProvideController returns a Controller that represents the in-memory-channel Provisioner. +// ProvideController returns a Controller that represents the in-memory channels Provisioner. func ProvideController(mgr manager.Manager, logger *zap.Logger) (controller.Controller, error) { // Setup a new controller to Reconcile Channels that belong to this Cluster Provisioner // (in-memory channels). diff --git a/pkg/controller/eventing/inmemory/channel/reconcile_test.go b/pkg/controller/eventing/inmemory/channel/reconcile_test.go index 9d5ecdcb049..4ca6ebc0cc9 100644 --- a/pkg/controller/eventing/inmemory/channel/reconcile_test.go +++ b/pkg/controller/eventing/inmemory/channel/reconcile_test.go @@ -44,7 +44,7 @@ import ( ) const ( - ccpName = "in-memory-channel" + ccpName = "in-memory" cNamespace = "test-namespace" cName = "test-channel" @@ -640,7 +640,7 @@ func makeVirtualService() *istiov1alpha3.VirtualService { }, Route: []istiov1alpha3.DestinationWeight{{ Destination: istiov1alpha3.Destination{ - Host: "in-memory-channel-dispatcher.knative-eventing.svc.cluster.local", + Host: "in-memory-dispatcher.knative-eventing.svc.cluster.local", Port: istiov1alpha3.PortSelector{ Number: util.PortNumber, }, diff --git a/pkg/controller/eventing/inmemory/clusterchannelprovisioner/reconcile.go b/pkg/controller/eventing/inmemory/clusterchannelprovisioner/reconcile.go index 5eb68ef5250..73b42f27ea8 100644 --- a/pkg/controller/eventing/inmemory/clusterchannelprovisioner/reconcile.go +++ b/pkg/controller/eventing/inmemory/clusterchannelprovisioner/reconcile.go @@ -36,7 +36,7 @@ import ( const ( // Name is the name of the in-memory channel ClusterChannelProvisioner. - Name = "in-memory-channel" + Name = "in-memory" // Channel is the name of the Channel resource in eventing.knative.dev/v1alpha1. Channel = "Channel" @@ -148,7 +148,7 @@ func (r *reconciler) reconcile(ctx context.Context, ccp *eventingv1alpha1.Cluste logger.Warn("ClusterChannelProvisioner's K8s Service is not owned by the ClusterChannelProvisioner", zap.Any("clusterChannelProvisioner", ccp), zap.Any("service", svc)) } - // The name of the svc has changed since version 0.2.1. Hence, delete old dispatcher service (in-memory-channel-clusterbus) + // The name of the svc has changed since version 0.2.1. Hence, delete old dispatcher service (in-memory-clusterbus) // that was created previously in version 0.2.0 to ensure backwards compatibility. err = r.deleteOldDispatcherService(ctx, ccp) if err != nil { From ccc9e7c701602a79d89652248bcce41d95f6dd5e Mon Sep 17 00:00:00 2001 From: Serguei Bezverkhi Date: Fri, 4 Jan 2019 21:36:30 -0500 Subject: [PATCH 2/3] Fixing integration tests Signed-off-by: Serguei Bezverkhi --- config/400-default-channel-config.yaml | 2 +- .../in-memory/{in-memoryl.yaml => in-memory.yaml} | 0 hack/release.sh | 4 ++-- test/e2e-tests.sh | 6 +++--- test/e2e/k8s_events_test.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename config/provisioners/in-memory/{in-memoryl.yaml => in-memory.yaml} (100%) diff --git a/config/400-default-channel-config.yaml b/config/400-default-channel-config.yaml index cffed22d32d..9d6bd5aa519 100644 --- a/config/400-default-channel-config.yaml +++ b/config/400-default-channel-config.yaml @@ -24,7 +24,7 @@ data: clusterdefault: apiversion: eventing.knative.dev/v1alpha1 kind: ClusterChannelProvisioner - name: in-memory-channel + name: in-memory namespacedefaults: some-namespace: apiversion: eventing.knative.dev/v1alpha1 diff --git a/config/provisioners/in-memory/in-memoryl.yaml b/config/provisioners/in-memory/in-memory.yaml similarity index 100% rename from config/provisioners/in-memory/in-memoryl.yaml rename to config/provisioners/in-memory/in-memory.yaml diff --git a/hack/release.sh b/hack/release.sh index 7f242f6f8b9..b8eb5fd6a37 100755 --- a/hack/release.sh +++ b/hack/release.sh @@ -20,14 +20,14 @@ source $(dirname $0)/../vendor/github.com/knative/test-infra/scripts/release.sh declare -A COMPONENTS COMPONENTS=( ["eventing.yaml"]="config" - ["in-memory-channel.yaml"]="config/provisioners/in-memory-channel" + ["in-memory.yaml"]="config/provisioners/in-memory" ["kafka.yaml"]="config/provisioners/kafka" ) readonly COMPONENTS declare -A RELEASES RELEASES=( - ["release.yaml"]="eventing.yaml in-memory-channel.yaml" + ["release.yaml"]="eventing.yaml in-memory.yaml" ) readonly RELEASES diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index a0087ee23da..5b29986745d 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -50,7 +50,7 @@ function start_latest_eventing_sources() { function teardown() { teardown_events_test_resources -# ko delete --ignore-not-found=true -f config/provisioners/in-memory-channel/in-memory-channel.yaml +# ko delete --ignore-not-found=true -f config/provisioners/in-memory/in-memory.yaml ko delete --ignore-not-found=true -f config/ ko delete --ignore-not-found=true -f ${KNATIVE_EVENTING_SOURCES_RELEASE} @@ -104,8 +104,8 @@ ko apply -f config/ wait_until_pods_running knative-eventing header "Standing up In-Memory ClusterChannelProvisioner" -ko resolve -f config/provisioners/in-memory-channel/in-memory-channel.yaml -ko apply -f config/provisioners/in-memory-channel/in-memory-channel.yaml +ko resolve -f config/provisioners/in-memory/in-memory.yaml +ko apply -f config/provisioners/in-memory/in-memory.yaml wait_until_pods_running knative-eventing # Publish test images diff --git a/test/e2e/k8s_events_test.go b/test/e2e/k8s_events_test.go index f321f3071f4..ce2879564c1 100644 --- a/test/e2e/k8s_events_test.go +++ b/test/e2e/k8s_events_test.go @@ -31,7 +31,7 @@ const ( eventSource = "k8sevents" routeName = "e2e-k8s-events-function" channelName = "e2e-k8s-events-channel" - provisionerName = "in-memory-channel" + provisionerName = "in-memory" subscriptionName = "e2e-k8s-events-subscription" ) From fb5e4262066b4c1ea25aac3a67c7277bd62fd879 Mon Sep 17 00:00:00 2001 From: Serguei Bezverkhi Date: Sat, 5 Jan 2019 21:17:10 -0500 Subject: [PATCH 3/3] Fix the controller name Signed-off-by: Serguei Bezverkhi --- .../eventing/inmemory/clusterchannelprovisioner/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/eventing/inmemory/clusterchannelprovisioner/controller.go b/pkg/controller/eventing/inmemory/clusterchannelprovisioner/controller.go index 3518b86939c..31e97658859 100644 --- a/pkg/controller/eventing/inmemory/clusterchannelprovisioner/controller.go +++ b/pkg/controller/eventing/inmemory/clusterchannelprovisioner/controller.go @@ -29,7 +29,7 @@ import ( const ( // controllerAgentName is the string used by this controller to identify // itself when creating events. - controllerAgentName = "in-memory-channel-controller" + controllerAgentName = "in-memory-controller" ) // ProvideController returns a flow controller.