Step: openstack-conf-resourcenames

Selects the values for OPENSTACK_EXTERNAL_NETWORK, OPENSTACK_COMPUTE_FLAVOR and ZONES based on a matrix that uses CLUSTER_TYPE. Also generates a safe CLUSTER_NAME. All values are persisted in $SHARED_DIR.

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
OPENSTACK_EXTERNAL_NETWORK Parameter[?] If not passed, the command script chooses the value based on CLUSTER_TYPE.
OPENSTACK_CONTROLPLANE_FLAVOR Parameter[?] If not passed, the command script chooses the value based on CLUSTER_TYPE.
OPENSTACK_COMPUTE_FLAVOR Parameter[?] If not passed, the command script chooses the value based on CLUSTER_TYPE.
ZONES Parameter[?] If not passed, the command script chooses the value based on CLUSTER_TYPE.
CLUSTER_TYPE_OVERRIDE Parameter[?] This will override CLUSTER_TYPE in the `commands` file if set.

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
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/bin/env bash

set -Eeuo pipefail

CLUSTER_TYPE="${CLUSTER_TYPE_OVERRIDE:-$CLUSTER_TYPE}"

declare -A external_network=(
	['openstack-kuryr']='external'
	['openstack-vexxhost']='public'
	['openstack-vh-mecha-central']='external'
	['openstack-vh-mecha-az0']='external'
	['openstack-nfv']='hostonly'
	['openstack']='external'
	)

declare -A controlplane_flavor=(
	['openstack-kuryr']='m1.xlarge'
	['openstack-vexxhost']='ci.m1.xlarge'
	['openstack-vh-mecha-central']='m1.xlarge'
	['openstack-vh-mecha-az0']='m1.xlarge'
	['openstack-nfv']='m1.xlarge'
	['openstack']='m1.s2.xlarge'
	)

declare -A compute_flavor=(
	['openstack-kuryr']='m1.xlarge'
	['openstack-vexxhost']='ci.m1.xlarge'
	['openstack-vh-mecha-central']='m1.xlarge'
	['openstack-vh-mecha-az0']='m1.xlarge'
	['openstack-nfv']='m1.xlarge.nfv'
	['openstack']='m1.s2.xlarge'
	)

declare -A compute_azs=(
	['openstack-kuryr']=''
	['openstack-vexxhost']=''
	['openstack-vh-mecha-central']=''
	['openstack-vh-mecha-az0']='az0'
	['openstack-nfv']=''
	['openstack']=''
	)

declare -A bastion_flavor=(
	['openstack-kuryr']=''
	['openstack-vexxhost']='1vcpu_2gb'
	['openstack-vh-mecha-central']='m1.small'
	['openstack-vh-mecha-az0']='m1.small'
	['openstack-nfv']='m1.small'
	['openstack']=''
	)

if [[ -z "${OPENSTACK_EXTERNAL_NETWORK:-}" ]]; then
	if [[ -z "${CLUSTER_TYPE:-}" ]]; then
		echo 'Set CLUSTER_TYPE or OPENSTACK_EXTERNAL_NETWORK'
		exit 1
	fi

	if ! [[ -v external_network[$CLUSTER_TYPE] ]]; then
		echo "OPENSTACK_EXTERNAL_NETWORK value for CLUSTER_TYPE '$CLUSTER_TYPE' not known."
		exit 1
	fi

	OPENSTACK_EXTERNAL_NETWORK="${external_network[$CLUSTER_TYPE]}"
fi

if [[ -z "${OPENSTACK_CONTROLPLANE_FLAVOR:-}" ]]; then
	if [[ -z "${CLUSTER_TYPE:-}" ]]; then
		echo 'Set CLUSTER_TYPE or OPENSTACK_CONTROLPLANE_FLAVOR'
		exit 1
	fi

	if ! [[ -v controlplane_flavor[$CLUSTER_TYPE] ]]; then
		echo "OPENSTACK_CONTROLPLANE_FLAVOR value for CLUSTER_TYPE '$CLUSTER_TYPE' not known."
		exit 1
	fi

	OPENSTACK_CONTROLPLANE_FLAVOR="${controlplane_flavor[$CLUSTER_TYPE]}"
fi

if [[ -z "${OPENSTACK_COMPUTE_FLAVOR:-}" ]]; then
	if [[ -z "${CLUSTER_TYPE:-}" ]]; then
		echo 'Set CLUSTER_TYPE or OPENSTACK_COMPUTE_FLAVOR'
		exit 1
	fi

	if ! [[ -v compute_flavor[$CLUSTER_TYPE] ]]; then
		echo "OPENSTACK_COMPUTE_FLAVOR value for CLUSTER_TYPE '$CLUSTER_TYPE' not known."
		exit 1
	fi

	OPENSTACK_COMPUTE_FLAVOR="${compute_flavor[$CLUSTER_TYPE]}"
fi

if [[ -z "${ZONES:-}" ]]; then
	if [[ -z "${CLUSTER_TYPE:-}" ]]; then
		echo 'Set CLUSTER_TYPE or ZONES'
		exit 1
	fi

	if ! [[ -v compute_azs[$CLUSTER_TYPE] ]]; then
		echo "ZONES value for CLUSTER_TYPE '$CLUSTER_TYPE' not known."
		exit 1
	fi

	ZONES="${compute_azs[$CLUSTER_TYPE]}"
fi

if [[ -z "${BASTION_FLAVOR:-}" ]]; then
	if [[ -z "${CLUSTER_TYPE:-}" ]]; then
		echo 'Set CLUSTER_TYPE or BASTION_FLAVOR'
		exit 1
	fi

	if ! [[ -v bastion_flavor[$CLUSTER_TYPE] ]]; then
		echo "BASTION_FLAVOR value for CLUSTER_TYPE '$CLUSTER_TYPE' not known."
		exit 1
	fi

	BASTION_FLAVOR="${bastion_flavor[$CLUSTER_TYPE]}"
fi

cat <<< "$OPENSTACK_EXTERNAL_NETWORK"    > "${SHARED_DIR}/OPENSTACK_EXTERNAL_NETWORK"
cat <<< "$OPENSTACK_CONTROLPLANE_FLAVOR" > "${SHARED_DIR}/OPENSTACK_CONTROLPLANE_FLAVOR"
cat <<< "$OPENSTACK_COMPUTE_FLAVOR"      > "${SHARED_DIR}/OPENSTACK_COMPUTE_FLAVOR"
cat <<< "$ZONES"                         > "${SHARED_DIR}/ZONES"
cat <<< "$BASTION_FLAVOR"                > "${SHARED_DIR}/BASTION_FLAVOR"


# We have to truncate cluster name to 14 chars, because there is a limitation in the install-config
# Now it looks like "ci-op-rl6z646h-65230".
# We will remove "ci-op-" prefix from there to keep just last 14 characters. and it cannot start with a "-"
UNSAFE_CLUSTER_NAME="${NAMESPACE}-${JOB_NAME_HASH}"
cat <<< "${UNSAFE_CLUSTER_NAME/ci-??-/}" > "${SHARED_DIR}/CLUSTER_NAME"

cat <<EOF
CLUSTER_TYPE: $CLUSTER_TYPE
OPENSTACK_EXTERNAL_NETWORK: $OPENSTACK_EXTERNAL_NETWORK
OPENSTACK_CONTROLPLANE_FLAVOR: $OPENSTACK_CONTROLPLANE_FLAVOR
OPENSTACK_COMPUTE_FLAVOR: $OPENSTACK_COMPUTE_FLAVOR
CLUSTER_NAME: $(cat ${SHARED_DIR}/CLUSTER_NAME)
ZONES: $ZONES
BASTION_FLAVOR: $BASTION_FLAVOR
EOF

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/resourcenames/openstack-conf-resourcenames-ref.yaml

Owners:

Approvers:

Reviewers:

Source code for this page located on GitHub