futurewei-cloud / alcor-control-agent

Cloud native SDN platform - network control agent
MIT License
14 stars 29 forks source link

[Enhancement] Improve ACA deployment model #161

Open er1cthe0ne opened 4 years ago

er1cthe0ne commented 4 years ago

Context

Current ACA deployment model requires going to the targeted machine to:

  1. clone the aca repro
  2. run a script to clone and install all the aca dependencies (cppkafka, grpc, ovs, pulsar)
  3. compile aca with the dependency

We want to improve the process to use a machine with same linux os as targeted machine:

  1. clone the aca repro
  2. run a script to clone and setup all the aca dependencies (cppkafka, grpc, ovs, pulsar)
  3. compile aca with the dependency
  4. simply copy aca to the targeted machines, execute a script to do "apt-get install" to install needed components and then run aca

Action Item

In order to improve the process, we need to go through all the ACA dependencies

  1. Review /build/aca-machine-init.sh to understand the dependencies needing git clone and install (cppkafka, grpc, ovs, pulsar)
  2. Modify the dependencies make process to generate static library instead of shared library
  3. Change aca cmake file to bring the static library into aca /src/cMakeList.txt
  4. the new aca will be more portable and can be copy to targeted machine to run
er1cthe0ne commented 4 years ago

Hi @HuaqingTu - let me give you the answers here:

  1. Note that we have switched from kafka to pulsar as our message queue solution. Therefore, all kafka code is consider is legacy. We have two options: a. still fix up the kakfa dependencies in case if we want to use it in the future b. remove kafka dependencies, also need to change the source code to remove all kafka includes and references

  2. the gRPC and protobuf CMake references are in the lower sessions in /src/CMakeLists.txt, please see the usages below:

    
    # Find Protobuf installation
    # Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
    set(protobuf_MODULE_COMPATIBLE TRUE)
    find_package(Protobuf CONFIG REQUIRED)
    message(STATUS "Using protobuf ${protobuf_VERSION}")

Find gRPC installation

Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.

find_package(gRPC CONFIG REQUIRED) message(STATUS "Using gRPC ${gRPC_VERSION}")

set(_GRPC_GRPCPP_UNSECURE gRPC::grpc++_unsecure) set(_GRPC_CPP_PLUGIN_EXECUTABLE $)

HuaqingTu commented 4 years ago

Hi, Eric. I've checked the github website of cppkafka to find the CMake options about static library. I think modifying find_library or target_link_libraries can make the use of static libraries first. But for proto and gRPC, it use find_package. I don't know how to modify the code to use static libraries first.

HuaqingTu commented 4 years ago

Hi, Eric. I've checked the github website of cppkafka to find the CMake options about static library. I think modifying find_library or target_link_libraries can make the use of static libraries first. But for proto and gRPC, it use find_package. I don't know how to modify the code to use static libraries first.

HuaqingTu commented 3 years ago

Hi, Eric. Since the gRPC team said that ISSUE is not for asking problems, I've ask question about static library at grpc.io mailing list. They haven't responded yet. I encountered some problems when modifying /src/CMakeLists.txt to statically link dependencies. Below I take pulsar as an example to illustrate how I try to statically link dependencies.

  1. I changed the code FIND_LIBRARY(PULSAR pulsar /usr/lib NO_DEFAULT_PATH) target_link_libraries(AlcorControlAgent pulsar) to FIND_LIBRARY(PULSAR libpulsar.a /usr/lib NO_DEFAULT_PATH) target_link_libraries(AlcorControlAgent libpulsar.a) But it still link with libpulsar.so.2.6.1.

  2. Then I changed it to target_link_libraries(AlcorControlAgent /usr/lib/libpulsar.a) Still not work.

  3. Then according to https://cmake.org/pipermail/cmake/2011-June/045222.html, I added some code and changed it to ADD_LIBRARY(pulsar STATIC IMPORTED) SET_TARGET_PROPERTIES(pulsar PROPERTIES IMPORTED_LOCATION /usr/lib/libpulsar.a) target_link_libraries(AlcorControlAgent pulsar) Still not work.

I'm not sure where the problem is.

er1cthe0ne commented 3 years ago

@HuaqingTu - please take a look at the pulsar documentation which should provide some background information: https://pulsar.apache.org/docs/en/client-libraries-cpp/

You can also work with @lly00 who added the pulsar support. I am hoping @lly00 can give you some hint on how to deal with the pulsar dependency.

HuaqingTu commented 3 years ago

Hi, Eric. I've added a section for manual rules constructions in the design document. And about this issue, I am afraid that I do not have confidence to finish this job.

xieus commented 3 years ago

@er1cthe0ne Can you or @kiran1048 take on this item as well, along with the one-box setup?

er1cthe0ne commented 3 years ago

@xieus - this is more of a trial and error task. I can work with @kiran1048 on it. I think the first step is the remove the old kafka code and dependencies. And work with @lly00 to get the right pulsar dependency into ACA.