From e6befeb7b49c0938d1281a4d10f8aa37365291be Mon Sep 17 00:00:00 2001 From: "Munoz, Obed N" Date: Fri, 21 Oct 2016 08:14:25 -0500 Subject: [PATCH] Add ciao-scheduler container Signed-off-by: Munoz, Obed N --- scheduler/Dockerfile | 12 ++++++ scheduler/README.md | 74 ++++++++++++++++++++++++++++++++++++ scheduler/ciaorc | 4 ++ scheduler/configuration.yaml | 21 ++++++++++ scheduler/scheduler.sh | 13 +++++++ 5 files changed, 124 insertions(+) create mode 100644 scheduler/Dockerfile create mode 100644 scheduler/README.md create mode 100644 scheduler/ciaorc create mode 100644 scheduler/configuration.yaml create mode 100755 scheduler/scheduler.sh diff --git a/scheduler/Dockerfile b/scheduler/Dockerfile new file mode 100644 index 0000000..1db8577 --- /dev/null +++ b/scheduler/Dockerfile @@ -0,0 +1,12 @@ +FROM ciao/common +MAINTAINER obed.n.munoz@intel.com + +ARG swupd_args + +COPY *.sh /root/ +RUN mkdir /etc/ciao + +COPY configuration.yaml /etc/ciao/ +COPY ciaorc /root/ + +CMD '/root/scheduler.sh' \ No newline at end of file diff --git a/scheduler/README.md b/scheduler/README.md new file mode 100644 index 0000000..256a25d --- /dev/null +++ b/scheduler/README.md @@ -0,0 +1,74 @@ +CIAO Scheduler +============== +[![](https://images.microbadger.com/badges/image/clearlinux/ciao-scheduler.svg)](http://microbadger.com/images/clearlinux/ciao-scheduler "Get your own image badge on microbadger.com") +[![](https://images.microbadger.com/badges/version/clearlinux/ciao-scheduler.svg)](http://microbadger.com/images/clearlinux/scheduler "Get your own version badge on microbadger.com") + +This provides a CIAO Scheduler container + +Features +-------- +- From source building solution +- Daemon and Manual service start mode +- You mess it, just destroy it and start it again +- Develop on you local development machine and deploy it on containers. +- No data/binary copies, everything can be accesible from container + +Build +----- +``` + docker build -t clearlinux/ciao-scheduler . +``` + +Or just pull it from Dockerhub +------------------------------ +``` + docker pull clearlinux/ciao-scheduler +``` + +Pre-requirements +---------------- +Before launching scheduler, take a look on [CIAO on top of Docker containers for development]() + +Start CIAO Scheduler container +----------------------------- +### Run in daemon mode +``` +export YOUR_HOST=localhost +docker run -d -it -v --name ciao-scheduler --net=host -v `pwd`/certs/CAcert-$YOUR_HOST.pem:/etc/pki/ciao/CAcert-ciao-dev.pem \ + -v `pwd`/certs/cert-Scheduler-$YOU_HOST.pem:/etc/pki/ciao/cert-Scheduler-ciao-dev.pem \ + -e IDENTITY_HOST=$YOUR_HOST \ + -v $GOPATH/src/github.com/01org/ciao:/root/go/src/github.com/01org/ciao \ + ciao/scheduler +``` + +### Run on manual mode +``` +export YOUR_HOST=localhost +docker run -d -it -v --name ciao-scheduler --net=host -v `pwd`/certs/CAcert-$YOUR_HOST.pem:/etc/pki/ciao/CAcert-ciao-dev.pem \ + -v `pwd`/certs/cert-Scheduler-$YOU_HOST.pem:/etc/pki/ciao/cert-Scheduler-ciao-dev.pem \ + -e IDENTITY_HOST=$YOUR_HOST \ + -v $GOPATH/src/github.com/01org/ciao:/root/go/src/github.com/01org/ciao \ + ciao/scheduler bash + +# Inside container +root@example.com # ls +ciaorc go scheduler.sh share + +# Manual Start of Ciao Scheduler +root@example.com # ./scheduler.sh +``` + +### Getting CIAO Scheduler logs from docker +``` +docker logs -f ciao-scheduler +``` + +Environment Variables +--------------------- +- ``IDENTITY_HOST`` Specifies the Keystone URL. Example: example.com + +Extra Build ARGs +---------------- +- ``swupd_args`` Specifies [SWUPD](https://clearlinux.org/documentation/swupdate_how_to_run_the_updater.html) flags + +Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#/arg diff --git a/scheduler/ciaorc b/scheduler/ciaorc new file mode 100644 index 0000000..f3178fd --- /dev/null +++ b/scheduler/ciaorc @@ -0,0 +1,4 @@ +export CIAO_CONTROLLER=192.168.0.1 +export CIAO_IDENTITY=https://192.168.0.1:35357 +export CIAO_USERNAME=admin +export CIAO_PASSWORD=secret \ No newline at end of file diff --git a/scheduler/configuration.yaml b/scheduler/configuration.yaml new file mode 100644 index 0000000..0c11998 --- /dev/null +++ b/scheduler/configuration.yaml @@ -0,0 +1,21 @@ +configure: + scheduler: + storage_type: file + storage_uri: /etc/ciao/configuration.yaml + controller: + compute_port: 8774 + compute_ca: /etc/pki/ciao/controller_cert.pem + compute_cert: /etc/pki/ciao/controller_key.pem + identity_user: admin + identity_password: secret + launcher: + compute_net: [192.168.0.1/24] + mgmt_net: [192.168.0.1/24] + disk_limit: false + mem_limit: false + image_service: + type: glance + url: http://HOST + identity_service: + type: keystone + url: https://IDENTITY_HOST:35357 \ No newline at end of file diff --git a/scheduler/scheduler.sh b/scheduler/scheduler.sh new file mode 100755 index 0000000..0d2e104 --- /dev/null +++ b/scheduler/scheduler.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -x + +IDENTITY_HOST="${IDENTITY_HOST:-localhost}" + +sed -i.bak s/IDENTITY_HOST/$IDENTITY_HOST/g /etc/ciao/configuration.yaml + +# compile the code before running it +go install github.com/01org/ciao/... +cp -f $GOBIN/* /usr/bin + +# Starting Scheduler +$GOBIN/ciao-scheduler --cacert=/etc/pki/ciao/CAcert-ciao-dev.pem --cert=/etc/pki/ciao/cert-Scheduler-ciao-dev.pem --heartbeat