2023年9月28日木曜日

Eclipse Ankaios を調べてみた

Eclipse SDV ProjectnのEclipse Ankaiosを調べてみました。

アンカイオスはギリシャ神話の人物。

「リュクルゴスの息子」と「サモス島の領主」の同名の別人がいるらしい。
前者のほうは、ギリシャ神話の英雄とのこと。
多分語源はこっち。

まとめとしては以下の内容

  • スコープや背景
  • 技術的な要約
  • 簡易動作確認

スコープと背景

基本的に以下のサイトに書いてあることを要約した。

https://eclipse-ankaios.github.io/ankaios/

スコープ

Scope¶
Eclipse Ankaios provides workload and container orchestration for automotive High Performance Computing (HPC) software . While it can be used for various fields of applications, it is developed from scratch for automotive use cases and provides a slim yet powerful solution to manage containerized applications. It supports various container runtimes with Podman as the first one, but other container runtimes and even native applications can be supported. Eclipse Ankaios is independent of existing communication frameworks like SOME/IP, DDS, or REST API.

Eclipse Ankaios manages multiple nodes and virtual machines with a single unique API in order to start, stop, configure, and update containers and workloads. It provides a central place to manage automotive applications with a setup consisting of one server and multiple agents. Usually one agent per node connects to one or more runtimes that are running the workloads.


車載HPC向けのワークロードとコンテナオーケストレーションを提供
車載向けにスクラッチ開発し、スリムで強力なソリューションを実現する。
Podmanを使ってさまざまなコンテナランタイムをサポート。
ネイティブアプリケーションもサポートができる。
Ankaiosは既存の通信フレームワーク(SOME/IP、DDS、REST APIなど)に依存していない。

Ankaiosは複数ノード、仮想マシンを単一のAPIで管理できる。
コンテナ、ワークロードに対するstart/stop/configuration/update
Ankaiosサーバ、Ankaiosエージェントという構成を持ち、
車載アプリケーションを管理するための中央的な場所を提供。
※ central placeの意味がしっくりこない。
1ノードに1エージェントを配置し、複数のワークロードを実行中のランタイムに接続される

背景

以下サイトの記載を引用

Eclipse Ankaios follows the UNIX philosophy to have one tool for one job and do that job well. It does not depend on a specific init system like systemd but can be started with any init system. It also does not handle persistency but can use an existing automotive persistency handling, e.g. provided by AUTOSAR Adaptive.

The workloads are provided access to the Eclipse Ankaios API using access control and thus are able to dynamically reconfigure the system. One possible use case is the dynamic startup of an application that is only required in a particular situation such as a parking assistant. When the driver wants to park the car, a control workload can start the parking assistant application. When the parking is finished, the parking assistant workload is stopped again.

Eclipse Ankaios also provides a CLI that allows developers to develop and test configurations. In order to gain compatibility with Kubernetes, Eclipse Ankaios accepts pod specifications.

An optional fleet connector can use the Eclipse Ankaios API to connect to a cloud-based software update system, which allows an OEM to manage a fleet of vehicles and provide new states to Eclipse Ankaios in order to update single or all applications.

In order to support the Automotive SPICE process, Eclipse Ankaios comes with requirements tracing supported by OpenFastTrace.

以下設計指針

  • ツールの思想はUNIX哲学に従っている。
  • 永続的な処理はない。
    • 既存のAutomotiveno永続性処理を使用することが可能。
  • initシステムに依存せずに起動可能
  • APIを使用して、システムを動的に再構成する
  • 開発者向にCLI(コマンドライン)も提供(ank)
  • Kubernetesと互換性を確保のためにPod仕様も対応
  • Automotive SPICEプロセスをサポートするためにOpenFastTraceによって要件トレース

動的に再構成するユースケース

  • パーキングアシストなどの特定条件のみで必要となるアプリケーションの起動停止。
    • パーキングしたい場合、駐車アシスタントのワークロードを起動
    • パーキング完了の場合、駐車アシスタントのワークロードを停止

任意のフリートコネクタを用いた場合、
Ankaios APIのを使ってクラウドベースのソフト更新システムに接続できる。
OEMが車両管理やソフト更新のためにAnkaiosに新しい状態を通知したりできる。

※ここの文章の内容がいまいちな気がするので、以下として理解。
Fleet ConnectorがAnkaios Serverにアクセスし、ワークロード情報を収集する。
その結果をクラウドサーバにアップする。
FleetConnectorからワークロードの動的な構成が行える。

参考図

技術的な要約

  • 言語
    • Rust
  • コンテナ
    • podman
  • 通信プロトコル
    • gRPC


 システム構成の概略図



component Ankaios_CLI<<process>>
component Ankaios_Server <<process>>
component Agent_node {
  component Ankaios_Agent<<process>>
  component Podman
  component Workload

  Ankaios_Agent *-down- Workload
  Ankaios_Agent -> Podman: use
  Podman -left-> Workload : コンテナ起動 with Pod
}

Ankaios_CLI -right-> Ankaios_Server:  communication with gRPC
Ankaios_Server "1"<-down->"n" Ankaios_Agent: communication with gRPC

基本的にAnkaios_Agentが受け取ったコマンドをpodmanで実行する。
Ankaios_Server とAnkaios_Agentのメッセージフォーマットは
ankaios.proto参照

簡易動作確認

前提条件

  • rust がインストールされていること

インストール手順

> apt install podman
> sudo usermod --add-subuids 10000-65536 ponta027
> sudo usermod --add-subgids 10000-65536 ponta027
> cat /etc/containers/containers.conf 
[containers]
keyring=false

> apt install protobuf-compiler
> git clone https://github.com/eclipse-ankaios/ankaios.git
> cd ankaios
> cargo build

動作確認

terminal1

> ./target/debug/ank-server --startup-config startConfig.yaml

startConfig.yamlを作成。
workloadを定義し、起動するagentを設定する。
workloadは、runtimeConfigに指定してあるとおりに動作する。

terminal2

> podman pull docker.io/library/nginx:latest
> ./target/debug/ank-agent --name agent_A

agennt_Aでnginxのコンテナが起動

terminal3

> ./ank get workload
 WORKLOAD NAME   AGENT     RUNTIME   EXECUTION STATE 
 api_sample      agent_A   podman    Failed          
 hello1          agent_B   podman    Unknown         
 hello2          agent_B   podman    Unknown         
 hello3          agent_B   podman    Unknown         
 nginx           agent_A   podman    Running         

workloads:
  nginx:
    runtime: podman
    agent: agent_A
    restart: true
    updateStrategy: AT_MOST_ONCE
    accessRights:
      allow: []
      deny: []
    tags:
      - key: owner
        value: Ankaios team
    runtimeConfig: |
      image: docker.io/library/nginx:latest
      ports:
      - containerPort: 80
        hostPort: 8081
  api_sample:
    runtime: podman
    agent: agent_A
    restart: true
    updateStrategy: AT_MOST_ONCE
    accessRights:
      allow: []
      deny: []
    tags:
      - key: owner
        value: Ankaios team
    runtimeConfig: |
      image: ankaios_workload_api_example
  hello1:
    runtime: podman
    agent: agent_B
    restart: true
    updateStrategy: AT_MOST_ONCE
    accessRights:
      allow: []
      deny: []
    tags:
      - key: owner
        value: Ankaios team
    runtimeConfig: |
      image: alpine:latest
      command: ["echo"]
      args: ["Hello Ankaios"]
      remove: true
  hello2:
    runtime: podman
    agent: agent_B
    restart: true
    updateStrategy: AT_MOST_ONCE
    accessRights:
      allow: []
      deny: []
    tags:
      - key: owner
        value: Ankaios team
    runtimeConfig: |
      image: alpine:latest
      command: ["echo"]
      args: ["Hello Ankaios"]
      remove: false
  hello3:
    runtime: podman
    agent: agent_B
    restart: true
    updateStrategy: AT_MOST_ONCE
    accessRights:
      allow: []
      deny: []
    tags:
      - key: owner
        value: Ankaios team
    runtimeConfig: |
      image: alpine:latest
      command: ["echo"]
      args: ["Hello Ankaios"]


所感

Kubernetesなどのオーケストレーションツールを車載品質に焼き直そうという
シンプルな目的なので分かりやすいが、車両へコンテナの適用が増加していき、ツールの機能が拡充すれば使えるツールになるのかもしれない。
技術的な観点だと、Rust、gRPCのトレンド技術を取り入れているあたりは
面白いと思う。
要件トレースにopenFastTraceというテキストベースのトレースツールを使っていて、ちょっと試してみようかと思う。



2023年9月7日木曜日

Eclipse eCALを動かしてみる

Eclipse eCALを動かしてみる

eCALとは

eCAL
とはEclipse SDV Projectの1プロジェクト。

ハイパフォーマンスでスケーラブルなpub/subミドルウェア。
マルチプラットフォームサポート(Windows/Linux)

付属アプリケーションとして以下が提供されている。

  • Monitor
  • Recorder
  • Player

以下プロトコルをサポート

  • Google Protobuf
  • CapnProto
  • Flatbuffers

ROS2と接続できるようにRMW(ROSMiddleWare)をサポート

やったこと

  • eCALの環境構築。
  • 同一コンテナ内でProtobufでPub/Subの動作確認

動作確認環境

xxxx@penguin:~/$ hostnamectl 
   Static hostname: penguin
         Icon name: computer-container
           Chassis: container
        Machine ID: xxxxx
           Boot ID: xxxxx
    Virtualization: lxc
  Operating System: Debian GNU/Linux 11 (bullseye)
            Kernel: Linux 5.15.112-19404-g55fe7e355056
      Architecture: arm64

環境構築

Dockerfileを作成

FROM ubuntu:20.04

# https://github.com/eclipse-ecal/ecal


RUN apt-get update && apt-get upgrade   \
      && apt-get -y install software-properties-common  \
      && add-apt-repository ppa:ecal/ecal-latest  \
      && apt-get update   \
      && apt-get -y install ecal  \
      && apt-get -y install vim cmake g++ libprotobuf-dev protobuf-compiler

ビルド

> docker build -t eCAL_sample . 

動作確認

コンテナ起動して、受信プログラムを実行

> docker run -it -v data:/data eCAL_sample bash

>root@febee21d92e6:/# ecal_sample_person_rec
^

別ターミナルで同一コンテナに入る。

> docker exec -it [container_id] bash

>root@febee21d92e6:/# ecal_sample_person_snd

送受信のプログラムが動作し始める。

実装

> apt-get install cmake g++ libprotobuf-dev protobuf-compiler

protcol bufferで送受信するプログラムを実装。
実装内容は以下参照。

https://eclipse-ecal.github.io/ecal/getting_started/hello_world_proto.html

以下簡単に処理内容を記載する。





今後確認してみること

参考