summaryrefslogtreecommitdiff
path: root/edge
diff options
context:
space:
mode:
authorNaveen Sriram <naveen.sriram@huawei.com>2019-04-26 20:16:45 +0530
committerNaveen Sriram <naveen.sriram@huawei.com>2019-04-26 20:26:24 +0530
commit8a80bc57772c194a62e1d964fdaded9e2b4eb47d (patch)
tree196bddcf2c9a4b659f633ce2c7654ea73534da4a /edge
parentremove keepalive (#412) (diff)
downloadkubeedge-8a80bc57772c194a62e1d964fdaded9e2b4eb47d.tar.gz
setup script changes for IEF
Diffstat (limited to 'edge')
-rw-r--r--edge/hack/keepalivefunction.txt15
-rw-r--r--edge/hack/setup_for_IEF.sh9
2 files changed, 24 insertions, 0 deletions
diff --git a/edge/hack/keepalivefunction.txt b/edge/hack/keepalivefunction.txt
new file mode 100644
index 000000000..1a8a28b08
--- /dev/null
+++ b/edge/hack/keepalivefunction.txt
@@ -0,0 +1,15 @@
+
+func (ehc *Controller) keepalive() {
+ for {
+ msg := model.NewMessage("").
+ BuildRouter(ModuleNameEdgeHub, "resource", "node", "keepalive").
+ FillBody("ping")
+ err := ehc.chClient.Send(*msg)
+ if err != nil {
+ log.LOGGER.Errorf("websocket write error: %v", err)
+ ehc.stopChan <- struct{}{}
+ return
+ }
+ time.Sleep(ehc.config.HeartbeatPeriod)
+ }
+}
diff --git a/edge/hack/setup_for_IEF.sh b/edge/hack/setup_for_IEF.sh
index 85ce56268..8635c13c8 100644
--- a/edge/hack/setup_for_IEF.sh
+++ b/edge/hack/setup_for_IEF.sh
@@ -183,7 +183,16 @@ create_edge_config() {
sed -i "s|obs_endpoint: .*|obs_endpoint: ${OBS_URL}|g" ${CURRENT_PATH}/conf/edge.yaml
}
+keepalive() {
+ if [ ! -f ${CURRENT_PATH}/pkg/edgehub/controller.go ]; then
+ echo "There is no ${CURRENT_PATH}/pkg/edgehub/controller.go!"
+ exit 1
+ fi
+ sed -i "s|go\ ehc.routeToCloud().*|go ehc.routeToCloud()\n\t\tgo ehc.keepalive()|g" ${CURRENT_PATH}/pkg/edgehub/controller.go
+ cat ${CURRENT_PATH}/hack/keepalivefunction.txt >> ${CURRENT_PATH}/pkg/edgehub/controller.go
+}
+keepalive
create_system_config
parse_config
create_edge_config