| # Copyright 2019 TATA ELXSI |
| # |
| # 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 |
| # Author: Vijay Nag B S (vijaynag.bs@tataelxsi.co.in) |
| |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: kafka |
| spec: |
| clusterIP: None |
| ports: |
| - port: 9092 |
| protocol: TCP |
| targetPort: 9092 |
| selector: |
| app: kafka |
| type: ClusterIP |
| --- |
| apiVersion: apps/v1 |
| kind: StatefulSet |
| metadata: |
| name: kafka |
| labels: |
| app: kafka |
| spec: |
| replicas: 1 |
| serviceName: kafka |
| selector: |
| matchLabels: |
| app: kafka |
| template: |
| metadata: |
| labels: |
| app: kafka |
| spec: |
| initContainers: |
| - name: zookeeper-test |
| image: alpine:latest |
| command: ["sh", "-c", "until nc -zvw1 zookeeper 2181; do sleep3; done; exit 0"] |
| containers: |
| - name: kafka |
| image: wurstmeister/kafka:2.11-1.0.2 |
| ports: |
| - containerPort: 9092 |
| protocol: TCP |
| env: |
| - name: KAFKA_ADVERTISED_HOST_NAME |
| value: kafka.osm |
| - name: KAFKA_ADVERTISED_PORT |
| value: "9092" |
| - name: KAFKA_ZOOKEEPER_CONNECT |
| value: zookeeper:2181 |
| - name: KAFKA_LOG_RETENTION_HOURS |
| value: "24" |
| - name: KAFKA_BROKER_ID |
| value: "1" |
| - name: KAFKA_ADVERTISED_LISTENERS |
| value: "PLAINTEXT://:9092" |
| - name: KAFKA_LISTENERS |
| value: "PLAINTEXT://:9092" |
| - name: KAFKA_INTER_BROKER_LISTENER_NAME |
| value: "PLAINTEXT" |
| - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR |
| value: "1" |
| - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE |
| value: "false" |
| - name: KAFKA_CREATE_TOPICS |
| value: "admin:1:1,users:1:1,projects:1:1,vim_account:1:1,wim_account:1:1,sdn:1:1,k8scluster:1:1,k8srepo:1:1,osmrepos:1:1,vnfd:1:1,nsd:1:1,nst:1:1,pdu:1:1,ns:1:1,nsi:1:1,alarm_request:1:1,alarm_response:1:1" |
| volumeMounts: |
| - name: socket |
| mountPath: /var/run/docker.sock |
| volumes: |
| - name: socket |
| hostPath: |
| path: /var/run/docker.sock |