With this PR, the edgecontroller will align the missions in edgeclusters with the missions in the cloud side.
In more details: Every time an edgecluster object is added or updated, edgecontroller will look into the missions deployed in the edge cluster. If there is any discrepancy between the missions of the edge side and the cloud side, the edge controller will send an MissionList message to the ege side. The MetaManager will update the mission records saved in its DB after receiving the MissionList message. Finally, the clusterd will pick up the changes and update the missions in its managed edge cluster.
Verification
The PR is verified with the following test scenario :
Start the cloudcore
keep the edgecore off and deploy a new mission A
start edgecore
It is verified that the mission A is deployed to the edge cluster
stop the edgecore process
delete the mission A and deploy a new mission B in the cloud cluster.
restart the edgecore process, wait like 20 seconds
It is verified that in the edge cluster, mission A is removed and mission B is active.
Manually delete the mission B in the edge cluster.
wait 20 seconds.
It is verified that mission B is re-deployed and still active in the edge cluster.
Possible improvement
In this PR, the mission list message will be sent out only when it is necessary, namely when the edge controller finds the missions in the edge is different from the missions in the cloud side. For the PoC purpose, I compare the missions of edge and cloud by their names. Therefore, if a mission's spec is manually changed in the edge side with the mission name untouched, the cloud side cannot detect it.
I am thinking this issue might be solved by clusterd sending a Mission Spec hash value in the edge-cluster status message, where the edgecontroller get the information of missons running on the edge cluster. Then the edge controller can also check whether the mission Spec is different from that in the cloud side. It is left for further discussion .
With this PR, the edgecontroller will align the missions in edgeclusters with the missions in the cloud side.
In more details: Every time an edgecluster object is added or updated, edgecontroller will look into the missions deployed in the edge cluster. If there is any discrepancy between the missions of the edge side and the cloud side, the edge controller will send an MissionList message to the ege side. The MetaManager will update the mission records saved in its DB after receiving the MissionList message. Finally, the clusterd will pick up the changes and update the missions in its managed edge cluster.
Verification
The PR is verified with the following test scenario :
Start the cloudcore
keep the edgecore off and deploy a new mission A
start edgecore It is verified that the mission A is deployed to the edge cluster
stop the edgecore process
delete the mission A and deploy a new mission B in the cloud cluster.
restart the edgecore process, wait like 20 seconds
It is verified that in the edge cluster, mission A is removed and mission B is active.
Manually delete the mission B in the edge cluster.
wait 20 seconds.
It is verified that mission B is re-deployed and still active in the edge cluster.
Possible improvement
In this PR, the mission list message will be sent out only when it is necessary, namely when the edge controller finds the missions in the edge is different from the missions in the cloud side. For the PoC purpose, I compare the missions of edge and cloud by their names. Therefore, if a mission's spec is manually changed in the edge side with the mission name untouched, the cloud side cannot detect it.
I am thinking this issue might be solved by clusterd sending a Mission Spec hash value in the edge-cluster status message, where the edgecontroller get the information of missons running on the edge cluster. Then the edge controller can also check whether the mission Spec is different from that in the cloud side. It is left for further discussion .