Skip to content

fix(ci): free the GKE static IP before the operator deployment - #5984

Open
zdrapela wants to merge 1 commit into
redhat-developer:mainfrom
zdrapela:gke-free-static-ip
Open

zdrapela wants to merge 1 commit into
redhat-developer:mainfrom
zdrapela:gke-free-static-ip

Conversation

@zdrapela

@zdrapela zdrapela commented Dec 4, 2026

Copy link
Copy Markdown
Member

Fixes the shared GKE static-IP hijack: an Ingress left behind by an aborted job keeps rhdh-static-ip, so the next job's first test suite runs against the stale RHDH instance. This is what failed the showcase suite of #5982's GKE operator presubmit (showcase was served by the leftover showcase-rbac deployment).

Changes

  • gke-operator.sh: delete the RBAC namespace before the first deployment, as the Helm job already does. The namespace delete waits for the old load balancer to release the IP.
  • manifest.sh: add wait_for_gke_ingress_ip, called after the four places that create an Ingress. If the new Ingress never gets the IP, the job fails with the addresses it found instead of running tests against a stale instance.
  • CI-medic-guide.md: document the rhdh-gke Prow queue (replacing the cron advice), the shared-IP failure mode and its symptoms, and the correct namespace names.

Verification on the shared cluster (throwaway Ingresses, no job running):

  • A second Ingress asking for the IP gets no address: Specified IP address is in-use and would result in a conflict.
  • The new wait times out after its 180s test timeout and lists the holding Ingress.
  • After the holder's namespace is deleted, the waiting Ingress takes the IP immediately.

Test namespaces were deleted and rhdh-static-ip is RESERVED again.

Jira: https://redhat.atlassian.net/browse/RHDHBUGS-4181

Backport: /cherry-pick release-2.1; release-1.10 needs a manual backport because gke-helm-deployment.sh differs there.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification

This PR uses the pipeline controller for second-stage tests. Selection and triggering follow the repository configuration.

Use /test ? to list jobs and /pipeline help for commands.

@zdrapela

zdrapela commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

/test ?

@rhdh-qodo-merge

rhdh-qodo-merge Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

fix(ci): free the GKE static IP before the operator deployment

🐞 Bug fix 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Deletes the RBAC namespace before the GKE operator job's first deployment, freeing the shared
 static IP.
• Adds wait_for_gke_ingress_ip after all four Ingress creations, failing fast with holder addresses
 on timeout.
• Updates the CI medic guide: rhdh-gke queue, shared-IP failure symptoms, and correct namespace
 names.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The cleanup, ingress application, readiness polling and test invocation form one end-to-end GKE CI integration outcome: routing each suite to the deployment under test.
  • The static IP and namespace operations are implementation boundaries within that integration, not independent user capabilities.
  • Both Helm and Operator deployment paths feed the same GKE E2E test integration and differ only in deployment implementation; their readiness failure has the same bounded outcome: the corresponding suite does not start.
Sources

.ci/pipelines/cluster/gke/gke-operator-deployment.sh[44-47]

  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}"

.ci/pipelines/jobs/gke-operator.sh[43-48]

  # 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
Behavioral complexity 🔴 High 🧩 Interacting branches, Concurrent ordering

  • Before, deployment returned after applying ingress and the caller started tests.
  • After, namespace cleanup and ingress polling gate test execution.
  • New correctness conditions are ordered cleanup before deployment, readiness before testing, and failure propagation on timeout while a shared static-IP ingress transitions between namespaces.
  • The polling loop is simple, but these state and ordering interactions must remain consistent across Helm and Operator flows.
Sources

.ci/pipelines/cluster/gke/manifest.sh[50-60]

  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

.ci/pipelines/cluster/gke/manifest.sh[62-71]

  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

.ci/pipelines/jobs/gke-operator.sh[43-48]

  # 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
Potential damage 🟡 Medium 🩹 Incorrect results

  • If stale ingress state remains effective, or any non-empty address is accepted before the intended shared-IP ownership is established, tests can contact an older deployment and report results for the wrong instance.
  • The ingress manifest confirms that the affected deployments share rhdh-static-ip.
  • Previously recorded results require rerunning the affected suite after namespace and ingress state are corrected; reverting code alone does not repair those results.
Sources

.ci/pipelines/cluster/gke/manifest.sh[50-60]

  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

.ci/pipelines/jobs/gke-operator.sh[43-48]

  # 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
Assessed commit eb5062c
Diagram

graph TD
  A["gke-operator.sh"] --> B["Delete RBAC namespace"] --> C["Deploy operator and Ingress"] --> D["wait_for_gke_ingress_ip"]
  D -->|IP acquired| E["Run test suites"]
  D -->|timeout| F["Fail job"]
  G[("rhdh-static-ip")] -.-> D
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Delete every Ingress holding rhdh-static-ip before deploying
  • ➕ Handles holders in any namespace, not only the known RBAC namespace
  • ➕ No need to know which job left the Ingress behind
  • ➖ Can remove another job's Ingress if jobs ever overlap
  • ➖ Needs a cluster-wide query and more RBAC permissions in the CI service account
2. Give each job its own static IP or hostname
  • ➕ Removes the shared-IP contention entirely
  • ➕ Jobs no longer depend on each other or on namespace deletion timing
  • ➖ Requires reserving IPs and DNS changes outside this repo
  • ➖ Larger change with cost and quota implications

Recommendation: The PR's approach is reasonable: it clears the known holder before deploying and fails loudly if the IP is still taken. The gap is that only the RBAC namespace is cleaned up before the operator job. A stale Ingress in the 'showcase' namespace from an aborted run would make the new Ingress fail the wait rather than run tests against a stale instance, which is safe but still blocks the job. Consider deleting both GKE namespaces up front, as the Helm job does for its RBAC namespace.

Files changed (5) +62 / -2

Enhancement (1) +48 / -0
manifest.shAdd wait_for_gke_ingress_ip helper +48/-0

Add wait_for_gke_ingress_ip helper

• New function polls kubectl for an Ingress status IP in a namespace, with a 900s default timeout and 15s interval. On timeout it lists all Ingresses that have an address so the holder can be identified, then returns 1.

.ci/pipelines/cluster/gke/manifest.sh

Bug fix (3) +10 / -0
gke-operator.shDelete RBAC namespace before the operator deployment +4/-0

Delete RBAC namespace before the operator deployment

• Calls namespace::delete on NAME_SPACE_RBAC before initiate_gke_operator_deployment. This removes any leftover Ingress that holds the shared static IP, matching the Helm job's behavior.

.ci/pipelines/jobs/gke-operator.sh

gke-operator-deployment.shWait for static IP after operator Ingress apply +2/-0

Wait for static IP after operator Ingress apply

• Calls wait_for_gke_ingress_ip after apply_gke_operator_ingress in both the standard and RBAC operator deployment functions, so a job fails if its Ingress does not get the shared IP.

.ci/pipelines/cluster/gke/gke-operator-deployment.sh

gke-helm-deployment.shWait for static IP after Helm upgrade +4/-0

Wait for static IP after Helm upgrade

• Adds wait_for_gke_ingress_ip after the successful Helm upgrade in both the standard and RBAC Helm deployment functions, covering the two Ingress creations made by the Helm path.

.ci/pipelines/cluster/gke/gke-helm-deployment.sh

Documentation (1) +4 / -2
CI-medic-guide.mdUpdate GKE troubleshooting section +4/-2

Update GKE troubleshooting section

• Corrects the namespace names to showcase and showcase-rbac. Replaces the cron advice with the rhdh-gke Prow queue, which prevents overlap. Documents the shared static IP failure mode and its symptoms.

docs/e2e-tests/CI-medic-guide.md

@zdrapela

zdrapela commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

/test e2e-gke-operator-nightly

@zdrapela

zdrapela commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

/cherry-pick release-2.1

@openshift-cherrypick-robot

Copy link
Copy Markdown
Contributor

@zdrapela: once the present PR merges, I will cherry-pick it on top of release-2.1 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-2.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@rhdh-qodo-merge

rhdh-qodo-merge Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Code Review by Qodo


View medium (2)
Remediation recommended
1. Medics inspect the wrong GKE namespaces 🐞 Bug
Description
The guide replaces the GKE namespace names with showcase and showcase-rbac, and its
stale-Ingress example repeats the latter name. Both GKE job handlers default to
showcase-k8s-ci-nightly and showcase-rbac-k8s-ci-nightly, so following the guide during a
shared-IP incident directs inspection or cleanup away from the namespaces those jobs use.
Code

docs/e2e-tests/CI-medic-guide.md[478]

+**Namespaces**: `showcase`, `showcase-rbac`
Relevance

●●● Strong

Factual doc inconsistency: namespace names don't match what the handlers export. Trivial correction;
no rejections found for docs.

PR-#5538
PR-#5296

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed guide names showcase and showcase-rbac, whereas both GKE handlers export the longer
nightly names and pass those variables to their deployments and cleanup.

docs/e2e-tests/CI-medic-guide.md[476-491]
.ci/pipelines/jobs/gke-helm.sh[21-23]
.ci/pipelines/jobs/gke-operator.sh[23-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The guide names namespaces that do not match the GKE jobs' default namespaces, including in the stale-Ingress example.

## Fix Focus Areas
- docs/e2e-tests/CI-medic-guide.md[478-491]

## Recommended Fix
Restore `showcase-k8s-ci-nightly` and `showcase-rbac-k8s-ci-nightly` as the GKE namespace names, and use the RBAC name consistently in the stale-Ingress example. Mention that the job variables can override these defaults if useful.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

2. Tests can still target the wrong instance 🐞 Bug
Description
wait_for_gke_ingress_ip succeeds when any Ingress in the deployment namespace has any nonempty IP,
without identifying the newly created Ingress or comparing its address with the shared static IP. If
another Ingress in that namespace has an address while the target Ingress does not own
rhdh-static-ip, the deployment proceeds to the test suite despite the failed handoff.
Code

.ci/pipelines/cluster/gke/manifest.sh[R51-53]

+    address=$(kubectl get ingress --namespace="${namespace}" \
+      -o jsonpath='{.items[*].status.loadBalancer.ingress[*].ip}' 2> /dev/null)
+    if [[ -n "${address}" ]]; then
Relevance

●● Moderate

Scope/semantic change to the wait logic; no dismissals or close rejections found. Accepted
robustness precedents exist but this is architectural.

PR-#5709
PR-#5729

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The query selects all Ingress items, and the success branch tests only whether the resulting string
is nonempty. The operator manifest identifies a specific Ingress and static-IP reservation, while
both deployment methods call this namespace-only check before tests.

.ci/pipelines/cluster/gke/manifest.sh[50-56]
.ci/pipelines/cluster/gke/manifest/gke-operator-ingress.yaml[3-9]
.ci/pipelines/cluster/gke/gke-operator-deployment.sh[44-47]
.ci/pipelines/cluster/gke/gke-helm-deployment.sh[48-52]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The wait accepts an IP from any Ingress in the namespace instead of proving that the newly deployed Ingress received the shared static IP.

## Fix Focus Areas
- .ci/pipelines/cluster/gke/manifest.sh[37-55]
- .ci/pipelines/cluster/gke/gke-helm-deployment.sh[51-52]
- .ci/pipelines/cluster/gke/gke-operator-deployment.sh[46-47]

## Recommended Fix
Pass the target Ingress name from each deployment and query that Ingress specifically. Resolve the numeric address reserved as `rhdh-static-ip` and succeed only when the target's reported address matches it; apply the same check to both RBAC deployments.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

All GKE jobs share the fixed IP `rhdh-static-ip`, and GCE hands it to one
Ingress at a time. An interrupted job leaves its Ingress behind, which keeps
serving gke-ci.janus-idp.io, so the next job's first test suite runs against a
stale instance. That is what happened when the GKE operator presubmit of
redhat-developer#5982 tested `showcase`, not `showcase-rbac`.

The Helm job already deletes the RBAC namespace before its first deployment;
do the same in the operator job. A namespace delete waits for the old load
balancer to release the IP, so the new Ingress can take it.

Add `wait_for_gke_ingress_ip` after the four places that create an Ingress
and fail the job with the addresses it found if its own Ingress never gets
the IP, so this class of stale state no longer hides behind unrelated test
failures. A failed `kubectl get` during the wait is retried instead of ending
the job under `errexit`.

Assisted-by: OpenCode
@zdrapela

zdrapela commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

/test e2e-gke-operator-nightly

@zdrapela

zdrapela commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

/test e2e-gke-helm-nightly

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

The container image build and publish workflows were skipped (either due to [skip-build] tag or no relevant changes with existing image).

@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants