Skip to content

Commit

Permalink
Add support for OKD deployments (openshift-metal3#1578)
Browse files Browse the repository at this point in the history
This change removes the requirement for the CI_TOKEN. This allows users
to provision OKD clusters without needing to login and provide the
CI_TOKEN first. Ultimately making this project more accessible to the
wider OKD community.

Deploying OKD can be achieved by setting the following:
export OPENSHIFT_RELEASE_IMAGE=registry.ci.openshift.org/origin/release:4.13.0-0.okd-2023-08-29-213951
export PULL_SECRET_FILE=pull_secret.json
export OPENSHIFT_RELEASE_TYPE=okd

Signed-off-by: Brendan Shephard <[email protected]>
  • Loading branch information
bshephar authored Sep 8, 2023
1 parent 0d9f0ce commit 05ab9e5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions 02_configure_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,9 @@ if [[ ! -z "${BOND_PRIMARY_INTERFACE:-}" ]]; then
setup_bond master $NUM_MASTERS
setup_bond worker $NUM_WORKERS
fi

# We should have both virsh networks started by this point.
# Let's do a quick validation here before moving to the next
# stage
sudo virsh net-list | grep ${PROVISIONING_NETWORK_NAME} || sudo virsh net-start ${PROVISIONING_NETWORK_NAME}
sudo virsh net-list | grep ${BAREMETAL_NETWORK_NAME} || sudo virsh net-start ${BAREMETAL_NETWORK_NAME}
3 changes: 2 additions & 1 deletion 03_build_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ else
# Clone and build the installer from source
clone_installer
build_installer
fi
fi

11 changes: 10 additions & 1 deletion config_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,20 @@ set -x
# Select a different release type from which to pull the latest image.
# If using ga then set OPENSHIFT_VERSION to the required version.
# Default: nightly
# Choices: ci, nightly, ga
# Choices: ci, nightly, ga, okd
# NOTE: Do not use for arm64, instead override OPENSHIFT_RELEASE_IMAGE
# NOTE: If set to okd, a OPENSHIFT_RELEASE_IMAGE is required. See the below
# section on OPENSHIFT_RELEASE_IMAGE for an example.
#
#export OPENSHIFT_RELEASE_TYPE=nightly

# OPENSHIFT_RELEASE_IMAGE -
# Define a specific image to deploy the cluster from. If using OKD,
# this can be set to an image from: https://amd64.origin.releases.ci.openshift.org
# For example:
# export OPENSHIFT_RELEASE_IMAGE=registry.ci.openshift.org/origin/release:4.15.0-0.okd-2023-08-29-101209
# Default: Undefined

# OPENSHIFT_VERSION -
# Set the Openshift version. If unset defaults to $OPENSHIFT_RELEASE_STREAM.
# NOTE: Do not use for arm64, instead override OPENSHIFT_RELEASE_IMAGE
Expand Down
3 changes: 3 additions & 0 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,9 @@ function verify_pull_secret() {
}

function write_pull_secret() {
if [ "${OPENSHIFT_RELEASE_TYPE}" == "okd" ]; then
return
fi
if [ "${OPENSHIFT_CI}" == true ]; then
# We don't need to fetch a personal pull secret with the
# token, but we still need to merge what we're given with the
Expand Down
4 changes: 2 additions & 2 deletions validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function early_deploy_validation() {

early_either_validation

if [ ! -s ${PERSONAL_PULL_SECRET} ]; then
if [ ! -s ${PERSONAL_PULL_SECRET} -a ${OPENSHIFT_RELEASE_TYPE} != "okd" ]; then
error "${PERSONAL_PULL_SECRET} is missing or empty"
if [ -n "${PULL_SECRET:-}" ]; then
error "It looks like you are using the old PULL_SECRET variable."
Expand All @@ -67,7 +67,7 @@ function early_deploy_validation() {
exit 1
fi

if [ "${OPENSHIFT_CI}" != "true" -a ${#CI_TOKEN} = 0 ]; then
if [ "${OPENSHIFT_CI}" != "true" -a ${#CI_TOKEN} = 0 -a "${OPENSHIFT_RELEASE_TYPE}" != "okd" ]; then
error "No valid CI_TOKEN set in ${CONFIG}"
if [ -n "${PULL_SECRET:-}" ]; then
error "It looks like you are using the old PULL_SECRET variable."
Expand Down

0 comments on commit 05ab9e5

Please sign in to comment.