Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions assisted_deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,12 @@ function patch_extra_host_manifests() {
if [ -f "${OCP_DIR}/extra_host_manifests.yaml" ]; then
cp "${OCP_DIR}/extra_host_manifests.yaml" "${ASSETS_DIR}/06-extra-host-manifests.yaml"

yq -i -Y '. | select(."kind" == "BareMetalHost") | .metadata += {"namespace":'\"${ASSISTED_NAMESPACE}\"'}' "${ASSETS_DIR}/06-extra-host-manifests.yaml"
yq -i -Y '. | select(."kind" == "BareMetalHost") | .metadata += {"namespace":"'"${ASSISTED_NAMESPACE}"'"}' "${ASSETS_DIR}/06-extra-host-manifests.yaml"
yq -i -Y '. | select(."kind" == "BareMetalHost") | .metadata.labels += {"infraenvs.agent-install.openshift.io":"myinfraenv"}' "${ASSETS_DIR}/06-extra-host-manifests.yaml"
yq -i -Y '. | select(."kind" == "BareMetalHost") | .metadata.annotations += {"inspect.metal3.io":"disabled"}' "${ASSETS_DIR}/06-extra-host-manifests.yaml"
yq -i -Y '. | select(."kind" == "BareMetalHost") | .spec += {"automatedCleaningMode":"disabled"}' "${ASSETS_DIR}/06-extra-host-manifests.yaml"
echo "---" >> "${ASSETS_DIR}/06-extra-host-manifests.yaml"
yq -Y '. | select(."kind" == "Secret") | .metadata += {"namespace":'\"${ASSISTED_NAMESPACE}\"'}' "${OCP_DIR}/extra_host_manifests.yaml" >> "${ASSETS_DIR}/06-extra-host-manifests.yaml"
yq -Y '. | select(."kind" == "Secret") | .metadata += {"namespace":'\""${ASSISTED_NAMESPACE}"\"'}' "${OCP_DIR}/extra_host_manifests.yaml" >> "${ASSETS_DIR}/06-extra-host-manifests.yaml"
fi
}

Expand Down Expand Up @@ -320,12 +320,12 @@ function install_prerequisites_assisted_service() {
# Deleting resources with `oc` is not asynchronous so we are adding a timeout in case the cluster
# or the node is under load and can't handle requests fast enough.
function delete_assisted() {
timeout 15 oc delete -n $ASSISTED_NAMESPACE agentserviceconfig --all
timeout 15 oc delete -n $ASSISTED_NAMESPACE csv --all
timeout 15 oc delete subscription -n $ASSISTED_NAMESPACE --all
timeout 15 oc delete -n $ASSISTED_NAMESPACE operatorgroup --all
timeout 15 oc delete -n "$ASSISTED_NAMESPACE" agentserviceconfig --all
timeout 15 oc delete -n "$ASSISTED_NAMESPACE" csv --all
timeout 15 oc delete subscription -n "$ASSISTED_NAMESPACE" --all
timeout 15 oc delete -n "$ASSISTED_NAMESPACE" operatorgroup --all
timeout 15 oc delete -n openshift-marketplace catalogsource assisted-service-catalog
timeout 15 oc delete ns $ASSISTED_NAMESPACE
timeout 15 oc delete ns "$ASSISTED_NAMESPACE"
}

function delete_hive() {
Expand Down
2 changes: 1 addition & 1 deletion bootkube_log.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

$(dirname $0)/show_bootstrap_log.sh bootkube.service
"$(dirname "$0")/show_bootstrap_log.sh" bootkube.service
2 changes: 1 addition & 1 deletion bootstrap_bootkube_log.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

$(dirname $0)/show_bootstrap_log.sh bootkube.service
"$(dirname "$0")/show_bootstrap_log.sh" bootkube.service
2 changes: 1 addition & 1 deletion bootstrap_ironic_log.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

$(dirname $0)/show_bootstrap_log.sh ironic.service
"$(dirname "$0")/show_bootstrap_log.sh" ironic.service
2 changes: 1 addition & 1 deletion bootstrap_openshift_log.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

$(dirname $0)/show_bootstrap_log.sh openshift.service
"$(dirname "$0")/show_bootstrap_log.sh" openshift.service
2 changes: 1 addition & 1 deletion build-base-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ if [[ -n ${BASE_IMAGE_FROM:-} ]]; then
BUILD_COMMAND_ARGS+=" --build-arg REMOVE_OLD_REPOS=no"
fi

sudo podman build --network host --tag ${BASE_IMAGE_DIR} ${BUILD_COMMAND_ARGS} -f "${BASE_IMAGE_DIR}/Dockerfile"
sudo podman build --network host --tag "${BASE_IMAGE_DIR}" "${BUILD_COMMAND_ARGS}" -f "${BASE_IMAGE_DIR}/Dockerfile"
6 changes: 5 additions & 1 deletion build-qemu-aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

set -euo pipefail

# FIXME: SCRIPT_DIR appears unused
# shellcheck disable=SC2034
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="${BUILD_DIR:-/tmp/qemu-build}"
INSTALL_PREFIX="${INSTALL_PREFIX:-/usr/local}"
Expand All @@ -28,7 +30,7 @@ echo "Building QEMU version: $QEMU_VERSION"

# Check if already installed
if [ -x "$INSTALL_PREFIX/bin/qemu-system-aarch64" ]; then
INSTALLED_VERSION=$($INSTALL_PREFIX/bin/qemu-system-aarch64 --version | head -1 | grep -oP '\d+\.\d+\.\d+' || echo "unknown")
INSTALLED_VERSION=$("$INSTALL_PREFIX/bin/qemu-system-aarch64" --version | head -1 | grep -oP '\d+\.\d+\.\d+' || echo "unknown")
if [ "$INSTALLED_VERSION" = "$QEMU_VERSION" ]; then
echo "qemu-system-aarch64 version $QEMU_VERSION is already installed at $INSTALL_PREFIX/bin/qemu-system-aarch64"
echo "Skipping build."
Expand Down Expand Up @@ -89,6 +91,8 @@ echo " - $AAVMF_CODE"
echo " - $AAVMF_VARS"

# Install meson if not available or too old
# FIXME: MESON_MIN_VERSION appears unused
# shellcheck disable=SC2034
MESON_MIN_VERSION="0.63.0"
if command -v meson &> /dev/null; then
MESON_VERSION=$(meson --version)
Expand Down
2 changes: 1 addition & 1 deletion cache_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ source validation.sh

early_cleanup_validation

rm -rf $HOME/.cache/openshift-installer
rm -rf "$HOME/.cache/openshift-installer"
12 changes: 6 additions & 6 deletions ci_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

set -e
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPTNAME="$(basename ${BASH_SOURCE[0]})"
SCRIPTNAME="$(basename "${BASH_SOURCE[0]}")"
CI_URL="http://10.8.144.11:8080/job/dev-tools"

if (( $# != 1 )); then
echo "Usage: ${SCRIPTNAME} <number of CI run>"
exit 1
fi

if ! curl --fail ${CI_URL}/$1; then
if ! curl --fail "${CI_URL}/$1"; then
echo "Error job $1 not found at ${CI_URL}"
exit 1
fi

LOGDIR="${SCRIPTDIR}/logs/ci/$1"
if [ ! -d ${LOGDIR} ]; then
mkdir -p ${LOGDIR}
pushd ${LOGDIR}
wget ${CI_URL}/${1}/artifact/logs.tgz
if [ ! -d "${LOGDIR}" ]; then
mkdir -p "${LOGDIR}"
pushd "${LOGDIR}"
wget "${CI_URL}/${1}/artifact/logs.tgz"
tar -xvzf logs.tgz
popd
echo "Done, see ${LOGDIR}"
Expand Down
8 changes: 5 additions & 3 deletions demo/launch_demo_bmo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
set -xe

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${SCRIPTDIR}/../common.sh
# shellcheck source=/dev/null
source "${SCRIPTDIR}"/../common.sh
# shellcheck disable=SC2046
eval $(go env)

# Set the project
Expand All @@ -22,12 +24,12 @@ then
oc delete deployment metalkube-baremetal-operator
fi

cd $GOPATH/src/github.com/metalkube/baremetal-operator
cd "$GOPATH/src/github.com/metalkube/baremetal-operator"

oc apply -f deploy/crds/demo-hosts.yaml

export OPERATOR_NAME=baremetal-operator

${GOPATH}/bin/operator-sdk up local \
"${GOPATH}/bin/operator-sdk" up local \
--namespace=openshift-machine-api \
--operator-flags="-dev -demo-mode"
30 changes: 15 additions & 15 deletions external_loadbalancer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ sudo firewall-cmd --zone=libvirt --add-port=8080/tcp
sudo firewall-cmd --zone=libvirt --add-port=22623/tcp

haproxy_config="${WORKING_DIR}/haproxy.cfg"
echo $haproxy_config
echo "$haproxy_config"


if [ "$IP_STACK" = "v6" ]
then
master0=$(nth_ip $EXTERNAL_SUBNET_V6 20)
master1=$(nth_ip $EXTERNAL_SUBNET_V6 21)
master2=$(nth_ip $EXTERNAL_SUBNET_V6 22)
worker0=$(nth_ip $EXTERNAL_SUBNET_V6 23)
worker1=$(nth_ip $EXTERNAL_SUBNET_V6 24)
bootstrap=$(nth_ip $EXTERNAL_SUBNET_V6 9)
master0=$(nth_ip "$EXTERNAL_SUBNET_V6" 20)
master1=$(nth_ip "$EXTERNAL_SUBNET_V6" 21)
master2=$(nth_ip "$EXTERNAL_SUBNET_V6" 22)
worker0=$(nth_ip "$EXTERNAL_SUBNET_V6" 23)
worker1=$(nth_ip "$EXTERNAL_SUBNET_V6" 24)
bootstrap=$(nth_ip "$EXTERNAL_SUBNET_V6" 9)
else

master0=$(nth_ip $EXTERNAL_SUBNET_V4 20)
master1=$(nth_ip $EXTERNAL_SUBNET_V4 21)
master2=$(nth_ip $EXTERNAL_SUBNET_V4 22)
worker0=$(nth_ip $EXTERNAL_SUBNET_V4 23)
worker1=$(nth_ip $EXTERNAL_SUBNET_V4 24)
bootstrap=$(nth_ip $EXTERNAL_SUBNET_V4 9)
master0=$(nth_ip "$EXTERNAL_SUBNET_V4" 20)
master1=$(nth_ip "$EXTERNAL_SUBNET_V4" 21)
master2=$(nth_ip "$EXTERNAL_SUBNET_V4" 22)
worker0=$(nth_ip "$EXTERNAL_SUBNET_V4" 23)
worker1=$(nth_ip "$EXTERNAL_SUBNET_V4" 24)
bootstrap=$(nth_ip "$EXTERNAL_SUBNET_V4" 9)
fi

cat << EOF > "$haproxy_config"
Expand Down Expand Up @@ -108,14 +108,14 @@ sudo podman run -d --net host -v "${WORKING_DIR}":/etc/haproxy/:z --entrypoint

sleep 5

if [ "$(curl --fail https://$(wrap_if_ipv6 ${PROVISIONING_HOST_EXTERNAL_IP}):6443/version --insecure)" ]; then
if [ "$(curl --fail "https://$(wrap_if_ipv6 "${PROVISIONING_HOST_EXTERNAL_IP}"):6443/version" --insecure)" ]; then
echo " API is available through LB"
else
echo " Can't access API through LB"
fi


if [ "$(curl --fail --header "Host: console-openshift-console.apps.ostest.test.metalkube.org" http://$(wrap_if_ipv6 ${PROVISIONING_HOST_EXTERNAL_IP}):8080 -I -L --insecure)" ]; then
if [ "$(curl --fail --header "Host: console-openshift-console.apps.ostest.test.metalkube.org" "http://$(wrap_if_ipv6 "${PROVISIONING_HOST_EXTERNAL_IP}"):8080" -I -L --insecure)" ]; then
echo " Ingress is available through LB"
else
echo " Can't access Ingress through LB"
Expand Down
8 changes: 4 additions & 4 deletions hive_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ if [[ ! -z "${MIRROR_IMAGES}" && "${MIRROR_IMAGES,,}" != "false" ]]; then
# Mirror hive itself
DEPLOY_IMAGE="${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT}/localimages/hive:latest"
oc image mirror \
-a ${REGISTRY_CREDS} \
${HIVE_DEPLOY_IMAGE} \
${DEPLOY_IMAGE}
-a "${REGISTRY_CREDS}" \
"${HIVE_DEPLOY_IMAGE}" \
"${DEPLOY_IMAGE}"
fi

# Check out hive and install it. This has to be done in the GOPATH
Expand All @@ -25,7 +25,7 @@ fi
if [[ ! -d $GOPATH/src/github.com/openshift/hive ]]; then
sync_repo_and_patch go/src/github.com/openshift/hive https://github.com/openshift/hive.git
fi
pushd $HOME/go/src/github.com/openshift/hive
pushd "$HOME/go/src/github.com/openshift/hive"

make deploy

Expand Down
22 changes: 11 additions & 11 deletions host_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ ansible-playbook \
-e "virthost=$HOSTNAME" \
-e "manage_baremetal=$MANAGE_BR_BRIDGE" \
-e "nodes_file=$NODES_FILE" \
-i ${VM_SETUP_PATH}/inventory.ini \
-b -vvv ${VM_SETUP_PATH}/teardown-playbook.yml
-i "${VM_SETUP_PATH}/inventory.ini" \
-b -vvv "${VM_SETUP_PATH}/teardown-playbook.yml"

sudo rm -rf /etc/NetworkManager/dnsmasq.d/openshift-${CLUSTER_NAME}.conf /etc/yum.repos.d/delorean*
sudo rm -rf "/etc/NetworkManager/dnsmasq.d/openshift-${CLUSTER_NAME}.conf" /etc/yum.repos.d/delorean*
sudo rm -rf /etc/NetworkManager/conf.d/dnsmasq.conf
sudo rm -rf /etc/NetworkManager/dnsmasq.d/upstream.conf
if systemctl is-active --quiet NetworkManager; then
Expand All @@ -44,8 +44,8 @@ fi
# handle upgrade from legacy network scripts
for interface in ${PROVISIONING_NETWORK_NAME} ${BAREMETAL_NETWORK_NAME} ${PRO_IF} ${INT_IF}; do
interface_config=/etc/sysconfig/network-scripts/ifcfg-${interface}
if [ -e $interface_config ]; then
sudo rm -f $interface_config
if [ -e "$interface_config" ]; then
sudo rm -f "$interface_config"
IF_FOUND=true
fi
done
Expand All @@ -57,22 +57,22 @@ fi
# There was a bug in this file, it may need to be recreated.
# delete the interface as it can cause issues when not rebooting
if [ "$MANAGE_PRO_BRIDGE" == "y" ]; then
sudo nmcli con del ${PROVISIONING_NETWORK_NAME} || true
sudo ip link delete ${PROVISIONING_NETWORK_NAME} || true
sudo nmcli con del "${PROVISIONING_NETWORK_NAME}" || true
sudo ip link delete "${PROVISIONING_NETWORK_NAME}" || true
if [[ -d /sys/class/net/pro-ipv6-dummy ]]; then
sudo ip link delete pro-ipv6-dummy || true
fi
sudo rm -f /etc/NetworkManager/system-connections/${PROVISIONING_NETWORK_NAME}.nmconnection
sudo rm -f "/etc/NetworkManager/system-connections/${PROVISIONING_NETWORK_NAME}.nmconnection"
fi
# Leaving this around causes issues when the host is rebooted
# delete the interface as it can cause issues when not rebooting
if [ "$MANAGE_BR_BRIDGE" == "y" ]; then
sudo nmcli con del ${BAREMETAL_NETWORK_NAME} || true
sudo ip link delete ${BAREMETAL_NETWORK_NAME} || true
sudo nmcli con del "${BAREMETAL_NETWORK_NAME}" || true
sudo ip link delete "${BAREMETAL_NETWORK_NAME}" || true
if [[ -d /sys/class/net/bm-ipv6-dummy ]]; then
sudo ip link delete bm-ipv6-dummy || true
fi
sudo rm -f /etc/NetworkManager/system-connections/${BAREMETAL_NETWORK_NAME}.nmconnection
sudo rm -f "/etc/NetworkManager/system-connections/${BAREMETAL_NETWORK_NAME}.nmconnection"
fi

# Drop all ebtables rules
Expand Down
4 changes: 2 additions & 2 deletions ironic_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ early_cleanup_validation

# Kill and remove the running ironic containers
for name in ironic ironic-api ironic-conductor ironic-inspector dnsmasq httpd-${PROVISIONING_NETWORK_NAME} mariadb vbmc sushy-tools; do
sudo podman ps | grep -w "$name$" && sudo podman kill $name
sudo podman ps --all | grep -w "$name$" && sudo podman rm $name -f
sudo podman ps | grep -w "$name$" && sudo podman kill "$name"
sudo podman ps --all | grep -w "$name$" && sudo podman rm "$name" -f
done

# Remove existing pod
Expand Down
Loading