Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
39d7d9f
NOJIRA: Update OLM migration dependencies
rhamilto Nov 9, 2026
fc6ee3d
NOJIRA: Regenerate vendored OLM dependencies
rhamilto Nov 9, 2026
adf05f3
NOJIRA: Support deployment-managed operator migration
rhamilto Nov 9, 2026
35d3c60
OCPBUGS-139150: Address migration manager and test review
logonoff Nov 13, 2026
3720718
OCPBUGS-139150: Resume rollback after ClusterExtension deletion
logonoff Nov 9, 2026
c123b83
OCPBUGS-139150: Authorize rollback revisions independently of their c…
logonoff Nov 9, 2026
74e0832
OCPBUGS-139150: Document deployment migration tests and details actions
logonoff Nov 9, 2026
0c83637
OCPBUGS-139150: Verify rollback guards and report probe cleanup failures
logonoff Nov 9, 2026
879ca94
OCPBUGS-139150: Derive the rollback probe name from its revision
logonoff Nov 9, 2026
d0bb1c6
OCPBUGS-139150: Remove extension-owned rollback references
logonoff Nov 10, 2026
f6b1915
OCPBUGS-139150: Clarify migration recovery guidance
logonoff Nov 12, 2026
d6bfddb
OCPBUGS-139150: Remove the OLM rollback authorization README
logonoff Nov 12, 2026
3592bfe
OCPBUGS-139150: Update library-olm to current revision APIs
logonoff Nov 13, 2026
59d5e0e
OCPBUGS-139150: Regenerate vendored migration dependencies
logonoff Nov 13, 2026
5a50fde
Merge upstream/main into migration API branch
logonoff Nov 13, 2026
dd9a191
OCPBUGS-139150: Re-enable migration Tech Preview suites
logonoff Nov 13, 2026
6f6adc0
OCPBUGS-139150: Add required phases to the rollback admission probe
logonoff Nov 13, 2026
0575a89
OCPBUGS-139150: Update library-olm to the current revision API
logonoff Nov 13, 2026
066f335
OCPBUGS-139150: Regenerate vendored migration dependencies
logonoff Nov 13, 2026
536bb59
OCPBUGS-136136: Limit the height of migration details
logonoff Nov 13, 2026
336ec26
OCPBUGS-136135: Show active migrations in the operator list
logonoff Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
115 changes: 107 additions & 8 deletions frontend/e2e/fixtures/operator-migration-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@ interface Resource {
deletionTimestamp?: string;
finalizers?: string[];
annotations?: Record<string, string>;
labels?: Record<string, string>;
ownerReferences?: {
apiVersion: string;
kind: string;
name: string;
uid: string;
controller?: boolean;
}[];
};
spec?: {
namespace?: string;
lifecycleState?: string;
group?: string;
revision?: number;
source?: { catalog?: { packageName?: string } };
};
status?: {
Expand Down Expand Up @@ -59,6 +69,22 @@ export class OperatorMigrationFixture {
private readonly jobs = new Set<string>();
private readonly rollbackHolds = new Set<() => Promise<void>>();

/** Detects the revision manager API used by this cluster. */
private async hasDeploymentAPI(): Promise<boolean> {
try {
await this.client.getClusterCustomResource(
'apiextensions.k8s.io',
'v1',
'customresourcedefinitions',
'clusterobjectdeployments.olm.operatorframework.io',
);
return true;
} catch (error) {
if (isNotFound(error)) return false;
throw error;
}
}

/** Creates isolated catalog identifiers and shares cleanup and authentication configuration. */
constructor(
private readonly client: KubernetesClient,
Expand Down Expand Up @@ -154,6 +180,14 @@ export class OperatorMigrationFixture {
'v1',
'clusterextensions',
);
if (await this.hasDeploymentAPI()) {
this.cleanup.trackClusterCustomResource(
subscriptionName,
TARGET_GROUP,
'v1',
'clusterobjectdeployments',
);
}
this.cleanup.trackClusterCustomResource(
`${subscriptionName}-1`,
TARGET_GROUP,
Expand Down Expand Up @@ -600,25 +634,90 @@ export class OperatorMigrationFixture {
const references = await this.client.coreV1Api.listSecretForAllNamespaces({
labelSelector,
});
return { revisions: revisions.items.length, references: references.items.length };
let deployments = 0;
if (await this.hasDeploymentAPI()) {
const result = (await this.client.customObjectsApi.listClusterCustomObject({
group: TARGET_GROUP,
version: 'v1',
plural: 'clusterobjectdeployments',
labelSelector,
})) as { items: Resource[] };
deployments = result.items.length;
}
return {
revisions: revisions.items.length,
references: references.items.length,
deployments,
};
},
{
timeout: 60_000,
message: 'Recovery must remove all migration revisions and reference Secrets',
},
)
.toEqual({ revisions: 0, references: 0 });
.toEqual({ revisions: 0, references: 0, deployments: 0 });
}

/** Verifies retained migration resources and reconciliation after revision handover. */
async expectPreservedMigration(operator: MigrationOperator): Promise<void> {
await expect(async () => {
const objectSet = (await this.client.getClusterCustomResource(
TARGET_GROUP,
'v1',
'clusterobjectsets',
`${operator.subscriptionName}-1`,
)) as Resource;
let objectSet: Resource;
if (await this.hasDeploymentAPI()) {
const deployment = (await this.client.getClusterCustomResource(
TARGET_GROUP,
'v1',
'clusterobjectdeployments',
operator.subscriptionName,
)) as Resource;
expect(deployment.metadata.labels?.['apps.kubernetes.io/managed-by']).toBe(
'operator-controller',
);
const revisions = (await this.client.customObjectsApi.listClusterCustomObject({
group: TARGET_GROUP,
version: 'v1',
plural: 'clusterobjectsets',
})) as { items: Resource[] };
// Archived handover revisions can be pruned by revisionHistoryLimit.
// Validate the current active revision controlled by this deployment.
const active = revisions.items
.filter(
(revision) =>
!revision.metadata.deletionTimestamp &&
revision.spec?.group === deployment.metadata.name &&
revision.spec?.lifecycleState === 'Active' &&
revision.metadata.ownerReferences?.some(
(owner) =>
owner.apiVersion === `${TARGET_GROUP}/v1` &&
owner.kind === 'ClusterObjectDeployment' &&
owner.name === deployment.metadata.name &&
owner.uid === deployment.metadata.uid &&
owner.controller,
),
)
.sort((first, second) => (second.spec.revision ?? 0) - (first.spec.revision ?? 0));
expect(active.length).toBeGreaterThan(0);
[objectSet] = active;
expect(objectSet.metadata.labels?.['apps.kubernetes.io/managed-by']).toBe(
'object-controller',
);
expect(objectSet.metadata.ownerReferences).toEqual(
expect.arrayContaining([
expect.objectContaining({
kind: 'ClusterObjectDeployment',
name: deployment.metadata.name,
uid: deployment.metadata.uid,
controller: true,
}),
]),
);
} else {
objectSet = (await this.client.getClusterCustomResource(
TARGET_GROUP,
'v1',
'clusterobjectsets',
`${operator.subscriptionName}-1`,
)) as Resource;
}
const ready = objectSet.status?.conditions?.find(({ type }) => type === 'Ready');
const succeeded = objectSet.status?.conditions?.find(({ type }) => type === 'Succeeded');
const available = objectSet.status?.conditions?.find(({ type }) => type === 'Available');
Expand Down
10 changes: 10 additions & 0 deletions frontend/e2e/pages/details-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export class DetailsPage extends BasePage {
private readonly pageHeading = this.page.getByTestId('page-heading');
private readonly resourceTitle = this.page.getByTestId('resource-title');
private readonly skeletonLoader = this.page.getByTestId('skeleton-detail-view');
private readonly toastDismissButton = this.page
.getByTestId('toast-notifications')
.getByRole('button', { name: /^(Close|Minimize) / })
.first();
readonly nodeTerminalError: Locator = this.page.getByTestId('node-terminal-error');
readonly xtermViewport: Locator = this.page.locator('.xterm-viewport');

Expand Down Expand Up @@ -37,7 +41,13 @@ export class DetailsPage extends BasePage {
await this.goTo(url);
}

/** Dismisses overlapping notifications before opening and selecting a details-page action. */
async clickPageAction(actionName: string): Promise<void> {
// Persistent notifications can cover the details actions. Dismiss them
// before clicking so a forced click cannot hit a notification instead.
while (await this.toastDismissButton.isVisible()) {
await this.toastDismissButton.click();
}
await this.robustClick(this.page.getByTestId('actions-menu-button'));
await this.robustClick(this.page.getByTestId(actionName));
}
Expand Down
19 changes: 7 additions & 12 deletions frontend/e2e/tests/olm/operator-migration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ const prepareInstalledTargetFailure = async (
};

test.describe('Operator migration', { tag: ['@techpreview'], lock: OLM_CLUSTER_STATE_LOCK }, () => {
test.skip(
true,
'operator-controller#3126 made type required on revision objects; the pinned library-olm emits the old format and migrations roll back (library-olm#93 pending)',
);
test.setTimeout(900_000);

test('migrates one operator after a read-only plan review and keeps its operand running', async ({
Expand Down Expand Up @@ -657,10 +653,6 @@ test.describe(
'Operator migration interruptions',
{ tag: ['@techpreview'], lock: OLM_CLUSTER_STATE_LOCK },
() => {
test.skip(
true,
'operator-controller#3126 made type required on revision objects; the pinned library-olm emits the old format and migrations roll back (library-olm#93 pending)',
);
// Logout must not revoke the saved session shared by other workers.
test.use({ storageState: { cookies: [], origins: [] } });
test.setTimeout(900_000);
Expand Down Expand Up @@ -706,6 +698,9 @@ test.describe(
await migrationPage.startMigration();
await migration.expectHeldMigration(first);
await expect(migrationPage.getProgress()).toContainText('0 of 2 Operators processed');
await expect(migrationPage.getStatus(second.packageName)).toContainText(
'Migration in progress',
);
let returnedPage = migrationPage;
let replacementBrowser: Browser | undefined;
try {
Expand Down Expand Up @@ -738,6 +733,10 @@ test.describe(
}
await expect(returnedPage.getProgress()).toBeVisible({ timeout: 90_000 });
await expect(returnedPage.getProgress()).toContainText('0 of 2 Operators processed');
await returnedPage.navigateToOperators();
await expect(returnedPage.getStatus(second.packageName)).toContainText(
'Migration in progress',
);
await release();
for (const operator of [first, second]) {
await expect(returnedPage.getResult(operator.subscriptionName)).toContainText(
Expand Down Expand Up @@ -811,10 +810,6 @@ test.describe(
'Operator rollback interruptions',
{ tag: ['@techpreview'], lock: OLM_CLUSTER_STATE_LOCK },
() => {
test.skip(
true,
'operator-controller#3126 made type required on revision objects; the pinned library-olm emits the old format and migrations roll back (library-olm#93 pending)',
);
// Logout must not revoke the saved session shared by other workers.
test.use({ storageState: { cookies: [], origins: [] } });
test.setTimeout(900_000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export const InternalToastProvider: FC<InternalToastProviderProps> = ({
{children}
{!isNotificationDrawerExpanded && toasts.length > 0 ? (
<AlertGroup
data-test="toast-notifications"
appendTo={appendTo}
isToast
isLiveRegion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"Cluster wide": "Cluster wide",
"Cluster-wide CatalogSource": "Cluster-wide CatalogSource",
"ClusterExtension": "ClusterExtension",
"ClusterObjectDeployment": "ClusterObjectDeployment",
"ClusterObjectSet": "ClusterObjectSet",
"ClusterServiceVersion": "ClusterServiceVersion",
"ClusterServiceVersion details": "ClusterServiceVersion details",
Expand Down Expand Up @@ -290,6 +291,7 @@
"Migration blocked for {{operator}}": "Migration blocked for {{operator}}",
"Migration completed": "Migration completed",
"Migration failed": "Migration failed",
"Migration in progress": "Migration in progress",
"Migration job canceled": "Migration job canceled",
"Migration job completed": "Migration job completed",
"Migration job failed. Review the error and the Operator results before you try again. Error: {{error}}": "Migration job failed. Review the error and the Operator results before you try again. Error: {{error}}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { isDataViewTdObject } from '@patternfly/react-data-view/dist/esm/DataViewTable/DataViewTable';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import type { SubscriptionKind } from '../../types';
import { getOperatorMigrationScans } from '../../utils/operator-migration-api';
import type { OperatorMigrationScan } from '../../utils/operator-migration-api';
import { getOperatorMigrationEligibilityCell } from '../operator-migration-eligibility';
import { useMigrationNotifications } from '../operator-migration-notifications';

jest.mock('react-i18next', () => {
const t = (key: string, values?: Record<string, string>) =>
Expand All @@ -13,6 +13,7 @@ jest.mock('react-i18next', () => {
});

jest.mock('../../status/csv-status', () => ({ subscriptionForCSV: jest.fn() }));
jest.mock('../operator-migration-notifications', () => ({ useMigrationNotifications: jest.fn() }));
jest.mock('../../utils/operator-migration-api', () => ({
getOperatorMigrationScans: jest.fn(),
OPERATOR_MIGRATION_SCAN_INVALIDATED_EVENT: 'test-migration-scans',
Expand All @@ -29,7 +30,7 @@ const renderCell = () => {
const [cell] = getOperatorMigrationEligibilityCell([
{ obj: subscription, rowData: { subscriptions: [] }, activeColumnIDs: new Set(), index: 0 },
]);
render(<>{isDataViewTdObject(cell) ? cell.cell : cell}</>);
render(<>{cell && typeof cell === 'object' && 'cell' in cell ? cell.cell : cell}</>);
};

const mockScan = (scan: Partial<OperatorMigrationScan>) => {
Expand All @@ -45,7 +46,33 @@ const mockScan = (scan: Partial<OperatorMigrationScan>) => {
};

describe('OperatorMigrationEligibilityCell', () => {
beforeEach(() => jest.clearAllMocks());
beforeEach(() => {
jest.clearAllMocks();
(useMigrationNotifications as jest.Mock).mockReturnValue({ migratingOperators: new Set() });
});

it('shows an active migration instead of stale eligibility', async () => {
mockScan({ status: 'Eligible', eligible: true });
(useMigrationNotifications as jest.Mock).mockReturnValue({
migratingOperators: new Set(['netobserv-operator/netobserv-operator']),
});
renderCell();

expect(await screen.findByText('Migration in progress')).toBeVisible();
expect(screen.queryByRole('button')).not.toBeInTheDocument();
expect(screen.queryByText('Eligible')).not.toBeInTheDocument();
});

it('does not use a migration for the same subscription name in another namespace', async () => {
mockScan({ status: 'Eligible', eligible: true });
(useMigrationNotifications as jest.Mock).mockReturnValue({
migratingOperators: new Set(['another-namespace/netobserv-operator']),
});
renderCell();

expect(await screen.findByRole('button', { name: 'Migration status: Eligible' })).toBeVisible();
expect(screen.queryByText('Migration in progress')).not.toBeInTheDocument();
});

it.each([
{
Expand Down
Loading