Skip to content
Draft
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
22 changes: 22 additions & 0 deletions .github/actions/dependencies/install-operator-sdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Setup OperatorSDK"
description: "Setup OperatorSDK"

inputs:
operatorSdkVersion:
description: "OperatorSDK version to be installed"
required: false
default: "1.42.2"
architecture:
description: "Architecture"
required: false
default: "amd64"

runs:
using: "composite"
steps:
- name: Setup OperatorSDK
shell: bash
run: |
${{ github.action_path }}/setup_operator_sdk.sh "${{ inputs.architecture }}"
env:
OPERATOR_SDK_VERSION: ${{ inputs.operatorSdkVersion }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
OPERATOR_SDK_VERSION=${OPERATOR_SDK_VERSION:-1.42.2}
OS=$(uname | awk '{print tolower($0)}')

ARCH=$1
if [ -z "$ARCH" ]; then
ARCH="amd64"
fi

OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}

curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}

chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
5 changes: 5 additions & 0 deletions .github/actions/dependencies/setup-kind/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ inputs:
description: "Version of kind cloud-provider image"
required: false
default: 0.6.0
installOlm:
description: "Determines if OLM should be installed on Kind"
required: false
default: "false"

runs:
using: "composite"
Expand Down Expand Up @@ -80,6 +84,7 @@ runs:
WORKER_NODES: ${{ inputs.workerNodes }}
KIND_CLOUD_PROVIDER_VERSION: v${{ inputs.cloudProviderVersion }}
KIND_VERSION: v${{ inputs.kindVersion }}
INSTALL_OLM: ${{ inputs.installOlm }}

- name: Set DOCKER_REGISTRY
shell: bash
Expand Down
37 changes: 36 additions & 1 deletion .github/actions/dependencies/setup-kind/setup-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ function is_podman() {
[[ "$DOCKER_CMD" == "podman" ]]
}

function should_install_olm() {
[[ "$INSTALL_OLM" == "true" ]]
}

function install_kubectl {
if [ "${TEST_KUBECTL_VERSION:-latest}" = "latest" ]; then
TEST_KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
Expand Down Expand Up @@ -363,6 +367,36 @@ function configure_network {
fi
}

: '
@brief: Installs OLM related components to the cluster.
@global:
INSTALL_OLM - environment variable determining if the OLM should be installed or not.
@note: `operator-sdk` has to be installed before running this script (in case that INSTALL_OLM is set to `true`).
'
function setup_olm_on_cluster {
if should_install_olm; then
if ! operator-sdk --help >/dev/null 2>&1
then
echo "[ERROR] operator-sdk could not be found, be sure to install it before running this script with INSTALL_OLM set to true."
exit 1
fi

echo "[INFO] INSTALL_OLM is set to 'true', going to setup OLM on the cluster."
operator-sdk olm install

echo "[INFO] Checking if the OLM related Pods are app and running before proceeding"
if ! kubectl wait --for=condition=Ready pods -l app=olm-operator -n olm --timeout=120s && \
kubectl wait --for=condition=Ready pods -l app=catalog-operator -n olm --timeout=120s; then
echo "[ERROR] OLM pods did not become ready in time. Current state:"
kubectl get pods -n olm
kubectl get events -n olm
exit 1
fi

echo "[INFO] OLM successfully configured on cluster."
fi
}

setup_kube_directory
install_kubectl
install_kubernetes_provisioner
Expand Down Expand Up @@ -452,4 +486,5 @@ fi

create_cluster_role_binding_admin
label_node
run_cloud_provider_kind ${network_name}
run_cloud_provider_kind ${network_name}
setup_olm_on_cluster
Loading