Skip to content

Commit

Permalink
Add devstack plugin (#118)
Browse files Browse the repository at this point in the history
* Add devstack plugin
  • Loading branch information
vyzigold authored Oct 18, 2023
1 parent 0a5d5bc commit 3b14744
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
Empty file added devstack/override-defaults
Empty file.
51 changes: 51 additions & 0 deletions devstack/plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
function preinstall_sg-core {
install_package $SG_CORE_CONTAINER_EXECUTABLE
}

function install_sg-core {
$SG_CORE_CONTAINER_EXECUTABLE pull $SG_CORE_CONTAINER_IMAGE
}

function configure_sg-core {
sudo mkdir -p `dirname $SG_CORE_CONF`
sudo cp $SG_CORE_DIR/devstack/sg-core.conf.yaml $SG_CORE_CONF
}

function init_sg-core {
$SG_CORE_CONTAINER_EXECUTABLE run -v $SG_CORE_CONF:/etc/sg-core.conf.yaml --network host --name sg-core -d $SG_CORE_CONTAINER_IMAGE
}

# check for service enabled
if is_service_enabled sg-core; then

if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
# Set up system services
echo_summary "Configuring system services sg-core"
preinstall_sg-core

elif [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of service source
echo_summary "Installing sg-core"
install_sg-core

elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configuring sg-core"
configure_sg-core

elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize and start the sg-core service
echo_summary "Initializing sg-core"
init_sg-core
fi

if [[ "$1" == "unstack" ]]; then
$SG_CORE_CONTAINER_EXECUTABLE stop sg-core
$SG_CORE_CONTAINER_EXECUTABLE rm sg-core
fi

if [[ "$1" == "clean" ]]; then
$SG_CORE_CONTAINER_EXECUTABLE rmi sg-core:latest
fi
fi

14 changes: 14 additions & 0 deletions devstack/settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
define_plugin sg-core
plugin_requires sg-core ceilometer
enable_service sg-core
enable_service ceilometer

SG_CORE_DIR=$DEST/sg-core
SG_CORE_CONF_DIR=/etc/sg-core
SG_CORE_CONF=$SG_CORE_CONF_DIR/sg-core.conf.yaml

SG_CORE_CONTAINER_REPOSITORY=${SG_CORE_CONTAINER_REPOSITORY:-quay.io/infrawatch/sg-core}
SG_CORE_CONTAINER_TAG=${SG_CORE_CONTAINER_TAG:-latest}
SG_CORE_CONTAINER_IMAGE=$SG_CORE_CONTAINER_REPOSITORY:$SG_CORE_CONTAINER_TAG

SG_CORE_CONTAINER_EXECUTABLE="podman"
20 changes: 20 additions & 0 deletions devstack/sg-core.conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

pluginDir: /usr/lib64/sg-core
logLevel: debug

transports:
- name: socket
config:
type: tcp
socketaddr: 127.0.0.1:4242
handlers:
- name: ceilometer-metrics
config:
source: tcp

applications:
- name: prometheus
config:
host: 0.0.0.0
port: 3000

0 comments on commit 3b14744

Please sign in to comment.