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
12 changes: 8 additions & 4 deletions .ibm/pipelines/install-methods/operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@ prepare_operator() {
deploy_rhdh_operator() {
local namespace=$1
local backstage_crd_path=$2
local timeout_seconds=60
if [[ -z "${IS_OPENSHIFT}" || "${IS_OPENSHIFT}" == "false" ]]; then
timeout_seconds=9000
fi

# Ensure PostgresCluster CRD is available before deploying Backstage CR
# This is critical because the operator will try to create a PostgresCluster resource
log::info "Verifying PostgresCluster CRD is available before deploying Backstage CR..."
k8s_wait::crd "postgresclusters.postgres-operator.crunchydata.com" 60 5 || {
k8s_wait::crd "postgresclusters.postgres-operator.crunchydata.com" $timeout_seconds 5 || {
log::error "PostgresCluster CRD not available - operator won't be able to create internal database"
return 1
}

# Verify Backstage CRD is also available
k8s_wait::crd "backstages.rhdh.redhat.com" 60 5 || return 1
k8s_wait::crd "backstages.rhdh.redhat.com" $timeout_seconds 5 || return 1

rendered_yaml=$(envsubst < "$backstage_crd_path")
log::info "Applying Backstage CR from: $backstage_crd_path"
Expand All @@ -71,7 +75,7 @@ deploy_rhdh_operator() {
# Wait for the operator to create the Backstage deployment (5 minutes max)
if ! common::poll_until \
"oc get deployment -n '$namespace' --no-headers 2>/dev/null | grep -q 'backstage-'" \
60 5 "Backstage deployment created by operator"; then
$timeout_seconds 5 "Backstage deployment created by operator"; then
log::error "Backstage deployment not created after 5 minutes"
_operator_debug_info "$namespace"
return 1
Expand All @@ -82,7 +86,7 @@ deploy_rhdh_operator() {
if ! common::poll_until \
"oc get postgrescluster -n '$namespace' --no-headers 2>/dev/null | grep -q 'backstage-psql' || \
oc get statefulset -n '$namespace' --no-headers 2>/dev/null | grep -q 'backstage-psql'" \
60 5 "Database resource created by operator"; then
$timeout_seconds 5 "Database resource created by operator"; then
log::error "Database resource not created after 5 minutes"
_operator_debug_info "$namespace"
return 1
Expand Down
3 changes: 2 additions & 1 deletion .ibm/pipelines/lib/k8s-wait.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ k8s_wait::crd() {

for ((i = 1; i <= max_attempts; i++)); do
if oc get crd "$crd_name" > /dev/null 2>&1; then
log::success "CRD '$crd_name' is available"
local elapsed_time=$((i * check_interval))
log::success "CRD '$crd_name' is available after ${elapsed_time} seconds"
return 0
fi

Expand Down
2 changes: 1 addition & 1 deletion .ibm/pipelines/lib/operators.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ operator::install_olm() {
fi

log::info "OLM is not installed. Installing..."
operator-sdk olm install
operator-sdk olm install --timeout="10m0s"
return $?
}

Expand Down
Loading