diff --git a/cmd/in_memory/dispatcher/main.go b/cmd/in_memory/dispatcher/main.go index 72f135ae61f..2fac315d54d 100644 --- a/cmd/in_memory/dispatcher/main.go +++ b/cmd/in_memory/dispatcher/main.go @@ -51,7 +51,7 @@ var ( readTimeout = 1 * time.Minute writeTimeout = 1 * time.Minute port = 8080 - channelProvisioners = []string{"in-memory", "in-memory-channel"} + channelProvisioners = []string{"in-memory"} ) func main() { diff --git a/config/provisioners/in-memory-channel/README.md b/config/provisioners/in-memory-channel/README.md index 6e9dad56bfd..bb47a26328a 100644 --- a/config/provisioners/in-memory-channel/README.md +++ b/config/provisioners/in-memory-channel/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 ``` -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 @@ -59,10 +59,3 @@ Dispatcher for all in-memory Channels. ```shell kubectl get deployment -n knative-eventing in-memory-channel-dispatcher ``` - -The Channel Dispatcher Config Map is used to send information about Channels and -Subscriptions from the Channel Controller to the Channel Dispatcher. - -```shell -kubectl get configmap -n knative-eventing in-memory-channel-dispatcher-config-map -``` diff --git a/config/provisioners/in-memory-channel/in-memory-channel.yaml b/config/provisioners/in-memory-channel/in-memory-channel.yaml index d69a6dab470..45728a83f61 100644 --- a/config/provisioners/in-memory-channel/in-memory-channel.yaml +++ b/config/provisioners/in-memory-channel/in-memory-channel.yaml @@ -20,14 +20,6 @@ spec: {} --- -apiVersion: eventing.knative.dev/v1alpha1 -kind: ClusterChannelProvisioner -metadata: - name: in-memory-channel -spec: {} - ---- - apiVersion: v1 kind: ServiceAccount metadata: @@ -69,14 +61,6 @@ rules: - list - watch - create - - apiGroups: - - "" # Core API group. - resources: - - services - resourceNames: - - in-memory-channel-clusterbus - verbs: - - delete - apiGroups: - "" # Core API group. resources: diff --git a/pkg/provisioners/inmemory/channel/controller.go b/pkg/provisioners/inmemory/channel/controller.go index 88f0e96233f..7a29e6cf109 100644 --- a/pkg/provisioners/inmemory/channel/controller.go +++ b/pkg/provisioners/inmemory/channel/controller.go @@ -32,7 +32,7 @@ const ( controllerAgentName = "in-memory-channel-controller" ) -// ProvideController returns a Controller that represents the in-memory-channel Provisioner. +// ProvideController returns a Controller that represents the in-memory 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/provisioners/inmemory/channel/reconcile.go b/pkg/provisioners/inmemory/channel/reconcile.go index e35dc1adea9..2a9b5a4bd97 100644 --- a/pkg/provisioners/inmemory/channel/reconcile.go +++ b/pkg/provisioners/inmemory/channel/reconcile.go @@ -128,10 +128,6 @@ func (r *reconciler) reconcile(ctx context.Context, c *eventingv1alpha1.Channel) c.Status.InitializeConditions() - if usesDeprecatedProvisioner(c) { - c.Status.MarkDeprecated("ClusterChannelProvisionerDeprecated", "The `in-memory-channel` ClusterChannelProvisioner is deprecated and will be removed in 0.7. Recommended replacement is `in-memory`.") - } - // We are syncing K8s Service to talk to this Channel. svc, err := util.CreateK8sService(ctx, r.client, c, util.ExternalService(c)) if err != nil { @@ -145,9 +141,3 @@ func (r *reconciler) reconcile(ctx context.Context, c *eventingv1alpha1.Channel) c.Status.MarkProvisioned() return nil } - -func usesDeprecatedProvisioner(c *eventingv1alpha1.Channel) bool { - return c.Spec.Provisioner != nil && - c.Spec.Provisioner.Namespace == "" && - c.Spec.Provisioner.Name == "in-memory-channel" -} diff --git a/pkg/provisioners/inmemory/channel/reconcile_test.go b/pkg/provisioners/inmemory/channel/reconcile_test.go index 495b0b4fee9..38f393b1c0f 100644 --- a/pkg/provisioners/inmemory/channel/reconcile_test.go +++ b/pkg/provisioners/inmemory/channel/reconcile_test.go @@ -44,8 +44,7 @@ import ( ) const ( - ccpName = "in-memory-channel" - asyncCCPName = "in-memory" + ccpName = "in-memory" cNamespace = "test-namespace" cName = "test-channel" diff --git a/pkg/provisioners/inmemory/clusterchannelprovisioner/reconcile.go b/pkg/provisioners/inmemory/clusterchannelprovisioner/reconcile.go index 678c544d46a..59482208de1 100644 --- a/pkg/provisioners/inmemory/clusterchannelprovisioner/reconcile.go +++ b/pkg/provisioners/inmemory/clusterchannelprovisioner/reconcile.go @@ -18,21 +18,18 @@ package clusterchannelprovisioner import ( "context" - "fmt" "go.uber.org/zap" corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" eventingv1alpha1 "github.com/knative/eventing/pkg/apis/eventing/v1alpha1" util "github.com/knative/eventing/pkg/provisioners" - "github.com/knative/pkg/system" ) const ( @@ -48,7 +45,7 @@ const ( var ( // provisionerNames contains the list of provisioners' names served by this controller - provisionerNames = []string{"in-memory-channel", "in-memory"} + provisionerNames = []string{"in-memory"} ) type reconciler struct { @@ -66,7 +63,7 @@ func (r *reconciler) InjectClient(c client.Client) error { } func (r *reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) { - //TODO use this to store the logger and set a deadline + // TODO use this to store the logger and set a deadline ctx := context.TODO() logger := r.logger.With(zap.Any("request", request)) @@ -167,42 +164,15 @@ 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) - // that was created previously in version 0.2.0 to ensure backwards compatibility. - err = r.deleteOldDispatcherService(ctx, ccp) - if err != nil { - logger.Info("Error deleting the old ClusterChannelProvisioner's K8s Service", zap.Error(err)) - r.recorder.Eventf(ccp, corev1.EventTypeWarning, k8sServiceDeleteFailed, "Failed to delete the old ClusterChannelProvisioner's K8s Service: %v", err) - return err - } - ccp.Status.MarkReady() return nil } -// Since there are two provisioners "in-memory" and "in-memory-channel" but one single dispatcher service deployment, -// update the label of the K8s service to always point at the same dispatcher service deployment func setDispatcherServiceSelector() util.ServiceOption { return func(svc *v1.Service) error { + // There used to be an "in-memory-channel" provisioner. It was removed in 0.7, but it was + // the original, so the dispatcher is still labeled with its name. svc.Spec.Selector = util.DispatcherLabels("in-memory-channel") return nil } } - -func (r *reconciler) deleteOldDispatcherService(ctx context.Context, ccp *eventingv1alpha1.ClusterChannelProvisioner) error { - svcName := fmt.Sprintf("%s-clusterbus", ccp.Name) - svcKey := types.NamespacedName{ - Namespace: system.Namespace(), - Name: svcName, - } - svc := &corev1.Service{} - err := r.client.Get(ctx, svcKey, svc) - if err != nil { - if errors.IsNotFound(err) { - return nil - } - return err - } - - return r.client.Delete(ctx, svc) -} diff --git a/pkg/provisioners/inmemory/clusterchannelprovisioner/reconcile_test.go b/pkg/provisioners/inmemory/clusterchannelprovisioner/reconcile_test.go index 9d8934d0c61..713fed69082 100644 --- a/pkg/provisioners/inmemory/clusterchannelprovisioner/reconcile_test.go +++ b/pkg/provisioners/inmemory/clusterchannelprovisioner/reconcile_test.go @@ -40,11 +40,11 @@ import ( ) const ( - ccpUID = "test-uid" - testErrorMessage = "test-induced-error" - testNS = "test-ns" - inMemoryChannelName = "in-memory-channel" - inMemoryName = "in-memory" + ccpUID = "test-uid" + testErrorMessage = "test-induced-error" + testNS = "test-ns" + dispatcherPodLabel = "in-memory-channel" + inMemoryName = "in-memory" ) var ( @@ -65,8 +65,8 @@ var ( func init() { // Add types to scheme - eventingv1alpha1.AddToScheme(scheme.Scheme) - corev1.AddToScheme(scheme.Scheme) + _ = eventingv1alpha1.AddToScheme(scheme.Scheme) + _ = corev1.AddToScheme(scheme.Scheme) } func TestInjectClient(t *testing.T) { @@ -198,23 +198,6 @@ func TestReconcile(t *testing.T) { events[ccpReconciled], }, }, - { - Name: "Delete old dispatcher", - InitialState: []runtime.Object{ - makeClusterChannelProvisioner(), - makeOldK8sService(), - }, - WantPresent: []runtime.Object{ - makeReadyClusterChannelProvisioner(), - makeK8sService(), - }, - WantAbsent: []runtime.Object{ - makeOldK8sService(), - }, - WantEvent: []corev1.Event{ - events[ccpReconciled], - }, - }, { Name: "Create dispatcher - not owned by CCP", InitialState: []runtime.Object{ @@ -241,20 +224,6 @@ func TestReconcile(t *testing.T) { events[ccpReconciled], }, }, - { - Name: "Create dispatcher succeeds - in-memory-Channel", - ReconcileKey: inMemoryChannelName, - InitialState: []runtime.Object{ - makeClusterChannelProvisionerOld(), - }, - WantPresent: []runtime.Object{ - makeReadyClusterChannelProvisionerOld(), - makeK8sServiceOld(), - }, - WantEvent: []corev1.Event{ - events[ccpReconciled], - }, - }, { Name: "Create dispatcher succeeds - request is namespace-scoped", InitialState: []runtime.Object{ @@ -319,12 +288,6 @@ func TestReconcile(t *testing.T) { } } -func makeClusterChannelProvisionerOld() *eventingv1alpha1.ClusterChannelProvisioner { - ccp := makeClusterChannelProvisioner() - ccp.SetName(inMemoryChannelName) - return ccp -} - func makeClusterChannelProvisioner() *eventingv1alpha1.ClusterChannelProvisioner { return &eventingv1alpha1.ClusterChannelProvisioner{ TypeMeta: metav1.TypeMeta{ @@ -349,12 +312,6 @@ func makeReadyClusterChannelProvisioner() *eventingv1alpha1.ClusterChannelProvis return ccp } -func makeReadyClusterChannelProvisionerOld() *eventingv1alpha1.ClusterChannelProvisioner { - ccp := makeReadyClusterChannelProvisioner() - ccp.Name = inMemoryChannelName - return ccp -} - func makeDeletingClusterChannelProvisioner() *eventingv1alpha1.ClusterChannelProvisioner { ccp := makeClusterChannelProvisioner() ccp.DeletionTimestamp = &deletionTime @@ -383,7 +340,7 @@ func makeK8sService() *corev1.Service { Labels: util.DispatcherLabels(inMemoryName), }, Spec: corev1.ServiceSpec{ - Selector: util.DispatcherLabels(inMemoryChannelName), + Selector: util.DispatcherLabels(dispatcherPodLabel), Ports: []corev1.ServicePort{ { Port: 80, @@ -395,20 +352,6 @@ func makeK8sService() *corev1.Service { } } -func makeK8sServiceOld() *corev1.Service { - svc := makeK8sService() - svc.SetName(fmt.Sprintf("%s-dispatcher", inMemoryChannelName)) - svc.GetOwnerReferences()[0].Name = inMemoryChannelName - svc.SetLabels(util.DispatcherLabels(inMemoryChannelName)) - return svc -} - -func makeOldK8sService() *corev1.Service { - svc := makeK8sService() - svc.ObjectMeta.Name = fmt.Sprintf("%s-clusterbus", inMemoryName) - return svc -} - func makeK8sServiceNotOwnedByClusterChannelProvisioner() *corev1.Service { svc := makeK8sService() svc.OwnerReferences = nil diff --git a/pkg/provisioners/multichannelfanout/config.go b/pkg/provisioners/multichannelfanout/config.go index 21e9fbc60c1..f87c19ac58d 100644 --- a/pkg/provisioners/multichannelfanout/config.go +++ b/pkg/provisioners/multichannelfanout/config.go @@ -44,18 +44,9 @@ func NewConfigFromChannels(channels []v1alpha1.Channel) *Config { Name: c.Name, HostName: c.Status.Address.Hostname, } - - asyncHandler := true - // This is fairly hacky, but this is expected to change from a generic fanout sidecar to the - // in-memory dispatcher. And `in-memory-channel` is to be deleted in 0.7, so this shouldn't - // be here for long. - if c.Spec.Provisioner != nil && c.Spec.Provisioner.Name == "in-memory-channel" { - asyncHandler = false - } - if c.Spec.Subscribable != nil { channelConfig.FanoutConfig = fanout.Config{ - AsyncHandler: asyncHandler, + AsyncHandler: true, Subscriptions: c.Spec.Subscribable.Subscribers, } } diff --git a/pkg/provisioners/multichannelfanout/config_test.go b/pkg/provisioners/multichannelfanout/config_test.go index 51cd8f03a35..f0cdbc3420c 100644 --- a/pkg/provisioners/multichannelfanout/config_test.go +++ b/pkg/provisioners/multichannelfanout/config_test.go @@ -110,30 +110,6 @@ func TestNewConfigFromChannels(t *testing.T) { }, }, }, - }, { - name: "in-memory-channel provisioner -- synchronous", - channels: []v1alpha1.Channel{ - withProvisioner( - makeChannel("chan-1", "ns-1", "a.b.c.d", makeSubscribable(makeSubscriber("sub1"))), - &v1.ObjectReference{ - Name: "in-memory-channel", - }), - }, - expected: &Config{ - ChannelConfigs: []ChannelConfig{ - { - Name: "chan-1", - Namespace: "ns-1", - HostName: "a.b.c.d", - FanoutConfig: fanout.Config{ - AsyncHandler: false, - Subscriptions: []eventingduck.ChannelSubscriberSpec{ - makeSubscriber("sub1"), - }, - }, - }, - }, - }, }, } @@ -168,9 +144,9 @@ func withProvisioner(c v1alpha1.Channel, p *v1.ObjectReference) v1alpha1.Channel return c } -func makeSubscribable(subsriberSpec ...eventingduck.ChannelSubscriberSpec) *eventingduck.Subscribable { +func makeSubscribable(subscriberSpec ...eventingduck.ChannelSubscriberSpec) *eventingduck.Subscribable { return &eventingduck.Subscribable{ - Subscribers: subsriberSpec, + Subscribers: subscriberSpec, } } diff --git a/test/README.md b/test/README.md index 9e30d974359..669af203c3f 100644 --- a/test/README.md +++ b/test/README.md @@ -88,7 +88,7 @@ If you want to run tests against other `ClusterChannelProvisioners`, you can specify them through `-clusterChannelProvisioners`. ```bash -go test -v -tags=e2e -count=1 ./test/e2e -run ^TestMain$ -runFromMain=true -clusterChannelProvisioners=in-memory-channel,gcp-pubsub +go test -v -tags=e2e -count=1 ./test/e2e -run ^TestMain$ -runFromMain=true -clusterChannelProvisioners=in-memory,gcp-pubsub ``` #### One test case @@ -108,7 +108,7 @@ specify it through `-clusterChannelProvisioners`. Note that you can only specify one `ClusterChannelProvisioner` if you are not running from `TestMain`. ```bash -go test -v -tags=e2e -count=1 ./test/e2e -run ^TestSingleBinaryEvent$ -clusterChannelProvisioners=in-memory-channel +go test -v -tags=e2e -count=1 ./test/e2e -run ^TestSingleBinaryEvent$ -clusterChannelProvisioners=in-memory ``` ## Environment requirements diff --git a/test/constants.go b/test/constants.go index c5b68f78289..a5579bf5abc 100644 --- a/test/constants.go +++ b/test/constants.go @@ -22,10 +22,6 @@ const ( // DefaultClusterChannelProvisioner is the default ClusterChannelProvisioner we will run tests against. DefaultClusterChannelProvisioner = InMemoryProvisioner - // InMemoryChannelProvisioner is the in-memory-channel provisioner. - // It will be delete in 0.7, see https://github.com/knative/eventing/pull/1062 for more info. - InMemoryChannelProvisioner = "in-memory-channel" - // InMemoryProvisioner is the in-memory provisioner, which is also the default one. InMemoryProvisioner = "in-memory" // GCPPubSubProvisioner is the gcp-pubsub provisioner, which is under contrib/gcppubsub. @@ -38,7 +34,6 @@ const ( // validProvisioners is a list of provisioners that Eventing currently support. var validProvisioners = []string{ - InMemoryChannelProvisioner, InMemoryProvisioner, GCPPubSubProvisioner, KafkaProvisioner, diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index b165680f162..8ba1ef46327 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -211,6 +211,6 @@ function dump_extra_cluster_state() { initialize $@ --skip-istio-addon -go_test_e2e -timeout=20m ./test/e2e -run ^TestMain$ -runFromMain=true -clusterChannelProvisioners=in-memory-channel,in-memory,natss,kafka || fail_test +go_test_e2e -timeout=20m ./test/e2e -run ^TestMain$ -runFromMain=true -clusterChannelProvisioners=in-memory,natss,kafka || fail_test success diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index a9928584490..61d86adea3a 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -36,13 +36,6 @@ var channelTestMap = map[string][]func(t *testing.T){ TestDefaultBrokerWithManyTriggers, TestEventTransformationForTrigger, }, - test.InMemoryChannelProvisioner: { - TestSingleBinaryEvent, - TestSingleStructuredEvent, - TestEventTransformation, - TestChannelChain, - TestEventTransformationForTrigger, - }, test.GCPPubSubProvisioner: { TestSingleBinaryEvent, TestSingleStructuredEvent,