VOL-580: Update envoy to support either consul or etcd in a kubernetes cluster
Envoy is refactored such that it interworks with either consul or etcd. The refactoring
should not have changed any of envoy's behaviour with consul. The update was tested with
only the vcli, envoy, vcore, and KV-store (consul or etcd) containers:
- tested with consul on a kubernetes 3-node cluster
- tested with etcd on a kubernetes 3-node cluster
- tested with consul on a 3-node docker swarm
- container and node failure testing not performed
This update enables some experimentation of envoy in the kubernetes environment.
There is more work to be done. Future updates could:
- replace the current polling of etcd's assignment key with an asynchronous technique
- make use of data consistency options in etcd get requests
- make greater use of object orientation
Change-Id: Ia22893cdf331967eee4d13e060fd2c5ba7adb321
diff --git a/k8s/envoy_for_consul.yml b/k8s/envoy_for_consul.yml
new file mode 100644
index 0000000..b93ee2e
--- /dev/null
+++ b/k8s/envoy_for_consul.yml
@@ -0,0 +1,63 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: voltha
+ labels:
+ name: voltha
+spec:
+ clusterIP: None
+ ports:
+ - name: rest
+ port: 8882
+ targetPort: 8882
+ - name: mystery
+ port: 8001
+ targetPort: 8001
+ - name: mystery2
+ port: 8443
+ targetPort: 8443
+ - name: grpc
+ port: 50555
+ targetPort: 50555
+ selector:
+ app: voltha
+---
+apiVersion: apps/v1beta1
+kind: Deployment
+metadata:
+ name: voltha
+spec:
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ app: voltha
+ spec:
+ containers:
+ - name: voltha
+ image: "voltha/envoy:latest"
+ env:
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ args:
+ - "/usr/local/bin/envoyd"
+ - "-envoy-cfg-template=/envoy/voltha-grpc-proxy.template.json"
+ - "-envoy-config=/envoy/voltha-grpc-proxy.json"
+ ports:
+ - containerPort: 8882
+ name: rest-port
+ - containerPort: 8001
+ name: mystery-port
+ - containerPort: 8443
+ name: mystery2-port
+ - containerPort: 50555
+ name: grpc-port
+ imagePullPolicy: Never
+
+