9cac3c6b63
The k8s-on-openstack project produces an opinionated kubernetes that is correctly set up to be integrated with OpenStack. All of the patches we've submitted to update it for our environment have been landed upstream, so just consume it directly. It's possible we might want to take a more hands-on forky approach in the future, but for now it seems fairly stable. Change-Id: I4ff605b6a947ab9b9f3d0a73852dde74c705979f
31 lines
768 B
Python
31 lines
768 B
Python
import argparse
|
|
import sys
|
|
|
|
import openstack
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument(
|
|
"--cloud", dest="cloud", required=True,
|
|
help="cloud name")
|
|
parser.add_argument(
|
|
"--region", dest="region", required=True,
|
|
help="cloud region")
|
|
|
|
options = parser.parse_args()
|
|
|
|
cloud_region = openstack.config.OpenStackConfig().get_one(
|
|
cloud=options.cloud, region_name=options.region)
|
|
|
|
print("export OS_REGION_NAME='{region_name}'".format(
|
|
region_name=cloud_region.region_name))
|
|
for k, v in cloud_region.auth.items():
|
|
print("export OS_{key}='{value}'".format(
|
|
key=k.upper(),
|
|
value=v))
|
|
return 0
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|