install -d -o $USER -g $USER -m 771 /opt/app-root/src/kafka/truststore/
install -d -o $USER -g $USER -m 771 /opt/app-root/src/kafka/keystore/
oc extract secret/esi --to=/opt/app-root/src/kafka/keystore/ --keys=user.crt --confirm
oc extract secret/esi --to=/opt/app-root/src/kafka/keystore/ --keys=user.key --confirm
oc extract secret/esi --to=/opt/app-root/src/kafka/keystore/ --keys=user.p12 --confirm
oc extract secret/kafka-cluster-ca-cert --to=/opt/app-root/src/kafka/truststore/ --keys=ca.crt --confirm
oc extract secret/kafka-cluster-ca-cert --to=/opt/app-root/src/kafka/truststore/ --keys=ca.p12 --confirm
To establish a connection, you'll need to:
-
put the clouds.yaml file in
~/.config/openstack/clouds.yaml
. You can refer to theexample_clouds.yaml
for a sample clouds.yaml. -
set the environment variable
CLOUD_NAME
. For the providedexample_clouds.yaml
, the CLOUD_NAME should be set to "openstack".
Before running the application, update the following environment variables to use unique values starting with "esi-" to avoid conflicts between workbenches:
KAFKA_GROUP_FULFILL
KAFKA_TOPIC_FULFILL_OFFER
KAFKA_TOPIC_ORDER_LOOP
KAFKA_TOPIC_ORDER_STATUS
To run the application:
git clone https://github.com/CCI-MOC/demo-esi-api.git ~/demo-esi-api
cd ~/demo-esi-api
pip install -r requirements.txt
python app.py
In a separate terminal, test the request:
curl -X GET http://localhost:8081/api/v1/nodes/list
curl -X GET http://localhost:8081/api/v1/networks/list
curl -X GET http://localhost:8081/api/v1/offers/list
# Attach the network to the requested nodes:
curl -X POST http://localhost:8081/api/v1/baremetal-order/fulfill \
-H "Content-Type: application/json" \
-d '{"order_id": "123_xyz",
"network_id": "provisioning",
"nodes": [{"resource_class": "fc430", "number": 2}],
"create_floating_ip": "True"
}'
# Or provision the nodes with metalsmith
curl -X POST http://localhost:8081/api/v1/baremetal-order/fulfill \
-H "Content-Type: application/json" \
-d '{"order_id": "123_xyz",
"network_id": "network-uitest",
"nodes": [{"resource_class": "fc430", "number": 1}],
"create_floating_ip": "True",
"image": "centos-image",
"ssh_keys": [<ssh_key_string1>, <ssh_key_string2>...]
}'
pkcon install -y buildah
pkcon install -y podman
cd ~/.local/src/TLC
podman build -t nerc-images/demo-esi-api:computate-api .
podman login quay.io
podman push nerc-images/demo-esi-api:computate-api quay.io/nerc-images/demo-esi-api:computate-api
podman run -v /opt/kafka:/opt/kafka nerc-images/demo-esi-api:computate-api