#!/bin/bash # Utility to execute OpenStack CLI using utility container. # This is an example, and should be adjusted to ones needs. # # Usage: openstack endpoint list set -e OS_CLOUD_CFG=${HOME}/.openstack/clouds.yaml : ${TERM_OPTS:=-it} : ${OSH_KEYSTONE_URL:='http://keystone.openstack.svc.cluster.local:80/'} : ${OSH_REGION_NAME:='RegionOne'} : ${OSH_ADMIN_PASSWD:='password123'} if [ ! -f $OS_CLOUD_CFG ]; then echo " => Creating OpenStack client config" mkdir -p $(dirname $OS_CLOUD_CFG) tee $OS_CLOUD_CFG << EOF clouds: openstack_helm: region_name: '${OSH_REGION_NAME}' identity_api_version: 3 auth: username: 'admin' password: '${OSH_ADMIN_PASSWD}' project_name: 'admin' project_domain_name: 'default' user_domain_name: 'default' auth_url: '${OSH_KEYSTONE_URL}' EOF fi exec sudo docker run --rm ${TERM_OPTS} --net host \ -v $(pwd):/target \ -v ${OS_CLOUD_CFG}:/etc/openstack/clouds.yaml:ro \ -e OS_CLOUD=openstack_helm \ quay.io/airshipit/porthole-openstack-utility:latest-ubuntu_focal openstack "$@"