ADTRAN: Update to containerized adapters.
Loading and running but still needs about a week or so of work to
catch up to where the OpenOLT/ONU containerized adapters are
Change-Id: I5522232e21dd76b3f95b4698af6c7e4cef96753d
diff --git a/k8s/README.md b/k8s/README.md
new file mode 100644
index 0000000..9d9a36f
--- /dev/null
+++ b/k8s/README.md
@@ -0,0 +1,38 @@
+## How to deploy read/write core pairs on Kubernetes
+
+The current technique installs a separate rw-core deployment to each Kubernetes node, where each deployment consists of a pair (replicas = 2) of co-located rw-cores. Co-location is enforced by making use of the Kubernetes nodeSelector constraint applied at the pod spec level.
+
+In order for node selection to work, a label must be applied to each node. There is a set of built-in node labels that comes with Kubernetes out of the box, one of which is kubernetes.io/hostname. This label can be used to constrain the deployment of a core pair to a node with a specific hostname. Another approach is to take greater control and create new node labels.
+
+The following discussion assumes installation of the voltha-k8s-playground (https://github.com/ciena/voltha-k8s-playground) which configures three Kubernetes nodes named k8s1, k8s2, and k8s3.
+
+Create a "nodename" label for each Kubernetes node:
+```
+kubectl label nodes k8s1 nodename=k8s1
+kubectl label nodes k8s2 nodename=k8s2
+kubectl label nodes k8s3 nodename=k8s3
+```
+
+Verify that the labels have been applied:
+```
+kubectl get nodes --show-labels
+NAME STATUS ROLES AGE VERSION LABELS
+k8s1 Ready master,node 4h v1.9.5 ...,kubernetes.io/hostname=k8s1,nodename=k8s1
+k8s2 Ready node 4h v1.9.5 ...,kubernetes.io/hostname=k8s2,nodename=k8s2
+k8s3 Ready node 4h v1.9.5 ...,kubernetes.io/hostname=k8s3,nodename=k8s3
+```
+
+
+Ensure that a nodeSelector section appears in the deployment's pod spec (such a section should already exist in each manifest):
+```
+ ...
+ nodeSelector:
+ nodename: k8s1
+```
+
+Once the labels have been applied, deploy the 3 core pairs:
+```
+kubectl apply -f k8s/rw-core-pair1.yml
+kubectl apply -f k8s/rw-core-pair2.yml
+kubectl apply -f k8s/rw-core-pair3.yml
+```
diff --git a/k8s/adapters-adtran-olt.yml b/k8s/adapters-adtran-olt.yml
new file mode 100644
index 0000000..1c61f83
--- /dev/null
+++ b/k8s/adapters-adtran-olt.yml
@@ -0,0 +1,59 @@
+# Copyright 2018 the original author or 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.
+
+# ADTRAN OLT adapter
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: adapter-adtran-olt
+ namespace: voltha
+spec:
+ clusterIP: None
+ selector:
+ app: adapter-adtran-olt
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: adapter-adtran-olt
+ namespace: voltha
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: adapter-adtran-olt
+ template:
+ metadata:
+ labels:
+ app: adapter-adtran-olt
+ annotations:
+ cni: "calico"
+ spec:
+ containers:
+ - name: adapter-adtran-olt
+ image: voltha-adapter-adtran-olt
+ env:
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ args:
+ - "/voltha/python/adapters/adtran/adtran_olt/main.py"
+ - "-v"
+ - "--name=adtran_olt"
+ - "--kafka_adapter=kafka.$(NAMESPACE).svc.cluster.local:9092"
+ - "--kafka_cluster=kafka.$(NAMESPACE).svc.cluster.local:9092"
+ - "--core_topic=rwcore"
+ imagePullPolicy: IfNotPresent
diff --git a/k8s/adapters-adtran-onu.yml b/k8s/adapters-adtran-onu.yml
new file mode 100644
index 0000000..a2f23c3
--- /dev/null
+++ b/k8s/adapters-adtran-onu.yml
@@ -0,0 +1,59 @@
+# Copyright 2018 the original author or 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.
+
+# ADTRAN OLT adapter
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: adapter-adtran-onu
+ namespace: voltha
+spec:
+ clusterIP: None
+ selector:
+ app: adapter-adtran-onu
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: adapter-adtran-onu
+ namespace: voltha
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: adapter-adtran-onu
+ template:
+ metadata:
+ labels:
+ app: adapter-adtran-onu
+ annotations:
+ cni: "calico"
+ spec:
+ containers:
+ - name: adapter-adtran-onu
+ image: voltha-adapter-adtran-onu
+ env:
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ args:
+ - "/voltha/python/adapters/adtran_onu/main.py"
+ - "-v"
+ - "--name=adtran_olt"
+ - "--kafka_adapter=kafka.$(NAMESPACE).svc.cluster.local:9092"
+ - "--kafka_cluster=kafka.$(NAMESPACE).svc.cluster.local:9092"
+ - "--core_topic=rwcore"
+ imagePullPolicy: IfNotPresent
diff --git a/k8s/single-node/cli.yml b/k8s/single-node/cli.yml
new file mode 100644
index 0000000..680d172
--- /dev/null
+++ b/k8s/single-node/cli.yml
@@ -0,0 +1,63 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: Service
+metadata:
+ name: vcli
+ namespace: voltha
+ labels:
+ name: vcli
+spec:
+ ports:
+ - name: ssh
+ port: 5022
+ targetPort: 22
+ selector:
+ app: vcli
+---
+apiVersion: apps/v1beta1
+kind: Deployment
+metadata:
+ name: vcli
+ namespace: voltha
+spec:
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ app: vcli
+ annotations:
+ cni: "calico"
+ spec:
+ containers:
+ - name: vcli
+ image: voltha-cli
+ env:
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ args:
+ - "/voltha/python/cli/setup.sh"
+ - "-g rw-core:50057"
+ ports:
+ - containerPort: 22
+ name: ssh-port
+ imagePullPolicy: Never
+
+
diff --git a/k8s/single-node/etcd-cluster.yml b/k8s/single-node/etcd-cluster.yml
new file mode 100644
index 0000000..61a35fa
--- /dev/null
+++ b/k8s/single-node/etcd-cluster.yml
@@ -0,0 +1,25 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: "etcd.database.coreos.com/v1beta2"
+kind: "EtcdCluster"
+metadata:
+ name: etcd
+ namespace: voltha
+spec:
+ size: 1
+ version: "3.2.18"
+ pod:
+ annotations:
+ cni: "calico"
+
diff --git a/k8s/single-node/kafka.yml b/k8s/single-node/kafka.yml
new file mode 100644
index 0000000..4604676
--- /dev/null
+++ b/k8s/single-node/kafka.yml
@@ -0,0 +1,58 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: Service
+metadata:
+ name: kafka
+ namespace: voltha
+spec:
+ clusterIP: None
+ selector:
+ app: kafka
+ ports:
+ - protocol: TCP
+ port: 9092
+ targetPort: 9092
+---
+apiVersion: apps/v1beta1
+kind: StatefulSet
+metadata:
+ name: kafka
+ namespace: voltha
+spec:
+ serviceName: kafka
+ replicas: 1
+ selector:
+ matchLabels:
+ app: kafka
+ template:
+ metadata:
+ labels:
+ app: kafka
+ annotations:
+ cni: "calico"
+ spec:
+ terminationGracePeriodSeconds: 10
+ containers:
+ - name: kafka
+ image: wurstmeister/kafka:1.0.0
+ ports:
+ - containerPort: 9092
+ env:
+ - name: KAFKA_ADVERTISED_PORT
+ value: "9092"
+ - name: KAFKA_ZOOKEEPER_CONNECT
+ value: zoo:2181
+ - name: KAFKA_HEAP_OPTS
+ value: "-Xmx256M -Xms128M"
diff --git a/k8s/single-node/olt.yml b/k8s/single-node/olt.yml
new file mode 100644
index 0000000..148e1ad
--- /dev/null
+++ b/k8s/single-node/olt.yml
@@ -0,0 +1,74 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: Service
+metadata:
+ name: olt
+ namespace: voltha
+ labels:
+ name: olt
+spec:
+ ports:
+ - name: grpc
+ port: 50060
+ targetPort: 50060
+ selector:
+ app: olt
+---
+apiVersion: apps/v1beta1
+kind: Deployment
+metadata:
+ name: olt
+ namespace: voltha
+spec:
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ app: olt
+ annotations:
+ cni: "calico"
+ spec:
+ containers:
+ - name: olt
+ image: "voltha-ponsim:latest"
+ env:
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+
+ args:
+ - "/app/ponsim"
+ - "-device_type"
+ - "OLT"
+ - "-onus"
+ - "1"
+ - "-internal_if"
+ - "eth0"
+ - "-external_if"
+ - "eth0"
+ - "-vcore_endpoint"
+ - "rw-core"
+ - "-promiscuous"
+ - "-verbose"
+ ports:
+ - containerPort: 50060
+ name: grpc-port
+
+ imagePullPolicy: Never
diff --git a/k8s/single-node/onu.yml b/k8s/single-node/onu.yml
new file mode 100644
index 0000000..38e6cc6
--- /dev/null
+++ b/k8s/single-node/onu.yml
@@ -0,0 +1,74 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: Service
+metadata:
+ name: onu
+ namespace: voltha
+ labels:
+ name: onu
+spec:
+ ports:
+ - name: grpc
+ port: 50061
+ targetPort: 50061
+ selector:
+ app: onu
+---
+apiVersion: apps/v1beta1
+kind: Deployment
+metadata:
+ name: onu
+ namespace: voltha
+spec:
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ app: onu
+ annotations:
+ cni: "calico,pon0"
+ spec:
+ containers:
+ - name: onu
+ image: "voltha-ponsim:latest"
+ env:
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+
+ args:
+ - "/app/ponsim"
+ - "-device_type"
+ - "ONU"
+ - "-parent_addr"
+ - "olt"
+ - "-grpc_port"
+ - "50061"
+ - "-internal_if"
+ - "eth0"
+ - "-external_if"
+ - "eth1"
+ - "-promiscuous"
+ - "-verbose"
+ ports:
+ - containerPort: 50061
+ name: grpc-port
+
+ imagePullPolicy: Never
diff --git a/k8s/single-node/ro-core.yml b/k8s/single-node/ro-core.yml
new file mode 100644
index 0000000..b2f278f
--- /dev/null
+++ b/k8s/single-node/ro-core.yml
@@ -0,0 +1,73 @@
+# Copyright 2018 the original author or 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: Service
+metadata:
+ name: ro-core
+ namespace: voltha
+spec:
+ clusterIP: None
+ ports:
+ - name: grpc
+ port: 50057
+ targetPort: 50057
+ selector:
+ app: ro-core
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: ro-core
+ namespace: voltha
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: ro-core
+ template:
+ metadata:
+ labels:
+ app: ro-core
+ annotations:
+ cni: "calico"
+ spec:
+ containers:
+ - name: voltha
+ image: voltha-ro-core
+ env:
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ args:
+ - "/app/ro_core"
+ - "-kv_store_type=etcd"
+ - "-kv_store_host=etcd.$(NAMESPACE).svc.cluster.local"
+ - "-kv_store_port=2379"
+ - "-grpc_port=50057"
+ - "-banner=true"
+ - "-ro_core_topic=rocore"
+ - "-log_level=0"
+ ports:
+ - containerPort: 50057
+ name: grpc-port
+ imagePullPolicy: IfNotPresent
+
+
+
diff --git a/k8s/single-node/rw-core.yml b/k8s/single-node/rw-core.yml
new file mode 100644
index 0000000..7fd3848
--- /dev/null
+++ b/k8s/single-node/rw-core.yml
@@ -0,0 +1,77 @@
+# Copyright 2018 the original author or 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: Service
+metadata:
+ name: rw-core
+ namespace: voltha
+spec:
+ clusterIP: None
+ ports:
+ - name: grpc
+ port: 50057
+ targetPort: 50057
+ selector:
+ app: rw-core
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: rw-core
+ namespace: voltha
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: rw-core
+ template:
+ metadata:
+ labels:
+ app: rw-core
+ annotations:
+ cni: "calico"
+ spec:
+ containers:
+ - name: voltha
+ image: voltha-rw-core
+ env:
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ args:
+ - "/app/rw_core"
+ - "-kv_store_type=etcd"
+ - "-kv_store_host=etcd.$(NAMESPACE).svc.cluster.local"
+ - "-kv_store_port=2379"
+ - "-grpc_port=50057"
+ - "-banner=true"
+ - "-kafka_adapter_host=kafka.$(NAMESPACE).svc.cluster.local"
+ - "-kafka_adapter_port=9092"
+ - "-kafka_cluster_host=kafka.$(NAMESPACE).svc.cluster.local"
+ - "-kafka_cluster_port=9092"
+ - "-rw_core_topic=rwcore"
+ - "-log_level=0"
+ ports:
+ - containerPort: 50057
+ name: grpc-port
+ imagePullPolicy: IfNotPresent
+
+
+
diff --git a/k8s/single-node/zookeeper.yml b/k8s/single-node/zookeeper.yml
new file mode 100644
index 0000000..ffd3e12
--- /dev/null
+++ b/k8s/single-node/zookeeper.yml
@@ -0,0 +1,69 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: Service
+metadata:
+ name: zoo
+ namespace: voltha
+spec:
+ clusterIP: None
+ selector:
+ app: zookeeper
+ ports:
+ - name: client
+ port: 2181
+ targetPort: 2181
+ - name: follower
+ port: 2888
+ targetPort: 2888
+ - name: leader
+ port: 3888
+ targetPort: 3888
+---
+apiVersion: apps/v1beta1
+kind: StatefulSet
+metadata:
+ name: zookeeper
+ namespace: voltha
+spec:
+ serviceName: zoo
+ replicas: 1
+ selector:
+ matchLabels:
+ app: zookeeper
+ template:
+ metadata:
+ labels:
+ app: zookeeper
+ annotations:
+ cni: "calico"
+ spec:
+ containers:
+ - name: zoo
+ image: zookeeper:3.4.11
+ ports:
+ - containerPort: 2181
+ - containerPort: 2888
+ - containerPort: 3888
+ env:
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: ZOO_MY_ID
+ value: "1"
+# - name: ZOO_SERVERS
+# value: >
+# server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888
+