VOL-569: Create kubernetes deployment configuration for each voltha service
This update adds a kubernetes deployment file for netconf.
I tested the netconf service using the CLI that comes with the netopeer container.
That CLI appears to make connections with remote netconf servers at port 830; that
port number appears to be hard-coded. The port of the netconf server, on the other
hand, defaults to 1830. The changes in file netconf/main.py enable the override of
this default by using environment variable NETCONF_PORT. The kubernetes deployment
file for netconf sets the port to 830.
Change-Id: I19f90d6e14f59c855b84aa76bbc41586f3bace37
diff --git a/k8s/netconf.yml b/k8s/netconf.yml
new file mode 100644
index 0000000..5d999ba
--- /dev/null
+++ b/k8s/netconf.yml
@@ -0,0 +1,49 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: netconf
+spec:
+ selector:
+ app: netconf
+ clusterIP: None
+ ports:
+ - port: 830
+ targetPort: 830
+---
+apiVersion: apps/v1beta1
+kind: Deployment
+metadata:
+ name: netconf
+spec:
+ replicas: 3
+ template:
+ metadata:
+ labels:
+ app: netconf
+ spec:
+ terminationGracePeriodSeconds: 10
+ affinity:
+ podAntiAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ - labelSelector:
+ matchExpressions:
+ - key: app
+ operator: In
+ values:
+ - netconf
+ topologyKey: kubernetes.io/hostname
+ containers:
+ - name: netconf
+ image: "cord/netconf:latest"
+ imagePullPolicy: Never
+ ports:
+ - containerPort: 830
+ env:
+ - name: NETCONF_PORT
+ value: "830"
+ args:
+ - "/netconf/netconf/main.py"
+ - "-v"
+ - "--consul=consul:8500"
+ - "--fluentd=fluentd:24224"
+ - "--grpc-endpoint=voltha:50555"
diff --git a/netconf/main.py b/netconf/main.py
index 7d99f3e..c0f95fc 100755
--- a/netconf/main.py
+++ b/netconf/main.py
@@ -36,7 +36,7 @@
consul=os.environ.get('CONSUL', 'localhost:8500'),
external_host_address=os.environ.get('EXTERNAL_HOST_ADDRESS',
get_my_primary_local_ipv4()),
- netconf_port=os.environ.get('NETCONF_PORT', 1830),
+ netconf_port=os.environ.get('NETCONF_PORT', '1830'),
server_private_key_file=os.environ.get('SERVER_PRIVATE_KEY_FILE',
'server.key'),
server_public_key_file=os.environ.get('SERVER_PRIVATE_KEY_FILE',
@@ -276,7 +276,7 @@
GrpcClient(args.consul, args.work_dir, args.grpc_endpoint)
self.nc_server = yield \
- NCServer(args.netconf_port,
+ NCServer(int(args.netconf_port),
args.server_private_key_file,
args.server_public_key_file,
args.client_public_keys_file,