diff --git a/config/201-channelable-manipulator-clusterrole.yaml b/config/201-channelable-manipulator-clusterrole.yaml index 164b805e11..62ffe69fe9 100644 --- a/config/201-channelable-manipulator-clusterrole.yaml +++ b/config/201-channelable-manipulator-clusterrole.yaml @@ -17,7 +17,7 @@ kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: events-channel-addressable-resolver + name: cloud-run-events-channel-manipulator labels: events.cloud.run/release: devel duck.knative.dev/channelable: "true" diff --git a/pkg/pubsub/publisher/publisher.go b/pkg/pubsub/publisher/publisher.go index c864d5973f..fb71b6abe4 100644 --- a/pkg/pubsub/publisher/publisher.go +++ b/pkg/pubsub/publisher/publisher.go @@ -62,6 +62,7 @@ func (a *Publisher) Start(ctx context.Context) error { } func (a *Publisher) receive(ctx context.Context, event cloudevents.Event, resp *cloudevents.EventResponse) error { + // Upgrade to supported transport version. if event.SpecVersion() != cloudevents.VersionV03 { event.Context = event.Context.AsV03() diff --git a/test/performance/channel-latency/channel-latency-setup.yaml b/test/performance/channel-latency/channel-latency-setup.yaml new file mode 100644 index 0000000000..efa744b5d6 --- /dev/null +++ b/test/performance/channel-latency/channel-latency-setup.yaml @@ -0,0 +1,124 @@ +# 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. + +# Copy google-cloud-key secret one-liner: +# kubectl get secret google-cloud-key --namespace=default --export -o yaml | kubectl apply --namespace=perf-pubsub -f - + +# apiVersion: v1 +# kind: Namespace +# metadata: +# name: perf-pubsub + +--- + +apiVersion: v1 +kind: ConfigMap +metadata: + name: config-mako + namespace: perf-pubsub +data: + environment: dev + +--- + +apiVersion: messaging.cloud.run/v1alpha1 +kind: Channel +metadata: + name: test-channel + namespace: perf-pubsub +spec: {} + +--- + +# apiVersion: messaging.knative.dev/v1alpha1 +# kind: Subscription +# metadata: +# name: test-channel +# namespace: perf-pubsub +# spec: +# channel: +# apiVersion: messaging.cloud.run/v1alpha1 +# kind: Channel +# name: test-channel +# subscriber: +# ref: +# apiVersion: v1 +# kind: Service +# name: latency-consumer + +--- + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: perf-pubsub + namespace: perf-pubsub + +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: perf-pubsub +rules: + - apiGroups: [""] + resources: ["nodes", "pods"] + verbs: ["list"] + +--- + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: perf-pubsub +subjects: + - kind: ServiceAccount + name: perf-pubsub + namespace: perf-pubsub +roleRef: + kind: ClusterRole + name: perf-pubsub + apiGroup: rbac.authorization.k8s.io + +--- + +apiVersion: v1 +kind: Service +metadata: + name: latency-consumer + namespace: perf-pubsub +spec: + selector: + role: latency-consumer + ports: + - name: http + port: 80 + targetPort: cloudevents + protocol: TCP + +--- + +apiVersion: v1 +kind: Service +metadata: + name: latency-aggregator + namespace: perf-pubsub +spec: + selector: + role: latency-aggregator + ports: + - name: grpc + port: 10000 + targetPort: grpc + protocol: TCP diff --git a/test/performance/channel-latency/channel-latency.yaml b/test/performance/channel-latency/channel-latency.yaml new file mode 100644 index 0000000000..69a4d1f996 --- /dev/null +++ b/test/performance/channel-latency/channel-latency.yaml @@ -0,0 +1,117 @@ +# 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: messaging.knative.dev/v1alpha1 +kind: Subscription +metadata: + name: test-channel + namespace: perf-pubsub +spec: + channel: + apiVersion: messaging.cloud.run/v1alpha1 + kind: Channel + name: test-channel + subscriber: + ref: + apiVersion: v1 + kind: Service + name: latency-consumer + +--- + +apiVersion: batch/v1 +kind: Job +metadata: + name: latency-send-receive + namespace: perf-pubsub + labels: + role: latency-consumer +spec: + completions: 1 + parallelism: 1 + backoffLimit: 0 + template: + metadata: + labels: + role: latency-consumer + spec: + serviceAccountName: perf-pubsub + restartPolicy: Never + containers: + - name: sender-receiver + image: knative.dev/eventing/test/test_images/latencymako + args: + - "--role=sender-receiver" + - "--sink=http://cre-test-channel-chan-publish.perf-pubsub.svc.cluster.local" + - "--aggregator=latency-aggregator:10000" + - "--pace=100:10,200:20,400:60" + - "--verbose" + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + resources: + requests: + cpu: 1000m + memory: 2Gi + ports: + - name: cloudevents + containerPort: 8080 + +--- + +apiVersion: v1 +kind: Pod +metadata: + name: latency-aggregator + namespace: perf-pubsub + labels: + role: latency-aggregator +spec: + serviceAccountName: perf-pubsub + restartPolicy: Never + containers: + - name: aggregator + image: knative.dev/eventing/test/test_images/latencymako + args: + - "--role=aggregator" + # set to the number of sender-receiver + - "--expect-records=1" + - "--verbose" + ports: + - name: grpc + containerPort: 10000 + resources: + requests: + cpu: 1000m + memory: 2Gi + volumeMounts: + - name: config-mako + mountPath: /etc/config-mako + terminationMessagePolicy: FallbackToLogsOnError + - name: mako-stub + image: knative.dev/pkg/test/mako/stub-sidecar + ports: + - name: quickstore + containerPort: 9813 + terminationMessagePolicy: FallbackToLogsOnError + volumes: + - name: config-mako + configMap: + name: config-mako diff --git a/vendor/github.com/cloudevents/sdk-go/pkg/cloudevents/transport/pubsub/transport.go b/vendor/github.com/cloudevents/sdk-go/pkg/cloudevents/transport/pubsub/transport.go index 85939d3e5a..71c1c6ff68 100644 --- a/vendor/github.com/cloudevents/sdk-go/pkg/cloudevents/transport/pubsub/transport.go +++ b/vendor/github.com/cloudevents/sdk-go/pkg/cloudevents/transport/pubsub/transport.go @@ -228,7 +228,6 @@ func (t *Transport) startSubscriber(ctx context.Context, sub subscriptionWithTop } // Ok, ready to start pulling. err := conn.Receive(ctx, func(ctx context.Context, m *pubsub.Message) { - logger.Info("got an event!") msg := &Message{ Attributes: m.Attributes, Data: m.Data,