Step: shiftstack-quotas

Check that CI clouds are not running on low quotas and if it's the case, report which resources are low.

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[?] (default: openstack)
CLOUD_NAME Parameter[?] The friendly name of the target cloud. Required.
MIN_PERCENTAGE Parameter[?] Minimum percentage from total resources that must be available. For example, if set to 15, this workflow will check that all resources (RAM, Cores, etc) have a minimum of 15% available based on the total quota that was given to the tenant. (default: 15)

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
#!/usr/bin/env bash

set -Eeuo pipefail

export OS_CLOUD
export OS_CLIENT_CONFIG_FILE="${SHARED_DIR}/clouds.yaml"
MIN_PERCENTAGE=${MIN_PERCENTAGE:-15}

message() {
	echo 'Quotas are low on '"$CLOUD_NAME"'.\n```'
	cat "${ARTIFACT_DIR}/output.txt"
	echo '```'
}

notify_low_quota() {
	declare -r code="$?"

	if [ $code -eq 11 ]; then
		declare payload
		payload='{"text":"'"$(message)"'"}'

		curl -X POST \
			-H 'Content-type: application/json' \
			--data "$payload" \
			"$(</var/run/slack-hooks/shiftstack-bot)"

		return 0
	fi
	return $code
}

./borderline.sh --min-percentage "${MIN_PERCENTAGE}" \
	> "${ARTIFACT_DIR}/output.txt" \
	|| notify_low_quota

Properties

Property Value Description
Resource requests (cpu) 1000m 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/shiftstack/quotas/shiftstack-quotas-ref.yaml

Owners:

Approvers:

Reviewers:

Source code for this page located on GitHub