forked from openshift/osde2e
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-ocp-cluster.sh
More file actions
executable file
·44 lines (31 loc) · 1.51 KB
/
create-ocp-cluster.sh
File metadata and controls
executable file
·44 lines (31 loc) · 1.51 KB
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
#!/usr/bin/env bash
mkdir -p installer
RELEASE_URL="https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest"
RELEASE_IMAGE=$(curl -s "${RELEASE_URL}/release.txt" | grep 'Pull From: quay.io' | awk -F ' ' '{print $3}')
if [ -z "${AWS_ACCESS_KEY_ID+x}" ]; then
echo "Assuming the AWS Access token should be read from Prow";
AWS_ACCESS_KEY_ID=$(cat /usr/local/osde2e-credentials/aws-access-key-id)
export AWS_ACCESS_KEY_ID
fi
if [ -z "${AWS_SECRET_ACCESS_KEY+x}" ]; then
echo "Assuming the AWS Secret token should be read from Prow";
AWS_SECRET_ACCESS_KEY=$(cat /usr/local/osde2e-credentials/aws-secret-access-key)
export AWS_SECRET_ACCESS_KEY
fi
if [ -z "${PULL_SECRET_FILE+x}" ]; then
echo "Assuming the Pull Secret should be read from Prow";
PULL_SECRET_FILE=/usr/local/osde2e-credentials/stage-ocm-pull-secret
fi
if [ -z "${INSTALLER_CONFIG+x}" ]; then
echo "Assuming the Installer Config should be read from Prow";
INSTALLER_CONFIG=/usr/local/osde2e-credentials/stage-installer-config
fi
cp "${INSTALLER_CONFIG}" ./installer/install-config.yaml
curl -s "${RELEASE_URL}/openshift-client-linux.tar.gz" | tar zxvf - oc
chmod +x oc
./oc adm release extract --registry-config "${PULL_SECRET_FILE}" --command=openshift-install --to "$(pwd)/" "${RELEASE_IMAGE}"
chmod +x openshift-install
./openshift-install create cluster --dir=./installer/ --log-level info
cp "${INSTALLER_CONFIG}" "${SHARED_DIR}"
cp ./installer/metadata.json "${SHARED_DIR}"
cp ./installer/auth/kubeconfig "${SHARED_DIR}"