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
4 changes: 4 additions & 0 deletions .ci/pipelines/cluster/gke/gke-helm-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ initiate_gke_helm_deployment() {
log::error "Helm upgrade failed for ${RELEASE_NAME} in ${NAME_SPACE}"
return 1
fi

wait_for_gke_ingress_ip "${NAME_SPACE}"
}

initiate_rbac_gke_helm_deployment() {
Expand Down Expand Up @@ -78,4 +80,6 @@ initiate_rbac_gke_helm_deployment() {
log::error "Helm upgrade failed for ${RELEASE_NAME_RBAC} in ${NAME_SPACE_RBAC}"
return 1
fi

wait_for_gke_ingress_ip "${NAME_SPACE_RBAC}"
}
2 changes: 2 additions & 0 deletions .ci/pipelines/cluster/gke/gke-operator-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ initiate_gke_operator_deployment() {
deploy_rhdh_operator "${namespace}" "${DIR}/resources/rhdh-operator/rhdh-start_K8s.yaml"

apply_gke_operator_ingress "$namespace" "backstage-$RELEASE_NAME"
wait_for_gke_ingress_ip "${namespace}"
}

initiate_rbac_gke_operator_deployment() {
Expand All @@ -70,4 +71,5 @@ initiate_rbac_gke_operator_deployment() {
deploy_rhdh_operator "${namespace}" "${DIR}/resources/rhdh-operator/rhdh-start-rbac_K8s.yaml"

apply_gke_operator_ingress "$namespace" "backstage-$RELEASE_NAME_RBAC"
wait_for_gke_ingress_ip "${namespace}"
}
49 changes: 49 additions & 0 deletions .ci/pipelines/cluster/gke/manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,52 @@ apply_gke_operator_ingress() {
export SERVICE_NAME=$service_name
envsubst < "${DIR}/cluster/gke/manifest/gke-operator-ingress.yaml" | kubectl apply --namespace="${namespace}" -f -
}

# Function: wait_for_gke_ingress_ip
# Description: Waits until an Ingress in the namespace is assigned the shared
# static IP. GCE gives that IP to one Ingress at a time, so an Ingress left
# behind in another namespace keeps serving the RHDH host and the tests would
# run against a stale instance.
# Arguments:
# $1 - namespace
# $2 - timeout seconds (default: 900, a new GCE load balancer takes minutes)
# $3 - check interval seconds (default: 15)
# Returns:
# 0 - Success
# 1 - No Ingress in the namespace got the static IP before the timeout
wait_for_gke_ingress_ip() {
local namespace=$1
local timeout=${2:-900}
local check_interval=${3:-15}

if [[ -z "${namespace}" ]]; then
log::error "wait_for_gke_ingress_ip: missing namespace"
return 1
fi

log::info "Waiting for the GKE Ingress in namespace '${namespace}' to get the static IP (timeout: ${timeout}s)..."
local elapsed=0
local address
while [[ ${elapsed} -lt ${timeout} ]]; do
# A failed poll must not end the job under errexit; treat it as no address yet.
address=$(kubectl get ingress --namespace="${namespace}" \
-o jsonpath='{.items[*].status.loadBalancer.ingress[*].ip}' 2> /dev/null) || address=""
if [[ -n "${address}" ]]; then
log::success "GKE Ingress in namespace '${namespace}' has the static IP: ${address}"
return 0
fi
sleep "${check_interval}"
elapsed=$((elapsed + check_interval))
done

log::error "GKE Ingress in namespace '${namespace}' did not get the static IP within ${timeout}s."
local holders
holders=$(kubectl get ingress --all-namespaces \
-o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,ADDRESS:.status.loadBalancer.ingress[0].ip' \
2> /dev/null | grep -v '<none>' || true)
if [[ -n "${holders}" ]]; then
log::error "An Ingress in another namespace probably holds the static IP. Ingresses with an address:"
log::error "${holders}"
fi
return 1
}
4 changes: 4 additions & 0 deletions .ci/pipelines/jobs/gke-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ handle_gke_operator() {

prepare_operator

# An Ingress left in the RBAC namespace by an interrupted job keeps the shared
# static IP and would serve the first test suite, so remove it first.
namespace::delete "${NAME_SPACE_RBAC}"

initiate_gke_operator_deployment "${NAME_SPACE}" "https://${K8S_CLUSTER_ROUTER_BASE}"
testing::check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "${PW_PROJECT_SHOWCASE_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
namespace::delete "${NAME_SPACE}"
Expand Down
6 changes: 4 additions & 2 deletions docs/e2e-tests/CI-medic-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ Tests on AWS Elastic Kubernetes Service. See [`eks-helm.sh`](../../.ci/pipelines

Tests on Google Kubernetes Engine. See [`gke-helm.sh`](../../.ci/pipelines/jobs/gke-helm.sh) / [`gke-operator.sh`](../../.ci/pipelines/jobs/gke-operator.sh). GCP utilities in [`gcloud.sh`](../../.ci/pipelines/cluster/gke/gcloud.sh).

**Namespaces**: `showcase-k8s-ci-nightly`, `showcase-rbac-k8s-ci-nightly`
**Namespaces**: `showcase`, `showcase-rbac`

**Test suites**: `showcase-k8s`, `showcase-rbac-k8s`

Expand All @@ -486,7 +486,9 @@ Tests on Google Kubernetes Engine. See [`gke-helm.sh`](../../.ci/pipelines/jobs/

**Access**: The cluster runs in the `rhdh-qe` Google Cloud project. See [Google Cloud access](../../.ci/pipelines/README.md#google-cloud-rhdh-qe-project) for how to get access.

**Common failures**: Since GKE uses a long-running shared cluster, most issues stem from stale state -- a previous job exited without proper cleanup, or two jobs were triggered at the same time and collided on shared resources (namespaces, certificates, static IP). If jobs overlap, adjust the cron schedule in the [ci-operator config](https://github.com/openshift/release/tree/master/ci-operator/config/redhat-developer/rhdh) to space them out.
**Common failures**: Since GKE uses a long-running shared cluster, most issues stem from stale state -- a previous job exited without proper cleanup, or two jobs were triggered at the same time and collided on shared resources (namespaces, certificates, static IP). All GKE jobs run in the `rhdh-gke` Prow queue, so they cannot overlap: a queued job stays `triggered` with no pod until the running one finishes. If two jobs still collide, check the queue in the [Prow config](https://github.com/openshift/release/blob/main/core-services/prow/02_config/redhat-developer/rhdh/_prowconfig.yaml).

Ingresses on this cluster share the fixed IP `rhdh-static-ip`, and GCE gives it to one Ingress at a time. An Ingress left behind by an aborted or timed-out job (for example in `showcase-rbac`) therefore keeps serving `gke-ci.janus-idp.io`, and the next job's tests run against the old instance. Symptoms: the `/healthcheck` passes seconds after the Ingress is created while the RHDH pod is still starting, and guest sign-in shows no sidebar. Every GKE job deletes the other test namespace before its first deployment, and `wait_for_gke_ingress_ip` fails the job with the addresses it found if its own Ingress never gets the IP.

---

Expand Down
Loading