diff --git a/kafka-testing/kafka_external_access.yml b/kafka-testing/kafka_external_access.yml new file mode 100644 index 0000000..6e5727f --- /dev/null +++ b/kafka-testing/kafka_external_access.yml @@ -0,0 +1,242 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: kafka-controller-deployer +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: kafka-controller-deployer +subjects: +- kind: ServiceAccount + name: controller-acct + namespace: kubeless +--- +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: kafka + namespace: kubeless +spec: + serviceName: broker + template: + metadata: + labels: + kubeless: kafka + spec: + containers: + - env: + - name: KAFKA_ADVERTISED_HOST_NAME + value: broker.kubeless + - name: KAFKA_ADVERTISED_PORT + value: "9092" + - name: KAFKA_PORT + value: "9092" + - name: KAFKA_DELETE_TOPIC_ENABLE + value: "true" + - name: KAFKA_ZOOKEEPER_CONNECT + value: zookeeper.kubeless:2181 + - name: ALLOW_PLAINTEXT_LISTENER + value: "yes" + image: bitnami/kafka:1.1.0-r0 + imagePullPolicy: IfNotPresent + livenessProbe: + initialDelaySeconds: 30 + tcpSocket: + port: 9092 + name: broker + ports: + - containerPort: 9092 + volumeMounts: + - mountPath: /bitnami/kafka/data + name: datadir + initContainers: + - command: + - sh + - -c + - chmod -R g+rwX /bitnami + image: busybox + imagePullPolicy: IfNotPresent + name: volume-permissions + volumeMounts: + - mountPath: /bitnami/kafka/data + name: datadir + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka + namespace: kubeless +spec: + ports: + - port: 9092 + selector: + kubeless: kafka +--- +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: zoo + namespace: kubeless +spec: + serviceName: zoo + template: + metadata: + labels: + kubeless: zookeeper + spec: + containers: + - env: + - name: ZOO_SERVERS + value: server.1=zoo-0.zoo:2888:3888:participant + - name: ALLOW_ANONYMOUS_LOGIN + value: "yes" + image: bitnami/zookeeper:3.4.10-r12 + imagePullPolicy: IfNotPresent + name: zookeeper + ports: + - containerPort: 2181 + name: client + - containerPort: 2888 + name: peer + - containerPort: 3888 + name: leader-election + volumeMounts: + - mountPath: /bitnami/zookeeper + name: zookeeper + initContainers: + - command: + - sh + - -c + - chmod -R g+rwX /bitnami + image: busybox + imagePullPolicy: IfNotPresent + name: volume-permissions + volumeMounts: + - mountPath: /bitnami/zookeeper + name: zookeeper + volumeClaimTemplates: + - metadata: + name: zookeeper + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: Service +metadata: + name: zoo + namespace: kubeless +spec: + clusterIP: None + ports: + - name: peer + port: 9092 + - name: leader-election + port: 3888 + selector: + kubeless: zookeeper +--- +apiVersion: v1 +kind: Service +metadata: + name: zookeeper + namespace: kubeless +spec: + ports: + - name: client + port: 2181 + selector: + kubeless: zookeeper +--- +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + labels: + kubeless: kafka-trigger-controller + name: kafka-trigger-controller + namespace: kubeless +spec: + selector: + matchLabels: + kubeless: kafka-trigger-controller + template: + metadata: + labels: + kubeless: kafka-trigger-controller + spec: + containers: + - env: + - name: KUBELESS_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: KUBELESS_CONFIG + value: kubeless-config + image: bitnami/kafka-trigger-controller:v1.0.1 + imagePullPolicy: IfNotPresent + name: kafka-trigger-controller + serviceAccountName: controller-acct +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: kafka-controller-deployer +rules: +- apiGroups: + - "" + resources: + - services + - configmaps + verbs: + - get + - list +- apiGroups: + - kubeless.io + resources: + - functions + - kafkatriggers + verbs: + - get + - list + - watch + - update + - delete +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: kafkatriggers.kubeless.io +spec: + group: kubeless.io + names: + kind: KafkaTrigger + plural: kafkatriggers + singular: kafkatrigger + scope: Namespaced + version: v1beta1 +--- +apiVersion: v1 +kind: Service +metadata: + name: broker + namespace: kubeless +spec: + type: NodePort + ports: + - port: 9092 + nodePort: 30092 + selector: + kubeless: kafka