# 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: v1
kind: Namespace
metadata:
  name: perf-eventing

---

apiVersion: v1
kind: Service
metadata:
  name: channel-perf-consumer
  namespace: perf-eventing
spec:
  selector:
    role: channel-perf-consumer
  ports:
  - protocol: TCP
    port: 80
    targetPort: cloudevents
    name: http

---

apiVersion: v1
kind: Service
metadata:
  name: channel-perf-aggregator
  namespace: perf-eventing
spec:
  selector:
    role: channel-perf-aggregator
  ports:
    - name: grpc
      port: 10000
      targetPort: grpc
      protocol: TCP

---

apiVersion: v1
kind: ServiceAccount
metadata:
  name: perf-eventing
  namespace: perf-eventing

---

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: perf-eventing
rules:
  - apiGroups: [""]
    resources: ["nodes", "pods"]
    verbs: ["list"]

---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: perf-eventing
subjects:
  - kind: ServiceAccount
    name: perf-eventing
    namespace: perf-eventing
roleRef:
  kind: ClusterRole
  name: perf-eventing
  apiGroup: rbac.authorization.k8s.io

---

apiVersion: messaging.knative.dev/v1alpha1
kind: InMemoryChannel
metadata:
  name: in-memory-test-channel
  namespace: perf-eventing

---


apiVersion: messaging.knative.dev/v1alpha1
kind: Subscription
metadata:
  name: in-memory-test-channel-sub
  namespace: perf-eventing
spec:
  channel:
    apiVersion: messaging.knative.dev/v1alpha1
    kind: InMemoryChannel
    name: in-memory-test-channel
  subscriber:
    uri: "http://channel-perf-consumer.perf-eventing.svc.cluster.local"
