Step: shiftstack-liveliness

Checks that CI clouds are running fine.

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)
TESTING_IMAGE Parameter[?] The image of the testing machine (default: centos8-stream)
TESTING_FLAVOR Parameter[?] The flavor of the testing machine. Defaults to the value in "${SHARED_DIR}/BASTION_FLAVOR"
IMAGE_USER Parameter[?] The user of the testing machine (default: centos)
OPENSTACK_EXTERNAL_NETWORK Parameter[?] Name of the OpenStack public-facing network. Defaults to the value in "${SHARED_DIR}/OPENSTACK_EXTERNAL_NETWORK"

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

set -Eeuo pipefail

export OS_CLOUD
export OS_CLIENT_CONFIG_FILE="${SHARED_DIR}/clouds.yaml"
CLUSTER_NAME=$(<"${SHARED_DIR}/CLUSTER_NAME")
OPENSTACK_EXTERNAL_NETWORK="${OPENSTACK_EXTERNAL_NETWORK:-$(<"${SHARED_DIR}/OPENSTACK_EXTERNAL_NETWORK")}"
# Recycling BASTION_FLAVOR as it's a small flavor we can re-use.
TESTING_FLAVOR="${TESTING_FLAVOR:-$(<"${SHARED_DIR}/BASTION_FLAVOR")}"

# TODO - this logic could leave in shiftstack-ci/server script at some point.
ssh-keygen -t rsa -N "" -f shiftstack-ci
chmod 0600 shiftstack-ci
eval "$(ssh-agent)"
if ! whoami &> /dev/null; then
  if [ -w /etc/passwd ]; then
    echo "${IMAGE_USER:-centos}:x:$(id -u):0:${IMAGE_USER:-centos} user:${HOME}:/sbin/nologin" >> /etc/passwd
  fi
fi
ssh-add shiftstack-ci
openstack keypair create --public-key shiftstack-ci.pub shiftstack-ci-${CLUSTER_NAME} >/dev/null

set +e
echo "DEBUG: Running liveliness check script..."
./server.sh -d -t -u ${IMAGE_USER} -f ${TESTING_FLAVOR} -i ${TESTING_IMAGE} -e ${OPENSTACK_EXTERNAL_NETWORK} -k shiftstack-ci-${CLUSTER_NAME} shiftstack-ci-${CLUSTER_NAME}
RC=$?
echo "DEBUG: Removing shiftstack-ci-${CLUSTER_NAME} keypair"
openstack keypair delete shiftstack-ci-${CLUSTER_NAME}
rm shiftstack-ci shiftstack-ci.pub
set -e

if [ $RC -ne 0 ]; then
  echo "ERROR: Some errors were found during liveliness check..."
  exit 1
fi

echo "DEBUG: Cloud is alive!"

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/liveliness/shiftstack-liveliness-ref.yaml

Owners:

Approvers:

Reviewers:

Source code for this page located on GitHub