Skip to content

Commit f36e037

Browse files
committed
Universal agent
Main features and improvements: 1) Universal Agent in Genesis Core image - Added universal agent to the genesis image. - Implemented CoreCapabilityDriver for nodes and configs. 2) Separation of Status and Orch API - The Status and Orch API were separated into two services. - A fix for the entry point for the render driver. 3) Universal scheduler, GC rest API client - Added universal scheduler to the genesis image - Load resource collections from the configuration file. - Genesis Core rest API client 4) Minor fixes - Correct handle empty discovery range in ISC DHCP - Correct handle empty discovery range in IPAM - Ability to build with local SDK module - Bumped up gcl-sdk version to 0.3.0 Signed-off-by: Anton Kremenetsky <anton.kremenetsky@gmail.com>
1 parent 92c2d56 commit f36e037

48 files changed

Lines changed: 1054 additions & 2401 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

etc/genesis_core/genesis_core.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ bind_port = 11010
2020
bind_host = 0.0.0.0
2121
bind_port = 11011
2222

23+
[status_api]
24+
bind_host = 0.0.0.0
25+
bind_port = 11012
26+
2327
[events]
2428
# enable = False
2529
# client_type = async

etc/genesis_core_agent/genesis_core_agent.conf

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[DEFAULT]
2+
verbose = True
3+
debug = True
4+
5+
6+
[db]
7+
connection_url = postgresql://genesis_core:genesis_core@127.0.0.1:5432/genesis_core
8+
connection_pool_size = 2
9+
10+
11+
[universal_agent]
12+
orch_endpoint = http://localhost:11011
13+
status_endpoint = http://localhost:11012
14+
caps_drivers = CoreCapabilityDriver
15+
16+
17+
[universal_agent_scheduler]
18+
capabilities = em_core_*
19+
20+
21+
[CoreCapabilityDriver]
22+
username = admin
23+
password = admin
24+
user_api_base_url = http://localhost:11010
25+
project_id = 12345678-c625-4fee-81d5-f691897b8142
26+
em_core_compute_nodes = /v1/nodes/
27+
em_core_config_configs = /v1/config/configs/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ loggers:
2222
level: WARNING
2323
propagate: False
2424

25-
genesis_core: {}
25+
genesis_universal_agent: {}
2626
bjoern: {}
2727
gcl_looper: {}
2828
gcl_sdk: {}

etc/systemd/gc-agent.service

Lines changed: 0 additions & 12 deletions
This file was deleted.

etc/systemd/gc-status-api.service

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Unit]
2+
Description=Genesis Core Status API
3+
After=network-online.target
4+
5+
[Service]
6+
TimeoutStopSec=5
7+
Restart=on-failure
8+
RestartSec=5s
9+
KillSignal=SIGINT
10+
ExecStartPre=/bin/sleep 2
11+
ExecStart=gc-status-api --config-file /etc/genesis_core/genesis_core.conf
12+
13+
[Install]
14+
WantedBy=multi-user.target
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Genesis Universal Agent Service
3+
After=network-online.target
4+
5+
[Service]
6+
Restart=on-failure
7+
RestartSec=5s
8+
TimeoutStopSec=5
9+
ExecStart=genesis-universal-agent --config-file /etc/genesis_universal_agent/genesis_universal_agent.conf
10+
11+
[Install]
12+
WantedBy=multi-user.target
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Genesis Universal Scheduler Service
3+
After=network-online.target
4+
5+
[Service]
6+
Restart=on-failure
7+
RestartSec=5s
8+
TimeoutStopSec=5
9+
ExecStart=genesis-universal-scheduler --config-file /etc/genesis_universal_agent/genesis_universal_agent.conf
10+
11+
[Install]
12+
WantedBy=multi-user.target

genesis/genesis.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ build:
2828
# Local path
2929
http:
3030
src: http://repository.genesis-core.tech:8081/seed_os/latest/vmlinuz
31+
32+
# Take SDK from a local path for development purposes.
33+
- dst: /opt/gcl_sdk
34+
optional: true
35+
path:
36+
env: LOCAL_GENESIS_SDK_PATH
3137

3238
# List of elements in the project
3339
elements:
@@ -46,4 +52,3 @@ build:
4652
override:
4753
disk_size: "6G"
4854
# manifest: manifests/genesis-core.yaml
49-

genesis/images/install.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ GC_PG_DB="genesis_core"
3232

3333
SYSTEMD_SERVICE_DIR=/etc/systemd/system/
3434

35+
DEV_SDK_PATH="/opt/gcl_sdk"
36+
SDK_DEV_MODE=$([ -d "$DEV_SDK_PATH" ] && echo "true" || echo "false")
37+
3538
# Install packages
3639
sudo apt update
3740
sudo apt install postgresql libev-dev libvirt-dev \
@@ -69,7 +72,6 @@ sudo cp "$GC_PATH/etc/genesis_core/logging.yaml" $GC_CFG_DIR/
6972
sudo cp "$GC_PATH/etc/genesis_core/event_type_mapping.yaml" $GC_CFG_DIR/
7073
sudo cp "$GC_PATH/genesis/images/startup_cfg.yaml" $GC_CFG_DIR/
7174
sudo cp "$GC_PATH/genesis/images/bootstrap.sh" $BOOTSTRAP_PATH/0100-gc-bootstrap.sh
72-
python3 -m uuid | sudo tee /var/lib/genesis/node-id
7375

7476
mkdir -p "$VENV_PATH"
7577
python3 -m venv "$VENV_PATH"
@@ -78,20 +80,37 @@ pip install pip --upgrade
7880
pip install -r "$GC_PATH"/requirements.txt
7981
pip install -e "$GC_PATH"
8082

83+
# In the dev mode the gcl_sdk package is installed from the local machine
84+
if [[ "$SDK_DEV_MODE" == "true" ]]; then
85+
pip uninstall -y gcl_sdk
86+
pip install -e "$DEV_SDK_PATH"
87+
fi
88+
89+
# Configuration for universal agent
90+
sudo cp -r "$GC_PATH/etc/genesis_universal_agent" /etc/
91+
8192
# Apply migrations
8293
ra-apply-migration --config-dir "$GC_PATH/etc/genesis_core/" --path "$GC_PATH/migrations"
8394
deactivate
8495

8596
# Create links to venv
8697
sudo ln -sf "$VENV_PATH/bin/gc-user-api" "/usr/bin/gc-user-api"
8798
sudo ln -sf "$VENV_PATH/bin/gc-orch-api" "/usr/bin/gc-orch-api"
99+
sudo ln -sf "$VENV_PATH/bin/gc-status-api" "/usr/bin/gc-status-api"
88100
sudo ln -sf "$VENV_PATH/bin/gc-gservice" "/usr/bin/gc-gservice"
89101
sudo ln -sf "$VENV_PATH/bin/gc-bootstrap" "/usr/bin/gc-bootstrap"
102+
sudo ln -sf "$VENV_PATH/bin/genesis-universal-agent" "/usr/bin/genesis-universal-agent"
103+
sudo ln -sf "$VENV_PATH/bin/genesis-universal-scheduler" "/usr/bin/genesis-universal-scheduler"
90104

91105
# Install Systemd service files
92106
sudo cp "$GC_PATH/etc/systemd/gc-user-api.service" $SYSTEMD_SERVICE_DIR
93107
sudo cp "$GC_PATH/etc/systemd/gc-orch-api.service" $SYSTEMD_SERVICE_DIR
108+
sudo cp "$GC_PATH/etc/systemd/gc-status-api.service" $SYSTEMD_SERVICE_DIR
94109
sudo cp "$GC_PATH/etc/systemd/gc-gservice.service" $SYSTEMD_SERVICE_DIR
110+
sudo cp "$GC_PATH/etc/systemd/genesis-universal-agent.service" $SYSTEMD_SERVICE_DIR
111+
sudo cp "$GC_PATH/etc/systemd/genesis-universal-scheduler.service" $SYSTEMD_SERVICE_DIR
95112

96113
# Enable genesis core services
97-
sudo systemctl enable gc-user-api gc-orch-api gc-gservice
114+
sudo systemctl enable gc-user-api gc-orch-api gc-status-api gc-gservice \
115+
genesis-universal-agent \
116+
genesis-universal-scheduler

0 commit comments

Comments
 (0)