From bb36b3bb76b816f6b93403fe956c38fb88793eea Mon Sep 17 00:00:00 2001 From: Subhash Khileri Date: Mon, 12 Oct 2026 13:41:51 +0530 Subject: [PATCH 1/3] fix: disable Intelligent Assistant in operator E2E defaults --- docs/.vitepress/config.ts | 2 +- docs/changelog.md | 8 +++++++- package.json | 2 +- src/deployment/rhdh/config/operator/subscription.yaml | 3 +++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 6ac7bdb..c266535 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -33,7 +33,7 @@ export default defineConfig({ { text: "Examples", link: "/examples/" }, { text: "Overlay Testing", link: "/overlay/" }, { - text: "v2.1.18", + text: "v2.2.5", items: [{ text: "Changelog", link: "/changelog" }], }, ], diff --git a/docs/changelog.md b/docs/changelog.md index 9b3520f..7653711 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,7 +2,13 @@ All notable changes to this project will be documented in this file. -## [2.2.4] - Current +## [2.2.5] - Current + +### Fixed + +- Disable the Intelligent Assistant flavour by default in operator E2E deployments, matching Helm. Workspaces can enable it explicitly through `spec.flavours` in their subscription override. + +## [2.2.4] ### Fixed diff --git a/package.json b/package.json index 35bd070..29c15f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@red-hat-developer-hub/e2e-test-utils", - "version": "2.2.4", + "version": "2.2.5", "description": "Test utilities for RHDH E2E tests", "license": "Apache-2.0", "repository": { diff --git a/src/deployment/rhdh/config/operator/subscription.yaml b/src/deployment/rhdh/config/operator/subscription.yaml index 34997c8..086e52a 100644 --- a/src/deployment/rhdh/config/operator/subscription.yaml +++ b/src/deployment/rhdh/config/operator/subscription.yaml @@ -3,6 +3,9 @@ kind: Backstage metadata: name: developer-hub spec: + flavours: + - name: intelligent-assistant + enabled: false application: appConfig: configMaps: From c388248c4b5579876f2ecf8fb8b9ea06109a118a Mon Sep 17 00:00:00 2001 From: Subhash Khileri Date: Mon, 12 Oct 2026 14:00:50 +0530 Subject: [PATCH 2/3] fix: select RHDH Deployments correctly during restarts --- docs/api/deployment/rhdh-deployment.md | 4 ++-- docs/changelog.md | 1 + docs/guide/deployment/rhdh-deployment.md | 4 ++-- src/deployment/rhdh/deployment.ts | 27 ++++++++++++++++++------ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/docs/api/deployment/rhdh-deployment.md b/docs/api/deployment/rhdh-deployment.md index 085dfd8..93aacc4 100644 --- a/docs/api/deployment/rhdh-deployment.md +++ b/docs/api/deployment/rhdh-deployment.md @@ -126,7 +126,7 @@ await rhdh.waitUntilReady(600); // 10 minutes async rolloutRestart(): Promise ``` -Restart the RHDH deployment. +Restart the RHDH Deployment for either Helm or operator installations, then wait for rollout completion and application readiness. ```typescript await rhdh.rolloutRestart(); @@ -138,7 +138,7 @@ await rhdh.rolloutRestart(); async scaleDownAndRestart(): Promise ``` -Scale down to 0, wait for pod termination, then scale back to 1 replica. Prevents `MigrationLocked` errors when two backstage instances try to run database migrations simultaneously. +Scale down to 0, wait for RHDH Pod termination, then scale back to 1 replica and wait for rollout completion. Supports Helm and operator installations; PostgreSQL Pods are excluded. Prevents `MigrationLocked` errors when two backstage instances try to run database migrations simultaneously. ::: info Called automatically during `deploy()` only on **helm upgrades** (when an existing deployment is detected). Skipped on fresh installs to avoid unnecessary pod cycling. diff --git a/docs/changelog.md b/docs/changelog.md index 7653711..03f08f9 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Disable the Intelligent Assistant flavour by default in operator E2E deployments, matching Helm. Workspaces can enable it explicitly through `spec.flavours` in their subscription override. +- Fix operator restart helpers to select Deployment metadata rather than Pod-only labels. Both restart methods wait for rollout completion, and Helm Pod selection excludes PostgreSQL. ## [2.2.4] diff --git a/docs/guide/deployment/rhdh-deployment.md b/docs/guide/deployment/rhdh-deployment.md index baa3be8..b5cf0ac 100644 --- a/docs/guide/deployment/rhdh-deployment.md +++ b/docs/guide/deployment/rhdh-deployment.md @@ -151,7 +151,7 @@ Any other value will throw an error during deployment. Wait for the RHDH deployment to be ready. Performs two-phase readiness check: -1. **Pod readiness** — Waits for all pods to have `Ready=True` with early failure detection (CrashLoopBackOff, ImagePullBackOff, etc.) +1. **Pod readiness** — Waits for RHDH Pods to have `Ready=True` with early failure detection (CrashLoopBackOff, ImagePullBackOff, etc.) 2. **Route readiness** — HTTP health check against the RHDH route, closing the gap between pod readiness and the OpenShift Router actually serving traffic ```typescript @@ -164,7 +164,7 @@ await deployment.waitUntilReady(600); // 10 minutes ### `rolloutRestart()` -Restart the RHDH deployment (useful after config changes): +Restart the RHDH Deployment after config changes. Supports Helm and operator installations and waits for rollout completion before checking application readiness: ```typescript // Update configuration diff --git a/src/deployment/rhdh/deployment.ts b/src/deployment/rhdh/deployment.ts index 5018b07..2582c66 100644 --- a/src/deployment/rhdh/deployment.ts +++ b/src/deployment/rhdh/deployment.ts @@ -366,30 +366,43 @@ export class RHDHDeployment { private get _labelSelector(): string { return this.deploymentConfig.method === "operator" ? "rhdh.redhat.com/app=backstage-developer-hub" - : "app.kubernetes.io/instance in (redhat-developer-hub,developer-hub)"; + : "app.kubernetes.io/component=backstage,app.kubernetes.io/instance in (redhat-developer-hub,developer-hub)"; + } + + private get _deploymentLabelSelector(): string { + // The operator's rhdh.redhat.com/app label is on Pods, not Deployment metadata. + return this.deploymentConfig.method === "operator" + ? "app.kubernetes.io/name=backstage,app.kubernetes.io/instance=developer-hub" + : this._labelSelector; + } + + private async _waitForDeploymentRollout(): Promise { + await $`oc rollout status deployment -l ${this._deploymentLabelSelector} -n ${this.deploymentConfig.namespace} --timeout=300s`; } async rolloutRestart(): Promise { this._log( `Restarting RHDH deployment in namespace ${this.deploymentConfig.namespace}...`, ); - await $`oc rollout restart deployment -l ${this._labelSelector} -n ${this.deploymentConfig.namespace}`; + await $`oc rollout restart deployment -l ${this._deploymentLabelSelector} -n ${this.deploymentConfig.namespace}`; + await this._waitForDeploymentRollout(); + await this.waitUntilReady(); this._log( `RHDH deployment restarted successfully in namespace ${this.deploymentConfig.namespace}`, ); - await this.waitUntilReady(); } /** * Performs a clean restart by scaling down to 0 first, waiting for pods to terminate, - * then scaling back up. This prevents MigrationLocked errors by ensuring no pods - * hold database locks when new pods start. + * then scaling back up and waiting for rollout. This prevents MigrationLocked errors + * by ensuring no pods hold database locks when new pods start. */ async scaleDownAndRestart(): Promise { const namespace = this.deploymentConfig.namespace; - await $`oc scale deployment -l ${this._labelSelector} --replicas=0 -n ${namespace}`; + await $`oc scale deployment -l ${this._deploymentLabelSelector} --replicas=0 -n ${namespace}`; await $`oc wait --for=delete pod -l ${this._labelSelector} -n ${namespace} --timeout=120s || true`; - await $`oc scale deployment -l ${this._labelSelector} --replicas=1 -n ${namespace}`; + await $`oc scale deployment -l ${this._deploymentLabelSelector} --replicas=1 -n ${namespace}`; + await this._waitForDeploymentRollout(); } async waitUntilReady(timeout: number = 500): Promise { From 84ac504a39b4637317a9eada86db56efb0e7c7f5 Mon Sep 17 00:00:00 2001 From: Subhash Khileri Date: Mon, 12 Oct 2026 14:12:06 +0530 Subject: [PATCH 3/3] refactor: limit operator restart fix to Deployment selection --- docs/api/deployment/rhdh-deployment.md | 4 ++-- docs/changelog.md | 2 +- docs/guide/deployment/rhdh-deployment.md | 4 ++-- src/deployment/rhdh/deployment.ts | 14 ++++---------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/docs/api/deployment/rhdh-deployment.md b/docs/api/deployment/rhdh-deployment.md index 93aacc4..085dfd8 100644 --- a/docs/api/deployment/rhdh-deployment.md +++ b/docs/api/deployment/rhdh-deployment.md @@ -126,7 +126,7 @@ await rhdh.waitUntilReady(600); // 10 minutes async rolloutRestart(): Promise ``` -Restart the RHDH Deployment for either Helm or operator installations, then wait for rollout completion and application readiness. +Restart the RHDH deployment. ```typescript await rhdh.rolloutRestart(); @@ -138,7 +138,7 @@ await rhdh.rolloutRestart(); async scaleDownAndRestart(): Promise ``` -Scale down to 0, wait for RHDH Pod termination, then scale back to 1 replica and wait for rollout completion. Supports Helm and operator installations; PostgreSQL Pods are excluded. Prevents `MigrationLocked` errors when two backstage instances try to run database migrations simultaneously. +Scale down to 0, wait for pod termination, then scale back to 1 replica. Prevents `MigrationLocked` errors when two backstage instances try to run database migrations simultaneously. ::: info Called automatically during `deploy()` only on **helm upgrades** (when an existing deployment is detected). Skipped on fresh installs to avoid unnecessary pod cycling. diff --git a/docs/changelog.md b/docs/changelog.md index 03f08f9..1e42d78 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Disable the Intelligent Assistant flavour by default in operator E2E deployments, matching Helm. Workspaces can enable it explicitly through `spec.flavours` in their subscription override. -- Fix operator restart helpers to select Deployment metadata rather than Pod-only labels. Both restart methods wait for rollout completion, and Helm Pod selection excludes PostgreSQL. +- Fix operator restart helpers to select Deployment metadata rather than Pod-only labels. ## [2.2.4] diff --git a/docs/guide/deployment/rhdh-deployment.md b/docs/guide/deployment/rhdh-deployment.md index b5cf0ac..baa3be8 100644 --- a/docs/guide/deployment/rhdh-deployment.md +++ b/docs/guide/deployment/rhdh-deployment.md @@ -151,7 +151,7 @@ Any other value will throw an error during deployment. Wait for the RHDH deployment to be ready. Performs two-phase readiness check: -1. **Pod readiness** — Waits for RHDH Pods to have `Ready=True` with early failure detection (CrashLoopBackOff, ImagePullBackOff, etc.) +1. **Pod readiness** — Waits for all pods to have `Ready=True` with early failure detection (CrashLoopBackOff, ImagePullBackOff, etc.) 2. **Route readiness** — HTTP health check against the RHDH route, closing the gap between pod readiness and the OpenShift Router actually serving traffic ```typescript @@ -164,7 +164,7 @@ await deployment.waitUntilReady(600); // 10 minutes ### `rolloutRestart()` -Restart the RHDH Deployment after config changes. Supports Helm and operator installations and waits for rollout completion before checking application readiness: +Restart the RHDH deployment (useful after config changes): ```typescript // Update configuration diff --git a/src/deployment/rhdh/deployment.ts b/src/deployment/rhdh/deployment.ts index 2582c66..dec206e 100644 --- a/src/deployment/rhdh/deployment.ts +++ b/src/deployment/rhdh/deployment.ts @@ -366,7 +366,7 @@ export class RHDHDeployment { private get _labelSelector(): string { return this.deploymentConfig.method === "operator" ? "rhdh.redhat.com/app=backstage-developer-hub" - : "app.kubernetes.io/component=backstage,app.kubernetes.io/instance in (redhat-developer-hub,developer-hub)"; + : "app.kubernetes.io/instance in (redhat-developer-hub,developer-hub)"; } private get _deploymentLabelSelector(): string { @@ -376,33 +376,27 @@ export class RHDHDeployment { : this._labelSelector; } - private async _waitForDeploymentRollout(): Promise { - await $`oc rollout status deployment -l ${this._deploymentLabelSelector} -n ${this.deploymentConfig.namespace} --timeout=300s`; - } - async rolloutRestart(): Promise { this._log( `Restarting RHDH deployment in namespace ${this.deploymentConfig.namespace}...`, ); await $`oc rollout restart deployment -l ${this._deploymentLabelSelector} -n ${this.deploymentConfig.namespace}`; - await this._waitForDeploymentRollout(); - await this.waitUntilReady(); this._log( `RHDH deployment restarted successfully in namespace ${this.deploymentConfig.namespace}`, ); + await this.waitUntilReady(); } /** * Performs a clean restart by scaling down to 0 first, waiting for pods to terminate, - * then scaling back up and waiting for rollout. This prevents MigrationLocked errors - * by ensuring no pods hold database locks when new pods start. + * then scaling back up. This prevents MigrationLocked errors by ensuring no pods + * hold database locks when new pods start. */ async scaleDownAndRestart(): Promise { const namespace = this.deploymentConfig.namespace; await $`oc scale deployment -l ${this._deploymentLabelSelector} --replicas=0 -n ${namespace}`; await $`oc wait --for=delete pod -l ${this._labelSelector} -n ${namespace} --timeout=120s || true`; await $`oc scale deployment -l ${this._deploymentLabelSelector} --replicas=1 -n ${namespace}`; - await this._waitForDeploymentRollout(); } async waitUntilReady(timeout: number = 500): Promise {