Step: ocm-e2e-clusterpool-checkout

This step checks out hub and managed clusters from the given cluster pools.

Container image used for this step: open-cluster-management/builder:go1.16-linux

open-cluster-management/builder:go1.16-linux resolves to an image imported from the specified imagestream tag on the build farm (documentation).

Environment

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

Variable Name Type Variable Content
MAKEFILE Parameter[?] Location of the build harness Makefile for use on OSCI. (default: /opt/build-harness/Makefile.prow)
CLUSTERPOOL_HOST_API Parameter[?] API URL of the cluster running the target clusterpool, used in oc login, so port :6443 is required (default: https://api.collective.aws.red-chesterfield.com:6443)
CLUSTERPOOL_HOST_NAMESPACE Parameter[?] Namespace on the cluster pool host to use.
CLUSTERPOOL_HOST_PROW_KUBE_SECRET Parameter[?] The name of the kube secret with the kube API user and token.
CLUSTERPOOL_GROUP_NAME Parameter[?] Specifies an RBAC group to be added to the subjects array of the cluster claim. This can be set to the RBAC group for the squad running the test so that all members of that squad can access the cluster checked out. (default: system:masters)
CLUSTERPOOL_LIST Parameter[?] A comma separated list of cluster pools to use when attempting to checkout a cluster.
CLUSTERPOOL_LIST_FILE Parameter[?] File name to use for the cluster pool list to use when attempting to checkout a cluster. Only used if CLUSTERPOOL_LIST is empty. (default: clusterpool-list)
CLUSTERPOOL_HUB_COUNT Parameter[?] The number of hub clusters to checkout. (default: 1)
CLUSTERPOOL_MANAGED_COUNT Parameter[?] The number of managed clusters to checkout. (default: 0)
CLUSTER_CLAIM_FILE Parameter[?] File name to use to store the cluster claim names. (default: cluster-claims)
CLUSTERPOOL_LIFETIME Parameter[?] Lifetime of each cluster that's checked out of the clusterpool. Set to an empty string to not have a lifetime. The lifetime can be any positive value accepted by Go's time.ParseDuration function. (default: 48h)
CLUSTERPOOL_CHECKOUT_TIMEOUT_MINUTES Parameter[?] Time to wait for a newly checked out cluster to become ready. (default: 10)

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

temp=$(mktemp -d -t ocm-XXXXX)
cd $temp || exit 1

cp "$MAKEFILE" ./Makefile

pools=""
if [[ -n "$CLUSTERPOOL_LIST" ]] ; then
    pools=$(echo "$CLUSTERPOOL_LIST" | tr "," "\n")
elif [[ -f "${SHARED_DIR}/${CLUSTERPOOL_LIST_FILE}" ]] ; then
    pools=$(cat "${SHARED_DIR}/${CLUSTERPOOL_LIST_FILE}")
fi

if [[ -z "$pools" ]]; then
    echo "No pools specified by CLUSTERPOOL_LIST or CLUSTERPOOL_LIST_FILE"
    exit 1
fi

suffix=$(cat /dev/urandom | tr -dc "a-z0-9" | head -c 5 )

# Checkout hub clusters
for ((i=1;i<=CLUSTERPOOL_HUB_COUNT;i++)); do
    cluster_claim=""
    for pool in $pools; do
        tmp_claim="hub-$i-$suffix"
        make clusterpool/checkout \
            CLUSTERPOOL_NAME=$pool \
            CLUSTERPOOL_CLUSTER_CLAIM=$tmp_claim
    
        if [[ "$?" == 0 ]]; then
            cluster_claim="$tmp_claim"
            break
        fi
    done
    
    if [[ -z "$cluster_claim" ]]; then
        echo "No cluster was checked out for hub $i. Tried these cluster pools:"
        echo "$pools"
        exit 1
    fi
    
    echo "$cluster_claim" >> "${SHARED_DIR}/${CLUSTER_CLAIM_FILE}"
done


# Checkout managed clusters
for ((i=1;i<=CLUSTERPOOL_MANAGED_COUNT;i++)); do
    cluster_claim=""
    for pool in $pools; do
        tmp_claim="managed-$i-$suffix"
        make clusterpool/checkout \
            CLUSTERPOOL_NAME=$pool \
            CLUSTERPOOL_CLUSTER_CLAIM=$tmp_claim
    
        if [[ "$?" == 0 ]]; then
            cluster_claim="$tmp_claim"
            break
        fi
    done
    
    if [[ -z "$cluster_claim" ]]; then
        echo "No cluster was checked out for managed $i. Tried these cluster pools:"
        echo "$pools"
        exit 1
    fi
    
    echo "$cluster_claim" >> "${SHARED_DIR}/${CLUSTER_CLAIM_FILE}"
done


echo "Cluster claims:"
cat "${SHARED_DIR}/${CLUSTER_CLAIM_FILE}"

Properties

Property Value Description
Resource requests (cpu) 100m 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/ocm/e2e/clusterpool/checkout/ocm-e2e-clusterpool-checkout-ref.yaml

Owners:

Approvers:

Source code for this page located on GitHub