Step: openstack-conf-exportcindercredentials

Prepares a file to export the OpenStack credentials for Cinder.

Container image used for this step: openstack-installer

openstack-installer resolves to an image built or imported by the ci-operator configuration (documentation).

Environment

In addition to the default environment, the step exposes the following:

Variable Name Type Variable Content
OS_CLOUD Parameter[?] Name of cloud to use from ${SHARED_DIR}/clouds.yaml file (default: openstack)

Source Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash

set -o nounset
set -o errexit
set -o pipefail

export OS_CLIENT_CONFIG_FILE="${SHARED_DIR}/clouds.yaml"

clouds_to_env="
import os
import yaml
try:
    from shlex import quote
except ImportError:
    from pipes import quote


cloud = os.environ.get('OS_CLOUD')
if not cloud:
    print('OS_CLOUD isn\'t set. Export your cloud environment with OS_CLOUD.')
    exit(1)

config_file = os.environ.get('OS_CLIENT_CONFIG_FILE')
if not config_file:
    print('OS_CLIENT_CONFIG_FILE isn\'t set. Export the path to clouds.yaml with OS_CLIENT_CONFIG_FILE.')
    exit(1)

# https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html
# The keys are all of the keys you'd expect from OS_* - except lower case and
# without the OS prefix. So, region name is set with region_name.
def parse_key(clouds_key, clouds_value):
    if clouds_key == 'auth':
        for k in clouds_value:
            parse_key(k, clouds_value[k])
    elif not clouds_key == 'regions':
        print('export OS_%s=%s' % (clouds_key.upper(), quote(str(clouds_value))))

with open(config_file) as f:
    data = yaml.safe_load(f)
    if not data.get('clouds', {}).get(cloud):
        print('Cloud %s doesn\'t exist in %s' % (cloud, config_file))
        exit(1)
    for k in data['clouds'][cloud]:
        parse_key(k, data['clouds'][cloud][k])
"

python -c "$clouds_to_env" > "${SHARED_DIR}/cinder_credentials.sh"

Properties

Property Value Description
Resource requests (cpu) 10m Used in .resources.requests of the pod running this step.
Resource requests (memory) 100Mi Used in .resources.requests of the pod running this step.

GitHub Link:

https://github.com/openshift/release/blob/master/ci-operator/step-registry/openstack/conf/exportcindercredentials/openstack-conf-exportcindercredentials-ref.yaml

Owners:

Approvers:

Reviewers:

Source code for this page located on GitHub